Skip to content

IAgentPrismUiProvider

Namespace AgentPrism · Assembly AgentPrism.AspNetCore.dll

Source that serves the management UI’s static assets.

public interface IAgentPrismUiProvider

This abstraction is deliberately single-method. The asset list, content type, ETag, cache headers, compression format, and single-page-application fallback all belong entirely to the implementation. This way, the HTTP layer’s public API stays unchanged when the UI package changes its own bundling format.

The dependency direction is AgentPrism.UI → AgentPrism.AspNetCore and cannot be reversed. This is why MapAgentPrism cannot call the UI package directly; it resolves the registration from the service provider. If no registration exists, the UI routes are never wired up and the HTTP surface is unchanged.

Implementations are registered with TryAdd; the consumer’s own registration wins (the replaceable-extension rule).

Whether an asset is available to serve. If false, the UI routes are never wired up.

bool HasAssets { get; }

bool

UI assets are produced at build time. A package built in an environment without Node.js can end up empty; in that case, it is correct to never open the routes rather than serve a blank page — the consumer sees a 404 and looks for the reason.

TryServeAsync(HttpContext, string, string)

Section titled “ TryServeAsync(HttpContext, string, string)”

Serves a UI request.

ValueTask<bool> TryServeAsync(HttpContext context, string basePath, string relativePath)

context HttpContext

The request context.

basePath string

The base path the UI is mounted under; always ends with /. Example: /agentprism/. The implementation writes this into the <base href> tag inside index.html, so the UI works under any prefix.

relativePath string

The requested asset path relative to the base path. An empty string for the root request. The leading / has been removed.

ValueTask<bool>

true if the request was served. If it returns false, the caller produces a 404; in that case the implementation must have written nothing to the response.