UAI-1 / Install Kit

UAI-1 C# Website Support Kit

This page publishes the Protocol5 NuGet package and starter ZIP for getting a working UAI endpoint onto a C# website in minutes. The package is the reference implementation path for install, load, validate, export, route, render, and test.

Structured UAI interface

Canonical UAI viewer

Protocol5 loads this page's canonical JSON, linked registries, and validation schema directly from the live Protocol5 endpoints.

Loading canonical Protocol5 UAI resources...
Loading structured view...

Protocol5 is fetching the canonical JSON, schemas, registries, and validation hooks for this page.

Human companion

UAI-1 C# Website Support Kit

This localized markdown rendering remains the human-facing source for this page, while the structured Protocol5 UAI workbench above layers canonical machine inspection on top of the same source document.

UAI-1 C# Website Support Kit

This page publishes the Protocol5 NuGet package and starter ZIP for getting a working UAI endpoint onto a C# website in minutes. The package is the reference implementation path for install, load, validate, export, route, render, and test.

Document Information

What the package now covers

  • Install the package into an ASP.NET Core site
  • Load canonical examples and discovery assets from the package
  • Validate UAI-1 JSON against the canonical schema and reference validator
  • Export HTML into canonical .uai.json
  • Route canonical machine artifacts such as /UAI-1.json and /schema/uai-1.schema.json
  • Route page-specific UAI endpoints such as /docs/hello/index.uai.json
  • Render UAI-1 back to HTML
  • Test endpoint output with the same parser and validator used by the package

Quick start

Install from NuGet:

dotnet add package Protocol5.UAI.CSharp

Then wire it into an ASP.NET Core site:

using Protocol5.UAI;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddProtocol5UaiWebsiteSupport();

var app = builder.Build();
app.UseProtocol5UaiWebsiteSupport();
app.MapProtocol5UaiCanonicalArtifacts();
app.MapProtocol5UaiHtmlEndpoint(
    "/docs/hello/index.uai.json",
    static () => "<html lang=\"en\"><body><h1>Hello UAI</h1><p>Ready in minutes.</p></body></html>",
    new UaiHtmlTranslationOptions
    {
        SourceUri = "https://example.org/docs/hello",
        DocumentId = "docs-hello",
        PageType = "article",
        SiteName = "Example"
    });

app.Run();

That setup gives you a working page endpoint plus the canonical embedded machine artifacts exposed by the package.

Validate

var document = new UaiDocumentParser().Parse(json);
var validation = new UaiDocumentValidator().Validate(document);
if (!validation.IsValid)
{
    throw new InvalidOperationException("UAI validation failed.");
}

Load, validate, and emit canonical JSON

var loader = new UaiCanonicalAssetLoader();
var exampleJson = loader.LoadExampleText("homepage.uai.json");
var schemaValidation = new UaiSchemaValidator().ValidateCanonicalJson(exampleJson);
if (!schemaValidation.IsValid)
{
    throw new InvalidOperationException("Canonical validation failed.");
}

var example = loader.LoadExampleDocument("homepage.uai.json");
var validation = new UaiDocumentValidator().Validate(example);
var canonicalJson = UaiDocumentSerializer.Serialize(example);

Export

var exporter = new UaiHtmlExporter();
var export = exporter.ExportToFile("Pages/hello.html", "wwwroot/docs/hello/index.uai.json", new UaiHtmlTranslationOptions
{
    SourceUri = "https://example.org/docs/hello",
    DocumentId = "docs-hello",
    PageType = "article"
});

Render

var renderedHtml = new UaiHtmlRenderer().Render(export.Document);

Test

var json = await client.GetStringAsync("/docs/hello/index.uai.json");
var document = new UaiDocumentParser().Parse(json);
Assert.IsTrue(new UaiDocumentValidator().Validate(document).IsValid);

HTML recommendation

If a page is meant to declare UAI-aware content directly, use:

<html lang="x-uai-1">

And pair the human page with the machine endpoint:

<link rel="alternate" type="application/uai+json" href="/docs/hello/index.uai.json">

Canonical formatting rule

When serializing canonical UAI values, always use InvariantCulture:

using Protocol5.UAI;

var confidence = 0.875m.ToString(UaiCultureInfo.CanonicalSerializationCulture);

Radix 63404 examples included in the kit

Radix63404.Encode(41);        // simple single-glyph id
Radix63404.Encode(5651);      // sample two-glyph id
Radix63404.Encode(267914296); // sample three-glyph id

Download links