React Adapter
@vhyxseal/react is a thin adapter on top of @vhyxseal/core. It provides six headless UI components, three hooks, a context provider, and a higher-order component for wrapping existing components. All business logic lives in core — this package is pure React plumbing.
What the Adapter Provides
- SealProvider — context provider that collects contracts and generates the manifest
- withAgentContract() — HOC to add a contract to any existing component without modifying it
- useContract(id) — reads a registered contract by component id
- useCapability() — reads the full capability map with counts
- useAgentAction() — tracks agent action lifecycle (standalone, no provider needed)
- Button, Input, Form, Nav, Display, Confirmation — headless components with contract registration built in
Installation
React ≥ 18 required. Works with React 19. Fully compatible with Next.js App Router (including Server Components) and Pages Router.
Full Setup
Place SealProvider at the root of your component tree. Every VhyxSeal component in the subtree automatically registers its contract.
SealProvider Configuration
The SealProvider config maps directly to ManifestConfig from @vhyxseal/core.
| Prop | Type | Description |
|---|---|---|
| config | ManifestConfig | Required. domain, domainVerified, verificationToken, and optional policy/cache |
| dev | boolean | Optional. Enable verbose logging. Defaults to NODE_ENV !== production |
| onManifestGenerated | (manifest) => void | Optional. Called each time a new manifest is generated |
| children | ReactNode | Required. The component tree that can register contracts |
withAgentContract HOC
Wraps any existing component without modifying it. The contract is a completely separate concern — existing component code is untouched.
Hooks Reference
Available Components
TypeScript Types
Common Patterns
Checkout flow with confirmation gate
Search form with dependency relationship
Known Limitations
- Server Components cannot use hooks — use
withAgentContractor component-levelcontractprop for RSC-compatible components - SealProvider uses React Context — wrap it in a Client Component boundary in App Router
- useAgentAction is standalone and does not require SealProvider
- All six components (Button, Input, Form, Nav, Display, Confirmation) gracefully degrade outside SealProvider — they render without contract registration and do not throw