The local Rust policy-gate demonstration · Chapter 8 of 9

Themed UI

web/ is a Next.js app on one page. Tabs are Analysis, Policy and prompt, and Ledger. Analysis is the landing view. /?tab=instructions and /?tab=analysis open Analysis. Analysis opens with Pattern, then How to operate, What each result means, and Flow. Pattern follows PATTERN.md: effect, three objects, two sites, then the catalog of hashes, policies, resource verbs, and stamps. The Policy and prompt tab lists document-edit, code-read, code-write, and income-statement, and an Example selector. Choosing income-statement fills the policy, the prompt, and the file. The file bytes are the secured income_statement span inside that prompt. Submit sends that policy and that prompt. The Agent action tab shows three lines: expected action, actual proposal, and broken clause. The page uses Material Dashboard cards, buttons, and table cells. The page omits the theme drawer. /policy and /prompt redirect to /?tab=request. /ledger redirects to /?tab=ledger. A ledger row expander shows one tab at a time: Payload, Model reply, Agent action, Hashes, and Checks. Hashes shows the full policy_hash, prompt_hash, request_hash, and protected_span_hashes, the committed policy, and the policy object echoed by the model when that field is present.

Start the API from this directory. The native process listens on 127.0.0.1:8787 when PORT is unset.

cargo run --bin serve

The Edge page is the static export. GET / returns web/out/index.html. POST /submit sends the http6-w1-00 body to the same origin, with Content-Digest, Signature-Input, and Signature. POST /inject sends { "set": "examples" } with the selected policy object. The page and the JSON responses do not contain XAI_API_KEY or GROK_API.

npm run dev is not the Edge process. Build the static export from web/ with npm install and npm run build. The export is web/out.