8bitcn components are being rebased on UI SDK. Every rebased component joins UI SDK's agent bridge: an agent reads the page's components, their state and the actions they take, then changes them through the component's own API instead of clicking pixels. A party member that knows every button by name.
Install the default UI SDK version (@8bitcn/dialog) for the bridge. The Radix UI versions (@8bitcn/radix/dialog) don't join it.
Three lines. Add a client component that creates the bridge once:
Then render <AgentBridge /> once in your root layout, next to {children}. The bridge finds the components already on the page and every one that mounts later, so you can also create it later, when your assistant opens.
Check it in the browser console:
agent.snapshot() finds components by their accessible name, so give every control a <Label> or an aria-label. Changes made by an agent reach your callbacks with details.source === "agent", where you can cancel them.
agentTools describes snapshot, query and act as JSON Schema for any model SDK. For the agent built into a browser, register them through WebMCP:
allow: (step) => !step.confirm lets the browser's agent run every step except the ones on a control you marked with data-agent-confirm. Those wait for a person. Read the full guide in the UI SDK docs, or in node_modules/@ui-sdk/react/docs/agents.md for the version you installed.
Every 8bitcn item with behaviors declares what a player can do with it: open the dialog, choose Dark, refuse an unknown theme. Each behavior is a list of UI SDK act() steps plus the results that prove it worked. The same file drives three things:
Each component and block page lists its behaviors in a Behaviors section, with inputs and expected results.
/r/behaviors.json: the index. Every item, its docs page, and each behavior's inputs, expected results and flags./r/behaviors/<item>.json: one item with its act() steps, such as /r/behaviors/badge.json./r/behaviors.schema.json: JSON Schema for both.An item file looks like this:
preview: The docs preview the behaviors run in. Pass it to behaviors.run().docs: The docs page with that live preview.inputs: Typed inputs (string, number, boolean) with a default. A step or expectation value of exactly "{{name}}" is replaced by the input.steps: UI SDK act() steps, { ref, action, args }, sent one at a time. Behaviors run in order and share state.expect: What must be true after the steps: a state subset of the snapshot entry, absent, a refused step error, a reported change, or a dom render check. Checked for up to 1.5 s.expected: expect in plain English.needsPerson: The control carries data-agent-confirm. An agent must ask a person; runners skip it.ciOnly: A keyboard and ARIA pattern check that only runs in CI.previewTitle: Which preview to use when a page has several with the same name.Take the item's docs URL from the index. Every behavior runs against the live preview there.
It plays the behaviors through the real Test player and returns { passed, failed, skipped, results }, with a one-line message per behavior. window.__8bitcn.behaviors.list() shows the previews on the page.
Send each step to the page's bridge, one at a time, and compare expect with the snapshot:
In a browser that supports WebMCP, every docs page registers six tools for its own agent:
list_behaviors: The previews on this page with behaviors, and each behavior's inputs, expected results and flags.get_behaviors: One item's behaviors with their act() steps.run_behavior: Plays a preview's behaviors and returns pass, fail or skipped per behavior.snapshot, query, act: UI SDK's own bridge tools. Steps on a data-agent-confirm control are refused.Behaviors live in the repo, in behaviors/<item>.behaviors.ts, and never ship into your project. See behaviors/README.md for the format.