Hyperkit
The toolkit for building Hyperapps — one JSX source serves humans as HTML and agents as Markdown.
1. Purpose
Hyperkit is the toolkit for building a Hyperapp in code. You author each page once as Hono JSX; Hyperkit renders it as the HTML a human sees and, by content negotiation, the Markdown an agent reads — with the exact structure and hyperapp:* metadata the spec requires. One source, both representations, no drift.
It is portable: Hyperkit depends only on Hono and an HTML→Markdown converter, not on any AGX infrastructure. Identity (Hyperauth) and storage (Hyperfile) are separate, optional concerns a Hyperapp adds on top.
2. Entry points
@agx-computer/hyperkit ships three entry points:
| Import | What it gives you |
|---|---|
@agx-computer/hyperkit/ui | JSX components that render the spec's HTML structure and hyperapp:* metadata. |
@agx-computer/hyperkit/hyperblocks | The human-facing Hyperblocks (Hyperapp §12): the Embedded View and the Hyperform. |
@agx-computer/hyperkit/markdown | A Hono middleware that serves the agent-facing Markdown view by content negotiation. |
3. One source, both representations
The components render conformant HTML; the middleware produces the conformant Markdown — so a single JSX page is both the human page and the agent contract, and the two cannot drift.
import { Hono } from "hono"
import { Hyperapp, Page, Directory, Action, Field } from "@agx-computer/hyperkit/ui"
import { hyperappMarkdown } from "@agx-computer/hyperkit/markdown"
const App = ({ children }) => (
<Hyperapp name="Slides" origin="https://slides.example.com">{children}</Hyperapp>
)
const app = new Hono()
app.use("*", hyperappMarkdown()) // HTML for browsers, Markdown for `Accept: text/markdown`
// The root MUST be a Directory Page (spec §5.1): links only, no inline Actions.
app.get("/", (c) =>
c.html(
<App>
<Directory title="Slides" description="Create slide decks." pages={[{ href: "/create", label: "Create" }]} />
</App>,
),
)
app.get("/create", (c) =>
c.html(
<App>
<Page title="Create" description="Create a slide deck from markdown.">
<h2>Actions</h2>
<Action name="Create a deck" target="/create" submit="Create deck">
<Field name="markdown" type="textarea" label="markdown" required />
</Action>
</Page>
</App>,
),
)4. /ui components
| Component | Renders |
|---|---|
<Hyperapp name origin lang?> | Context provider; wrap a page's root (renders no markup of its own). |
<Page title description?> | A capability / app page (hyperapp:type=app). |
<Directory title description? pages> | The root Directory Page (§5.1): links only. |
<ResponsePage action status title summary?> | A Response Page (§10): sets action + status. |
<Action name target method? submit?> | An Action (§7): a <form>; method="dialog" drives a Hyperform (§12.2). |
<Field name type? label? required? value? rows? options?> | A form field. |
<Resources> · <Results> · <Errors> | Outputs / errors blocks (§10–11). |
<EmbeddedView title head?> | An embed Hyperblock (§12.1). |
5. /markdown — the agent view
hyperappMarkdown() negotiates on Accept and converts the rendered HTML to the spec's Markdown, preserving the structures a generic HTML→Markdown converter would drop:
| HTML | Markdown |
|---|---|
<head> title + <meta> | YAML frontmatter (§4 / §13) |
<form> | an ## Action: block with method/target + an Inputs table (§13) |
<dl> | a - **label**: value Results list (§11) |
<ul> of input errors | an Errors table keyed by input (§10.5) |
6. Where it sits
Hyperkit implements the app-facet specification — that is the normative contract; Hyperkit is one (portable) way to satisfy it. The AGX-platform build mechanics (wiring auth, Embedded View URLs, the Hyperform host contract) live in the AGX Authoring Conventions. See hyperapps/apps/slides for a full worker.