From b213e7378f6ad86fe8a7f219a01ddd6954a94629 Mon Sep 17 00:00:00 2001 From: ancung Date: Wed, 11 Nov 2026 15:49:32 +0700 Subject: [PATCH 1/4] feat(fe): View proof, the evidence behind a reply's verified badge (#254) The engine keeps the proof on `run.verified` (#256) and the backend serves it on `GET /runs/{runId}/proof` (#257, live on the hosted API: it answered 404 no_proof for an older reply). The badge's popover gets "View proof", which opens a dialog in plain words first: - Signed inside the TEE: each step's signer checked against its attestation's signer. - Hardware checked: Intel TDX's status in words, NVIDIA's GPU evidence only where it exists (a streamed chat reply is gateway-level, Intel only), the nonce and when it was checked. - Check it yourself: copy the Intel quote or the whole proof, TEE Explorer, NEAR AI's verifier. Raw quotes and signatures are only copied, never laid out. A reply from before #256 says no proof was kept. The popover no longer says NVIDIA checked a gateway-level reply, which it didn't. Tests: typecheck, lint, vitest 269/269 (new: signer matching, the reply's entry, Intel's status in words). Checked in Chrome: the popover with View proof, the dialog's no-proof case on the hosted API. Not checked yet: a reply that carries a proof. Co-Authored-By: Claude Opus 5.5 --- apps/fe/CLAUDE.md | 2 +- apps/fe/src/lib/queryKeys.ts | 1 + apps/fe/src/modules/chat/api.ts | 3 + .../src/modules/chat/components/TurnView.tsx | 2 +- .../modules/runs/components/ProofDialog.tsx | 170 ++++++++++++++++++ .../modules/runs/components/VerifiedBadge.tsx | 144 +++++++++------ apps/fe/src/modules/runs/data/proof.ts | 56 ++++++ apps/fe/tests/proof.test.ts | 28 +++ 8 files changed, 348 insertions(+), 58 deletions(-) create mode 100644 apps/fe/src/modules/runs/components/ProofDialog.tsx create mode 100644 apps/fe/src/modules/runs/data/proof.ts create mode 100644 apps/fe/tests/proof.test.ts diff --git a/apps/fe/CLAUDE.md b/apps/fe/CLAUDE.md index eaf52839..e7ac1798 100644 --- a/apps/fe/CLAUDE.md +++ b/apps/fe/CLAUDE.md @@ -210,7 +210,7 @@ Imports: `@/*` → `src/*`, `@app/*` → `app/*`. Keep route files in `app/` thi - **System messages are formal and plain** (Ancung, 10 Nov: toasts and errors sounded too chatty). Toasts get a short standard title ("Key saved", "Funds added", "Could not send your answer") with any detail in the description line. Errors say what failed and what to do: "Could not load the payments. Please try again later.", "No changes were made.", "Check your connection and try again."; no "Couldn't", "Try again in a moment", "Nothing changed; try again" or "Something went wrong on the way". Empty states are plain ("No transactions yet", "No pending approvals"). Product copy from the design (headlines, skill cards, chat intros) keeps its voice. No "·" separators anywhere on screen. - Never hold or send the backend's API keys or grant tokens in the browser; the FE only talks to `apps/be`. - Wording: say "policy stored on-chain, enforced in a TEE". A rejected transfer shows `policy_denied` and the rule, never a tx link. -- Verification badge follows `docs/api-contract.md` §4: `gateway_tee` (a normal chat run) shows "Verified via NEAR AI TEE gateway", `model_tee` shows "Verified private (model TEE)", anything else no badge. The badge opens a popover (`runs/components/VerifiedBadge.tsx`, Ancung, 11 Nov, like near.ai/models' "Private TEE" note): what was checked in plain words, the model, how many steps with their completion ids to copy (`RunView.proof`, from `run.verified`'s `model` and `completionIds`), and links to docs.near.ai/cloud/verification and the open-source verifier. The signatures and attestation reports themselves need a NEAR AI key the browser doesn't have, so they aren't shown. +- Verification badge follows `docs/api-contract.md` §4: `gateway_tee` (a normal chat run) shows "Verified via NEAR AI TEE gateway", `model_tee` shows "Verified private (model TEE)", anything else no badge. The badge opens a popover (`runs/components/VerifiedBadge.tsx`, Ancung, 11 Nov, like near.ai/models' "Private TEE" note): what was checked in plain words, the model, how many steps with their completion ids to copy (`RunView.proof`, from `run.verified`'s `model` and `completionIds`), and links to docs.near.ai/cloud/verification and the open-source verifier. "View proof" in it opens `ProofDialog` (#254): `GET /runs/{runId}/proof` (#257), the last entry being the reply's, read when opened; in plain words first: "Signed inside the TEE" (each step's signer against its attestation's, `checkedSteps`), "Hardware checked" (Intel's TCB status in words, NVIDIA's GPU evidence only where it exists, the nonce, when), then "Check it yourself" (copy the Intel quote or the whole proof, TEE Explorer, NEAR AI's verifier). Raw quotes and signatures are only copied, never laid out; signer addresses keep the address font, hashes don't. `404 no_proof` (replies from before #256) says so plainly. Types and helpers in `runs/data/proof.ts`. - Redacted secrets render as `••••`; never try to unredact. - Use the event shapes in `docs/api-contract.md` (#7); do not invent fields. - Visual Builder (#20): save the React Flow `{ nodes, edges }` in the canvas format of `docs/api-contract.md` §2 "Visual Builder workflows" (node types `trigger`, `agent`, `tool`, `http`, `condition`; condition edges use `sourceHandle: "then" | "else"`). Show the engine's `issues` on a 400. Light nodes up from `node.started` / `node.finished` (`node` = your canvas node id). diff --git a/apps/fe/src/lib/queryKeys.ts b/apps/fe/src/lib/queryKeys.ts index a58bd717..1dea6ba1 100644 --- a/apps/fe/src/lib/queryKeys.ts +++ b/apps/fe/src/lib/queryKeys.ts @@ -21,6 +21,7 @@ export const mindKeys = { export const chatKeys = { thread: (mindId: string, threadId: string) => ["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/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..a28771ca --- /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 }) { + 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.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 ( +
+

{title}

+ {children} +
+ ) +} + +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 7c345c0c..7e26ad93 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,65 +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." - : "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 it, and HelloNear checked each signature against the hardware's own proof from NVIDIA and Intel. -

-
-
- {proof?.model && ( -
-
Model
-
{modelName(proof.model)}
-
+ <> + + + } + > + + {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." + : "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 it, and HelloNear checked each signature against the hardware's own report: Intel's, + and NVIDIA's too where the model itself runs in the TEE. +

+
+
+ {proof?.model && ( +
+
Model
+
{modelName(proof.model)}
+
+ )} + {steps.length > 0 && ( +
+
Steps checked
+
+ {steps.length} + steps.join("\n")} label="Copy step ids" /> +
+
+ )} +
+ {runId && ( + )} - {steps.length > 0 && ( -
-
Steps checked
-
- {steps.length} - steps.join("\n")} label="Copy step ids" /> -
-
- )} -
- -
-
+ + + + {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..e431735a --- /dev/null +++ b/apps/fe/src/modules/runs/data/proof.ts @@ -0,0 +1,56 @@ +// 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 } + +export type RunProofs = { runId: string; proofs: { seq: number; model: string; level: string; 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") + }) +}) From 0fca916dd8f7b013a7189ba5bb8618047d5ad7f9 Mon Sep 17 00:00:00 2001 From: ancung Date: Wed, 11 Nov 2026 15:53:14 +0700 Subject: [PATCH 2/4] fix(fe): bottom drawers no longer clip a title's first letter Ancung, 11 Nov: on a phone, "The proof behind this reply" showed as "'he proof"; "Connect Telegram" lost the edge of its "C" too. A drawer's content sits in an inner element that clips (overflow-hidden), and its side padding was on the outer popup, so the clip edge was exactly where text began and a letter that leans left past its box was cut. The side padding now lives inside that element (`ResponsiveDialog`, "Add a block"). Tests: typecheck, lint, vitest 269/269. Checked in Chrome at 375 px: the Telegram drawer's title is whole. Co-Authored-By: Claude Opus 5.5 --- apps/fe/CLAUDE.md | 2 +- apps/fe/src/components/elements/ResponsiveDialog.tsx | 8 +++++--- apps/fe/src/modules/builder/components/AddBlockSheet.tsx | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/fe/CLAUDE.md b/apps/fe/CLAUDE.md index e7ac1798..5d3cb6d1 100644 --- a/apps/fe/CLAUDE.md +++ b/apps/fe/CLAUDE.md @@ -12,7 +12,7 @@ Web app (Next.js App Router + NEAR Connect). Owner: Ancung. Design comes from Na - Data and state: `@tanstack/react-query` 5.106.1 for all server data (cache, polling, refresh after approve or freeze). **No global state library.** The current Mind's id lives in the URL (`/minds/[mindId]/…`), every screen reads the Mind through the same React Query hook (one fetch, shared cache), and the last used Mind is kept in `localStorage`. One React context holds the chat run in progress so the chat, the live view and the Approvals badge read the same events. Add `zustand` only if that context gets heavy. - Streams: chat, approve/decline and builder runs are POST + SSE, so `EventSource` can't be used; read the `fetch` body with `eventsource-parser` 4.1.3. - Forms: `react-hook-form` 7.91.0 + `zod` 4.6.7 + `@hookform/resolvers` 7.0.3 (validate as you type, as in the design). -- Bottom drawers on phones (`ResponsiveDialog`, "Add a block", a Builder block's settings, the live view) share one roomy spacing (Ancung, 11 Nov, after Welcome). `DrawerContent`'s classes go on the outer popup while its children sit in an inner element with no gap, so the spacing between parts lives on a wrapper inside it (`ResponsiveDialog`) or as margins ("Add a block"); a header there is left-aligned (the drawer centres it by default), except Welcome (`centered`). The sizes: 20 px sides, 20 px between parts, 8 px between a title and its text, 12 px between stacked buttons, and at least 24 px at the bottom (more with a home indicator). +- Bottom drawers on phones (`ResponsiveDialog`, "Add a block", a Builder block's settings, the live view) share one roomy spacing (Ancung, 11 Nov, after Welcome). `DrawerContent`'s classes go on the outer popup while its children sit in an inner element with no gap, so the spacing between parts lives on a wrapper inside it (`ResponsiveDialog`) or as margins ("Add a block"); the side padding lives inside too, since that inner element clips, and padding on the outer popup cut the left edge of a title's first letter (Ancung, 11 Nov); a header there is left-aligned (the drawer centres it by default), except Welcome (`centered`). The sizes: 20 px sides, 20 px between parts, 8 px between a title and its text, 12 px between stacked buttons, and at least 24 px at the bottom (more with a home indicator). - Toasts: `sonner` 2.0.8 (shadcn's). Theme: `next-themes` 0.4.6 (System, Light, Dark from the account menu). Mind replies: `react-markdown` 10.1.0 with `remark-gfm` 4.0.1 (tables, strikethrough, task lists, bare links; added 9 Nov when a reply's table showed as pipes). Wide tables scroll sideways inside the reply. Springs (Penny is ready, freeze, Builder drag): `motion` 14.10.0; everything else is CSS. Thinking indicators (Thinking... and every running step row, by kind of work: `orb` in `TOOLS` (`runs/data/tools.ts`, every tool's words in one list), read by `stepOrb`, reading searching, websites connecting, writing composing, acting working, time and sums solving, memory breathing, waiting for the owner listening): `thinking-orbs` 0.3.2 (MIT, no runtime dependencies; Axel's pick, 10 Nov): ``, a dotted canvas orb that follows the `dark` class, freezes with reduced motion and pauses off screen by itself. Only the free states and the 20 and 64 sizes (libraries.dev marks some as Pro). - Tests: `vitest` 5.1.0 (unit, `tests/*.test.ts`, config `vitest.config.mts`) with a 15 s test timeout (a few tests that import inside themselves timed out at 5 s on Windows beside the dev server), `@playwright/test` 1.65.0 (flows). - Motion: easing tokens are in `src/styles/globals.css` (`ease-out`, `ease-in-out`, `ease-drawer` utilities; Tailwind only emits them once used). Rules, durations and chat streaming: `design/CLAUDE.md` "Motion (v0.3)". shadcn components keep their own animation classes; set menus and popovers to grow from `--transform-origin` (Base UI provides it) and make exits faster than entries. diff --git a/apps/fe/src/components/elements/ResponsiveDialog.tsx b/apps/fe/src/components/elements/ResponsiveDialog.tsx index abb7e395..e1c4def7 100644 --- a/apps/fe/src/components/elements/ResponsiveDialog.tsx +++ b/apps/fe/src/components/elements/ResponsiveDialog.tsx @@ -59,11 +59,13 @@ export function ResponsiveDialog({ return ( {/* Roomy on phones (Ancung, 11 Nov: the drawers felt cramped), the same spacing as Welcome. */} - + {/* The spacing lives on this wrapper: DrawerContent's own classes go on the outer popup, and its children sit in an inner element with no gap, so a header touched what came - after it (Telegram's steps, found in the phone check, 11 Nov). */} -
+ 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} !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) From f644729b030aa3a304611e2806f23e923580de6d Mon Sep 17 00:00:00 2001 From: ancung Date: Wed, 11 Nov 2026 16:00:31 +0700 Subject: [PATCH 3/4] fix(fe): the badge popover's actions sit in one row Ancung, 11 Nov: View proof, "How it's verified" and "Check it yourself" stacked as a button and two links read as clutter. One row now: View proof at the left, "How it's verified" at the right, no divider. "Check it yourself" is in the proof dialog already (the verifier and TEE Explorer), so the popover shows it only for a reply without a run id. Tests: typecheck, lint, vitest 269/269. Checked in Chrome: one row, nothing overlapping. Co-Authored-By: Claude Opus 5.5 --- apps/fe/CLAUDE.md | 2 +- .../modules/runs/components/VerifiedBadge.tsx | 40 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/apps/fe/CLAUDE.md b/apps/fe/CLAUDE.md index 5d3cb6d1..e64c5bc2 100644 --- a/apps/fe/CLAUDE.md +++ b/apps/fe/CLAUDE.md @@ -210,7 +210,7 @@ Imports: `@/*` → `src/*`, `@app/*` → `app/*`. Keep route files in `app/` thi - **System messages are formal and plain** (Ancung, 10 Nov: toasts and errors sounded too chatty). Toasts get a short standard title ("Key saved", "Funds added", "Could not send your answer") with any detail in the description line. Errors say what failed and what to do: "Could not load the payments. Please try again later.", "No changes were made.", "Check your connection and try again."; no "Couldn't", "Try again in a moment", "Nothing changed; try again" or "Something went wrong on the way". Empty states are plain ("No transactions yet", "No pending approvals"). Product copy from the design (headlines, skill cards, chat intros) keeps its voice. No "·" separators anywhere on screen. - Never hold or send the backend's API keys or grant tokens in the browser; the FE only talks to `apps/be`. - Wording: say "policy stored on-chain, enforced in a TEE". A rejected transfer shows `policy_denied` and the rule, never a tx link. -- Verification badge follows `docs/api-contract.md` §4: `gateway_tee` (a normal chat run) shows "Verified via NEAR AI TEE gateway", `model_tee` shows "Verified private (model TEE)", anything else no badge. The badge opens a popover (`runs/components/VerifiedBadge.tsx`, Ancung, 11 Nov, like near.ai/models' "Private TEE" note): what was checked in plain words, the model, how many steps with their completion ids to copy (`RunView.proof`, from `run.verified`'s `model` and `completionIds`), and links to docs.near.ai/cloud/verification and the open-source verifier. "View proof" in it opens `ProofDialog` (#254): `GET /runs/{runId}/proof` (#257), the last entry being the reply's, read when opened; in plain words first: "Signed inside the TEE" (each step's signer against its attestation's, `checkedSteps`), "Hardware checked" (Intel's TCB status in words, NVIDIA's GPU evidence only where it exists, the nonce, when), then "Check it yourself" (copy the Intel quote or the whole proof, TEE Explorer, NEAR AI's verifier). Raw quotes and signatures are only copied, never laid out; signer addresses keep the address font, hashes don't. `404 no_proof` (replies from before #256) says so plainly. Types and helpers in `runs/data/proof.ts`. +- Verification badge follows `docs/api-contract.md` §4: `gateway_tee` (a normal chat run) shows "Verified via NEAR AI TEE gateway", `model_tee` shows "Verified private (model TEE)", anything else no badge. The badge opens a popover (`runs/components/VerifiedBadge.tsx`, Ancung, 11 Nov, like near.ai/models' "Private TEE" note): what was checked in plain words, the model, how many steps with their completion ids to copy (`RunView.proof`, from `run.verified`'s `model` and `completionIds`), and links to docs.near.ai/cloud/verification and the open-source verifier. Its actions are one row (Ancung, 11 Nov: a button and two links stacked read as clutter): View proof and "How it's verified"; "Check it yourself" moved into the dialog, and shows in the popover only for a reply without a run id. "View proof" opens `ProofDialog` (#254): `GET /runs/{runId}/proof` (#257), the last entry being the reply's, read when opened; in plain words first: "Signed inside the TEE" (each step's signer against its attestation's, `checkedSteps`), "Hardware checked" (Intel's TCB status in words, NVIDIA's GPU evidence only where it exists, the nonce, when), then "Check it yourself" (copy the Intel quote or the whole proof, TEE Explorer, NEAR AI's verifier). Raw quotes and signatures are only copied, never laid out; signer addresses keep the address font, hashes don't. `404 no_proof` (replies from before #256) says so plainly. Types and helpers in `runs/data/proof.ts`. - Redacted secrets render as `••••`; never try to unredact. - Use the event shapes in `docs/api-contract.md` (#7); do not invent fields. - Visual Builder (#20): save the React Flow `{ nodes, edges }` in the canvas format of `docs/api-contract.md` §2 "Visual Builder workflows" (node types `trigger`, `agent`, `tool`, `http`, `condition`; condition edges use `sourceHandle: "then" | "else"`). Show the engine's `issues` on a 400. Light nodes up from `node.started` / `node.finished` (`node` = your canvas node id). diff --git a/apps/fe/src/modules/runs/components/VerifiedBadge.tsx b/apps/fe/src/modules/runs/components/VerifiedBadge.tsx index 7e26ad93..e9e5bdb1 100644 --- a/apps/fe/src/modules/runs/components/VerifiedBadge.tsx +++ b/apps/fe/src/modules/runs/components/VerifiedBadge.tsx @@ -79,29 +79,31 @@ export function VerifiedBadge({
)} - {runId && ( - - )} -
+ {/* 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 && ( + + )} How it's verified - - Check it yourself - - + {!runId && ( + + Check it yourself + + + )}
From e81d614870c6ce103692e6057a2f211230e05d4c Mon Sep 17 00:00:00 2001 From: ancung Date: Wed, 11 Nov 2026 19:38:03 +0700 Subject: [PATCH 4/4] fix(fe): a proof's model and level may be null, as the backend sends them James on #259: the backend's `runProofs` sends `model: null` and `level: null` when a stored `run.verified` lacks them. Every real one carries both, but the type now says so, and the dialog leaves out the model line when there is none instead of calling `split` on null. Tests: typecheck, lint, vitest 269/269. Co-Authored-By: Claude Opus 5.5 --- apps/fe/src/modules/runs/components/ProofDialog.tsx | 4 ++-- apps/fe/src/modules/runs/data/proof.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/fe/src/modules/runs/components/ProofDialog.tsx b/apps/fe/src/modules/runs/components/ProofDialog.tsx index a28771ca..93e87e79 100644 --- a/apps/fe/src/modules/runs/components/ProofDialog.tsx +++ b/apps/fe/src/modules/runs/components/ProofDialog.tsx @@ -64,7 +64,7 @@ export function ProofDialog({ runId, open, onOpenChange }: { runId: string; open ) } -function ProofBody({ proof, model }: { proof: Proof; model: string }) { +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) @@ -91,7 +91,7 @@ function ProofBody({ proof, model }: { proof: Proof; model: string }) { ))}

- Only hashes of the messages were signed, never the conversation. Model: {model.split("/").pop()}. + Only hashes of the messages were signed, never the conversation.{model ? ` Model: ${model.split("/").pop()}.` : ""}

diff --git a/apps/fe/src/modules/runs/data/proof.ts b/apps/fe/src/modules/runs/data/proof.ts index e431735a..88ae7a8f 100644 --- a/apps/fe/src/modules/runs/data/proof.ts +++ b/apps/fe/src/modules/runs/data/proof.ts @@ -30,7 +30,8 @@ export type AttestationProof = { export type Proof = { checkedAt: string; steps: StepProof[]; attestations: Record } -export type RunProofs = { runId: string; proofs: { seq: number; model: string; level: string; proof: Proof }[] } +/** `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"