+ after it (Telegram's steps, found in the phone check, 11 Nov). The side padding is here
+ too, inside that element's overflow-hidden: on the outer popup it cut off the left edge
+ of a title's first letter (the "T" of "The proof…", Ancung, 11 Nov). */}
+
{top}
["minds", mindId, "threads", threadId] as const,
run: (runId: string) => ["runs", runId] as const,
+ proof: (runId: string) => ["runs", runId, "proof"] as const,
/** The user message that started a run (Approvals' "You asked"). */
asked: (runId: string) => ["runs", runId, "asked"] as const,
}
diff --git a/apps/fe/src/modules/builder/components/AddBlockSheet.tsx b/apps/fe/src/modules/builder/components/AddBlockSheet.tsx
index 7dbfe2ab..0206e220 100644
--- a/apps/fe/src/modules/builder/components/AddBlockSheet.tsx
+++ b/apps/fe/src/modules/builder/components/AddBlockSheet.tsx
@@ -21,13 +21,14 @@ export function AddBlockSheet({ at, line, onClose, onPick }: { at: Place | null;
return (
// A drawer from the bottom you can swipe away, like the live view on phones (Ancung, 10 Nov).
!open && onClose()} showSwipeHandle>
-
+
{/* A margin, not the drawer's gap: its children sit in an inner element without one. */}
-
+
Add a block
{where}
-
+ {/* Side padding inside the drawer's clipped content, not on its outer popup (it cut letters). */}
+
{ADD_KINDS.map((kind) => {
const { tone, Icon, title, long } = KIND_META[kind]
const why = off(kind)
diff --git a/apps/fe/src/modules/chat/api.ts b/apps/fe/src/modules/chat/api.ts
index 3c6480aa..c49d985b 100644
--- a/apps/fe/src/modules/chat/api.ts
+++ b/apps/fe/src/modules/chat/api.ts
@@ -1,6 +1,7 @@
import { api } from "@/lib/api"
import { ownerTimeZone, stream } from "@/lib/stream"
import type { RunEvent } from "@/modules/runs/data/events"
+import type { RunProofs } from "@/modules/runs/data/proof"
// Chat, runs and approvals: docs/api-contract.md §7. Chat and approve/decline answer with an SSE
// stream of §3 events (`stream` in src/lib/stream.ts).
@@ -21,6 +22,8 @@ export const chatApi = {
send: (mindId: string, body: { message: string; threadId?: string }, onEvent: (e: RunEvent) => void, signal?: AbortSignal) =>
stream(`/minds/${enc(mindId)}/chat`, { ...body, ...ownerTimeZone() }, onEvent, signal),
/** Stop a run that is still streaming (#121). Its stream then ends with run.finished "canceled". */
+ /** The proof behind a reply's verified badge (#254, #257); `404 no_proof` when none was kept. */
+ runProof: (runId: string) => api(`/runs/${enc(runId)}/proof`),
cancel: (runId: string) => api(`/runs/${enc(runId)}/cancel`, { method: "POST", body: {} }),
resume: (
runId: string,
diff --git a/apps/fe/src/modules/chat/components/TurnView.tsx b/apps/fe/src/modules/chat/components/TurnView.tsx
index 7a3a9d63..b4c54ea4 100644
--- a/apps/fe/src/modules/chat/components/TurnView.tsx
+++ b/apps/fe/src/modules/chat/components/TurnView.tsx
@@ -144,7 +144,7 @@ export function TurnView({
{working && }
{!live && view.text && (
- {view.verified &&
}
+ {view.verified &&
}
{view.at &&
{clockTime(view.at)}}
{/* Actions under a finished reply, like Claude (Ancung, 10 Nov). */}
diff --git a/apps/fe/src/modules/runs/components/ProofDialog.tsx b/apps/fe/src/modules/runs/components/ProofDialog.tsx
new file mode 100644
index 00000000..93e87e79
--- /dev/null
+++ b/apps/fe/src/modules/runs/components/ProofDialog.tsx
@@ -0,0 +1,170 @@
+"use client"
+
+import { useQuery } from "@tanstack/react-query"
+import { ArrowUpRightIcon, CheckIcon, CircleAlertIcon } from "lucide-react"
+import type { ReactNode } from "react"
+import { cn } from "cn"
+import { CopyButton } from "@/components/elements/CopyButton"
+import { ResponsiveDialog } from "@/components/elements/ResponsiveDialog"
+import { Button } from "@/components/ui/button"
+import { Skeleton } from "@/components/ui/skeleton"
+import { isApiCode } from "@/lib/api"
+import { chatKeys } from "@/lib/queryKeys"
+import { chatApi } from "@/modules/chat/api"
+import { checkedSteps, replyProof, shortHex, tcbText, TEE_EXPLORER_URL, type Proof } from "@/modules/runs/data/proof"
+
+const VERIFIER_URL = "https://github.com/nearai/nearai-cloud-verifier"
+
+/**
+ * "View proof" (#254): the evidence behind a reply's verified badge, in plain words first. Each
+ * step was signed by the attested key; the hardware's own report (Intel, and NVIDIA where the
+ * model itself runs in the TEE); then the raw pieces to copy and the public checkers. Raw quotes
+ * and signatures are never laid out on screen, only copied. Read when opened
+ * (`GET /runs/{runId}/proof`, #257); the last entry is the reply's.
+ */
+export function ProofDialog({ runId, open, onOpenChange }: { runId: string; open: boolean; onOpenChange: (open: boolean) => void }) {
+ const proofs = useQuery({
+ queryKey: chatKeys.proof(runId),
+ queryFn: () => chatApi.runProof(runId),
+ enabled: open,
+ staleTime: Infinity,
+ retry: (count, err) => !isApiCode(err, "no_proof") && !isApiCode(err, "run_not_found") && count < 2,
+ })
+ const entry = replyProof(proofs.data)
+
+ return (
+ onOpenChange(false)}>
+ Close
+
+ }
+ >
+
+ {proofs.isPending ? (
+
+
+
+
+ ) : proofs.error ? (
+
+ {isApiCode(proofs.error, "no_proof")
+ ? "No proof was kept for this reply. Replies from before 11 Nov don't have one."
+ : "Could not load the proof. Please try again later."}
+
+ ) : entry ? (
+
+ ) : null}
+
+
+ )
+}
+
+function ProofBody({ proof, model }: { proof: Proof; model: string | null }) {
+ const steps = checkedSteps(proof)
+ const attestations = Object.values(proof.attestations)
+ const allMatch = steps.length > 0 && steps.every((s) => s.matches)
+ const checkedAt = new Date(proof.checkedAt)
+ const raw = JSON.stringify(proof, null, 2)
+
+ return (
+ <>
+
+
+ {allMatch
+ ? `All ${steps.length} ${steps.length === 1 ? "step was" : "steps were"} signed by the key the hardware vouches for.`
+ : "A step's signer doesn't match the attested key."}
+
+
+ {steps.map(({ step, matches }) => (
+ -
+
+ {step.signatureKind === "provider_tee" ? "Model step" : "Gateway step"}, signed by{" "}
+ {shortHex(step.signer.address)}
+
+ {matches ? : }
+
+ ))}
+
+
+ Only hashes of the messages were signed, never the conversation.{model ? ` Model: ${model.split("/").pop()}.` : ""}
+
+
+
+
+ {attestations.map((a) => {
+ const tcb = tcbText(a.tcbStatus)
+ return (
+
+
{a.kind === "model" ? "The model's TEE" : "NEAR AI's gateway TEE"}
+
Intel TDX report: {tcb.text.toLowerCase()}
+ {a.gpuEvidence &&
NVIDIA GPU evidence included}
+
+ Fresh for this check (nonce {shortHex(a.nonce)})
+
+
+ )
+ })}
+ {!Number.isNaN(checkedAt.getTime()) && (
+
+ Checked {checkedAt.toLocaleString("en-GB", { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" })}
+
+ )}
+
+
+
+
+ {attestations[0] && (
+
+ attestations[0].intelQuote} label="Copy the Intel quote" showLabel />
+
+ )}
+
+ raw} label="Copy the proof" showLabel />
+
+
+
+
+ >
+ )
+}
+
+function Section({ title, children }: { title: string; children: ReactNode }) {
+ return (
+
+ )
+}
+
+function Line({ ok, children }: { ok: boolean; children: ReactNode }) {
+ return (
+
+ {ok ? : }
+ {children}
+
+ )
+}
+
+function Row({ label, children }: { label: string; children: ReactNode }) {
+ return (
+
+ {label}
+ {children}
+
+ )
+}
diff --git a/apps/fe/src/modules/runs/components/VerifiedBadge.tsx b/apps/fe/src/modules/runs/components/VerifiedBadge.tsx
index ae9f1405..ca756b60 100644
--- a/apps/fe/src/modules/runs/components/VerifiedBadge.tsx
+++ b/apps/fe/src/modules/runs/components/VerifiedBadge.tsx
@@ -1,9 +1,12 @@
"use client"
-import { ArrowUpRightIcon } from "lucide-react"
+import { ArrowUpRightIcon, FileCheckIcon } from "lucide-react"
+import { useState } from "react"
import { CopyButton } from "@/components/elements/CopyButton"
import { Badge } from "@/components/ui/badge"
+import { Button } from "@/components/ui/button"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
+import { ProofDialog } from "@/modules/runs/components/ProofDialog"
const DOCS_URL = "https://docs.near.ai/cloud/verification"
const VERIFIER_URL = "https://github.com/nearai/nearai-cloud-verifier"
@@ -15,64 +18,94 @@ const modelName = (id: string) => id.split("/").pop() ?? id
* The verified badge under a reply (#19). It opens a short explanation (Ancung, 11 Nov: like
* near.ai/models' "Private TEE" note, with a way to the proof): what was checked, for which model,
* how many steps, their ids to copy, and the public docs and verifier. It only says what the
- * engine proved (`run.verified`, docs/api-contract.md §3); the signatures and attestation reports
- * themselves need a NEAR AI key the browser doesn't have, so they aren't shown here.
+ * engine proved (`run.verified`, docs/api-contract.md §3). "View proof" opens the evidence itself
+ * (#254: the signatures and the hardware's reports, served by the backend).
*/
-export function VerifiedBadge({ level, proof }: { level: "gateway_tee" | "model_tee"; proof?: { model: string | null; completionIds: string[] } }) {
+export function VerifiedBadge({
+ level,
+ proof,
+ runId,
+}: {
+ level: "gateway_tee" | "model_tee"
+ proof?: { model: string | null; completionIds: string[] }
+ /** The run, for "View proof" (#254); without it the popover only explains. */
+ runId?: string | null
+}) {
+ const [open, setOpen] = useState(false)
+ const [viewing, setViewing] = useState(false)
const label = level === "model_tee" ? "Verified private (model TEE)" : "Verified via NEAR AI TEE gateway"
const steps = proof?.completionIds ?? []
return (
-
-
- }
- >
-
- {label}
-
-
-
-
-
{label}
-
- {level === "model_tee"
- ? "This reply was made inside a sealed part of the chip (a TEE) that runs the model itself, so not even NEAR AI can read your messages. Every step was signed by a key that never leaves the model's TEE, and HelloNear checked each signature against that TEE's attestation from NVIDIA (GPU) and Intel (CPU)."
- : "This reply came through NEAR AI's gateway, which runs inside a sealed part of the chip (a TEE). Every step was signed by a key that never leaves the gateway's TEE, and HelloNear checked each signature against that TEE's Intel TDX attestation."}
-
-
-
- {proof?.model && (
-
-
- Model
- - {modelName(proof.model)}
-
- )}
- {steps.length > 0 && (
-
-
- Steps checked
- -
- {steps.length}
- steps.join("\n")} label="Copy step ids" />
-
-
- )}
-
-
-
-
+ <>
+
+
+ }
+ >
+
+ {label}
+
+
+
+
+
{label}
+
+ {level === "model_tee"
+ ? "This reply was made inside a sealed part of the chip (a TEE) that runs the model itself, so not even NEAR AI can read your messages. Every step was signed by a key that never leaves the model's TEE, and HelloNear checked each signature against that TEE's attestation from NVIDIA (GPU) and Intel (CPU)."
+ : "This reply came through NEAR AI's gateway, which runs inside a sealed part of the chip (a TEE). Every step was signed by a key that never leaves the gateway's TEE, and HelloNear checked each signature against that TEE's Intel TDX attestation."}
+
+
+
+ {proof?.model && (
+
+
- Model
+ - {modelName(proof.model)}
+
+ )}
+ {steps.length > 0 && (
+
+
- Steps checked
+ -
+ {steps.length}
+ steps.join("\n")} label="Copy step ids" />
+
+
+ )}
+
+ {/* One row of actions (Ancung, 11 Nov: a button and two links stacked read as clutter).
+ With a run, View proof leads and "Check it yourself" lives in its dialog. */}
+
+
+
+ {runId && }
+ >
)
}
diff --git a/apps/fe/src/modules/runs/data/proof.ts b/apps/fe/src/modules/runs/data/proof.ts
new file mode 100644
index 00000000..88ae7a8f
--- /dev/null
+++ b/apps/fe/src/modules/runs/data/proof.ts
@@ -0,0 +1,57 @@
+// The proof behind the verified badge (#254): what the engine checked for each model step, kept on
+// `run.verified` (#256) and served by `GET /runs/{runId}/proof` (#257). docs/api-contract.md §3, §7.
+
+export type ProofSigner = { algo: string; address: string }
+
+export type StepProof = {
+ id: string
+ /** "gateway" for a streamed step (signed in the NEAR AI gateway's TEE), "provider_tee" inside the model's. */
+ signatureKind: string
+ signer: ProofSigner
+ /** Hashes only: `{request_hash}:{response_hash}`, never the conversation. */
+ signedText: string
+ signature: string
+ /** The key of the attestation whose signer signed this step. */
+ attestation: string
+}
+
+export type AttestationProof = {
+ kind: "gateway" | "model"
+ signer: ProofSigner
+ nonce: string
+ /** The Intel TDX quote, which anyone can check at proof.t16z.com. */
+ intelQuote: string
+ tcbStatus: string
+ /** NVIDIA's GPU evidence: only where the model itself runs in the TEE. */
+ gpuEvidence?: string
+ composeHash?: string
+ osImageHash?: string
+}
+
+export type Proof = { checkedAt: string; steps: StepProof[]; attestations: Record }
+
+/** `model` and `level` are null when a stored `run.verified` lacks them (the backend's `runProofs`; James on #259). */
+export type RunProofs = { runId: string; proofs: { seq: number; model: string | null; level: string | null; proof: Proof }[] }
+
+export const TEE_EXPLORER_URL = "https://proof.t16z.com"
+
+/** The reply's proof: a run paused for approval has one per part, and the last is the reply's. */
+export const replyProof = (r: RunProofs | undefined) => r?.proofs.at(-1) ?? null
+
+/** Each step with whether its signer is the attested one, the check the badge rests on. */
+export function checkedSteps(proof: Proof) {
+ return proof.steps.map((s) => {
+ const att = proof.attestations[s.attestation]
+ return { step: s, attestation: att ?? null, matches: Boolean(att) && att.signer.address.toLowerCase() === s.signer.address.toLowerCase() }
+ })
+}
+
+/** Intel's TCB status in plain words; "UpToDate" is the one with nothing to patch. */
+export function tcbText(status: string): { text: string; ok: boolean } {
+ if (status === "UpToDate") return { text: "Up to date", ok: true }
+ if (!status || status === "Unknown") return { text: "Not reported", ok: false }
+ return { text: status.replace(/([a-z])([A-Z])/g, "$1 $2"), ok: false }
+}
+
+/** "0x1234…cdef": enough of an address or hash to tell two apart. */
+export const shortHex = (v: string, keep = 6) => (v.length > keep * 2 + 3 ? `${v.slice(0, keep)}…${v.slice(-keep)}` : v)
diff --git a/apps/fe/tests/proof.test.ts b/apps/fe/tests/proof.test.ts
new file mode 100644
index 00000000..d4b81c5e
--- /dev/null
+++ b/apps/fe/tests/proof.test.ts
@@ -0,0 +1,28 @@
+import { describe, expect, it } from "vitest"
+import { checkedSteps, replyProof, shortHex, tcbText, type Proof } from "@/modules/runs/data/proof"
+
+const proof: Proof = {
+ checkedAt: "2026-11-11T08:00:00Z",
+ steps: [
+ { id: "chatcmpl-1", signatureKind: "gateway", signer: { algo: "ecdsa", address: "0xAbC123" }, signedText: "a:b", signature: "0xsig", attestation: "gateway:0xabc123" },
+ { id: "chatcmpl-2", signatureKind: "gateway", signer: { algo: "ecdsa", address: "0xdead" }, signedText: "c:d", signature: "0xsig2", attestation: "gateway:0xabc123" },
+ ],
+ attestations: { "gateway:0xabc123": { kind: "gateway", signer: { algo: "ecdsa", address: "0xabc123" }, nonce: "ff", intelQuote: "0400", tcbStatus: "UpToDate" } },
+}
+
+describe("the proof behind the badge (#254)", () => {
+ it("checks each step's signer against its attestation's, ignoring case", () => {
+ expect(checkedSteps(proof).map((s) => s.matches)).toEqual([true, false])
+ })
+ it("takes the reply's proof, the last part of a paused run", () => {
+ const p = (seq: number) => ({ seq, model: "m", level: "gateway_tee", proof })
+ expect(replyProof({ runId: "r", proofs: [p(4), p(9)] })?.seq).toBe(9)
+ expect(replyProof(undefined)).toBeNull()
+ })
+ it("words Intel's status plainly and shortens hex", () => {
+ expect(tcbText("UpToDate")).toEqual({ text: "Up to date", ok: true })
+ expect(tcbText("OutOfDate")).toEqual({ text: "Out Of Date", ok: false })
+ expect(tcbText("")).toEqual({ text: "Not reported", ok: false })
+ expect(shortHex("0x1234567890abcdef1234")).toBe("0x1234…ef1234")
+ })
+})