feat(ui): consume the design tokens and publish the tool surface - #8
Merged
Merged
Conversation
Carries the WebMCP registration fix too, which cannot be split out: the async plumbing and the new badge both land in app/tool-surface.tsx. WebMCP registration Per the W3C spec (webmachinelearning/webmcp, index.bs:605) registerTool returns Promise<undefined> and reports every failure by rejecting: SecurityError when the document is not origin-keyed, NotAllowedError when the tools policy forbids it, plus rejection for a duplicate name, an empty description or an invalid schema. The synchronous try/catch around it caught none of those, so all sixteen names were recorded as registered regardless and the banner could report "WebMCP live, 16 tools" over a page with nothing agent-callable — the exact failure next.config.mjs warns about, in the one place that could not detect it. Registration is now awaited and a name recorded only once its promise resolves. ToolSurface guards React 19's double mount so the aborted first pass cannot overwrite the second pass's real result. types/webmcp.d.ts widened to the spec: getTools(), the second options argument on execute, title, and annotations. Ten tools now carry annotations - readOnlyHint where a tool only reads, untrustedContentHint where its result carries text or DOM taken from the recording, which is content we do not control. Design tokens tailwind.config.ts defined a palette with a rationale per choice and zero consumers; 22 files used raw zinc-* and amber-* instead, which is why the UI read as generic grey rather than deliberate near-black. Migrated call site by call site rather than swept, since zinc-800 was a fill in some places and a border in others. human and agent stay authorship-only, so a control either party drives gets ink plus a non-colour affordance instead of a tint. Hierarchy and icons New SectionHeading with three ranks. The headings were text-muted, dimmer than their own body copy; they now outrank it. Icons normalised to size 12 and strokeWidth 1.5, one glyph per severity, and omitted wherever a glyph would only be decoration. WebMCP panel New WebMcpBadge, docked bottom-right above the timeline, following the pattern OpenAI's own WebMCP showcases use: a one-line definition, an access statement, a grid of tool cards, and "Try asking" prompts a judge can paste into ChatGPT's in-app browser. The list comes from document.modelContext.getTools() and re-reads on toolchange, so it reflects the host rather than our own array. Degraded states render as a div rather than a button, so amber and red cannot be dismissed. npx tsc --noEmit clean; 23 files, 289 tests passing.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes that could not be separated: the WebMCP registration fix and the UI work both land in
app/tool-surface.tsx.The bug this fixes
Per the W3C spec (
webmachinelearning/webmcp,index.bs:605)registerToolreturnsPromise<undefined>and reports every failure by rejecting, not throwing:SecurityError— document is not origin-keyedNotAllowedError— thetoolspermission policy forbids itThe synchronous
try/catcharound it caught none of those. All sixteen names were recorded as registered regardless, and the banner could report "WebMCP live · 16 tools" over a page with nothing agent-callable — the exact failurenext.config.mjswarns about, in the one place that could not detect it.Registration is now awaited, and a name is recorded only once its promise resolves.
ToolSurfaceguards React 19's double mount so the aborted first pass cannot overwrite the second pass's real result.types/webmcp.d.tsis widened to the spec:getTools(), the secondoptionsargument onexecute,title, andannotations. Ten tools carry annotations —readOnlyHintwhere a tool only reads,untrustedContentHintwhere its result carries text or DOM taken from the recording, which is content we do not control.Design tokens
tailwind.config.tsdefined a palette with a rationale per choice and zero consumers; 22 files used rawzinc-*/amber-*instead, which is why the UI read as generic grey rather than deliberate near-black. Migrated call site by call site rather than swept, sincezinc-800was a fill in some places and a border in others.humanandagentstay authorship-only, so a control either party drives getsinkplus a non-colour affordance instead of a tint.Hierarchy and icons
New
SectionHeadingwith three ranks. The headings weretext-muted, dimmer than their own body copy; they now outrank it. Icons normalised tosize={12},strokeWidth={1.5}, one glyph per severity, and omitted wherever a glyph would only be decoration.WebMCP panel
New
WebMcpBadge, docked bottom-right above the timeline, following the pattern OpenAI's own WebMCP showcases use: a one-line definition, an access statement, a grid of tool cards, and "Try asking" prompts a judge can paste into ChatGPT's in-app browser.The list comes from
document.modelContext.getTools()and re-reads ontoolchange, so it reflects the host rather than our own array. Degraded states render as adivrather than abutton, so amber and red cannot be dismissed.Verification
No assertion weakened, no test skipped.
Test plan
traces.ribdsp.comin ChatGPT Desktop's in-app browser and confirm 16 toolsKnown, not fixed here
npm run lintis unusable:next lintis deprecated in Next 15.5 and there is no ESLint config. Pre-existing; the fix lives inpackage.json.