From a0d14090ef2941507e5d0ff789af7d166d69fbf5 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Thu, 19 Nov 2026 17:36:22 +1100 Subject: [PATCH] feat: add astryx design reference prototype - scaffold a React/Vite reference app under ui/astryx-reference with shell, composer, runs, and area pages - wire @astryxdesign packages, a neutral-derived theme, and reference dev/build scripts - document the astryx workflow in ui/AGENTS.md --- ui/AGENTS.md | 32 + ui/astryx-reference/AreaPage.tsx | 82 ++ ui/astryx-reference/DockedComposer.tsx | 258 ++++ ui/astryx-reference/ShellFrame.tsx | 235 ++++ ui/astryx-reference/index.html | 12 + ui/astryx-reference/main.tsx | 152 +++ .../pages/ConversationPage.tsx | 499 ++++++++ ui/astryx-reference/pages/LandingPage.tsx | 89 ++ ui/astryx-reference/pages/RunsPage.tsx | 873 ++++++++++++++ ui/astryx-reference/theme.ts | 39 + ui/astryx-reference/tsconfig.json | 14 + ui/astryx-reference/vite.config.ts | 12 + ui/package.json | 12 + ui/pnpm-lock.yaml | 1057 ++++++++++++++++- ui/pnpm-workspace.yaml | 2 + ui/src/astryx-themes.ts | 15 + 16 files changed, 3382 insertions(+), 1 deletion(-) create mode 100644 ui/astryx-reference/AreaPage.tsx create mode 100644 ui/astryx-reference/DockedComposer.tsx create mode 100644 ui/astryx-reference/ShellFrame.tsx create mode 100644 ui/astryx-reference/index.html create mode 100644 ui/astryx-reference/main.tsx create mode 100644 ui/astryx-reference/pages/ConversationPage.tsx create mode 100644 ui/astryx-reference/pages/LandingPage.tsx create mode 100644 ui/astryx-reference/pages/RunsPage.tsx create mode 100644 ui/astryx-reference/theme.ts create mode 100644 ui/astryx-reference/tsconfig.json create mode 100644 ui/astryx-reference/vite.config.ts create mode 100644 ui/src/astryx-themes.ts diff --git a/ui/AGENTS.md b/ui/AGENTS.md index 79d7d44bb..43e6418e6 100644 --- a/ui/AGENTS.md +++ b/ui/AGENTS.md @@ -145,3 +145,35 @@ pnpm audit # after dependency changes - Delegate to pi workers when asked, and verify their output. Check for overlap before merging, rerun their checks on the combined result, and fix what they find. + + +Astryx v0.7.16 · 174 components +CLI: run every command as `pnpm exec astryx ` (shown below as `astryx ...`). + +SETUP (once, in app entry e.g. main.tsx) — without these, components render unstyled: + import "@astryxdesign/core/reset.css"; + import "@astryxdesign/core/astryx.css"; + +WORKFLOW — start every page from a template, never from scratch: +1. `astryx build ""` — names the template to scaffold from and the parts it lacks. +2. `astryx template ` — scaffold it; keep its frame, gap and padding; replace the content. +3. `astryx template ` for parts it lacks; `astryx component ` to read props before using one. +Changing an existing page? Keep it: skip step 2 and add blocks/components inside its sections. +Before you deliver a build, run `astryx doctor --built `; don't deliver it if it fails. + +RULES: +- No
— components handle all layout and spacing. +- Read `astryx docs layout` before changing a template's frame. +- Dense data = rows (Table, List/Item), not Card-wrapped lists. Badge = counts only. +- Style with component props first, then Tailwind utilities backed by tokens. No raw hex/px. +- THEMES: palettes and custom colors go through the theme, never :root overrides. To make or change a theme (colors, fonts, corners, spacing, a look from a picture), prefer the experimental theme editor over hand-written theme files: `astryx experimental theme editor new --like neutral`, then `editor set ` or `editor how ""`; wire it with `astryx theme add `; after each change look at it with `astryx experimental theme editor show --png` and open the PNGs it writes (changes nothing in the app); a theme change is not done until you have looked at the pictures. In code, extend an imported theme to customize it; `theme eject ` only forks source. See `astryx docs theme`. +- SELF-CHECK: re-read the file; replace any style={{…}}, raw
/, imported .css/@apply, or hardcoded/arbitrary value (bg-[#fff], p-[13px]) with the component or a token-backed utility. + +`astryx help` lists every command. Key ones beyond the workflow: + search "" find any component / hook / doc / template + discover integrations you could add + docs getting-started, principles, tokens, theme … (`astryx docs` lists all) + docs cli commands and API reference + docs authoring build an integration package, and every field it holds + upgrade --from --apply run after a dependency bump + diff --git a/ui/astryx-reference/AreaPage.tsx b/ui/astryx-reference/AreaPage.tsx new file mode 100644 index 000000000..6837a148f --- /dev/null +++ b/ui/astryx-reference/AreaPage.tsx @@ -0,0 +1,82 @@ +import { Badge } from "@astryxdesign/core/Badge"; +import { Button } from "@astryxdesign/core/Button"; +import { Heading } from "@astryxdesign/core/Heading"; +import { Layout, LayoutContent, LayoutHeader } from "@astryxdesign/core/Layout"; +import { Section } from "@astryxdesign/core/Section"; +import { HStack, VStack } from "@astryxdesign/core/Stack"; +import { Text } from "@astryxdesign/core/Text"; +import type { Area } from "./ShellFrame"; + +type AreaPageProps = { + area: Exclude; + onOpenRun: () => void; +}; + +const copy = { + Events: { + heading: "What Archie heard", + subheading: "Incoming evidence and the work it started.", + title: "Checkout timeout rate exceeded 5%", + eyebrow: "Monitoring · 09:38 UTC", + body: "Checkout timeouts rose after the latest release. Archie authenticated the event, bound it to the production checkout target, and started an investigation run.", + action: "Open investigation", + seam: "Hears → Understands → Decides", + }, + Governance: { + heading: "Governance", + subheading: "Policies, autonomy levels and action limits.", + title: "Production rollback requires approval", + eyebrow: "Production · Checkout · Rollback", + body: "The current autonomy level permits read-only investigation. The rollback is reversible, but it changes production. Hard rules and the Timing guard therefore require an operator decision.", + action: "Review decision", + seam: "Governs · Assesses · Manages risk · Invokes policy", + }, + Reports: { + heading: "What Archie delivered", + subheading: "Outcomes, evidence and the remaining work.", + title: "Checkout investigation delivered", + eyebrow: "Operations · Waiting on approval", + body: "The investigation and evidence are in Operations. No production change has been made. The underlying release defect remains to be confirmed.", + action: "Open decision trail", + seam: "Does → Delivers", + }, +} as const; + +export function AreaPage({ area, onOpenRun }: AreaPageProps) { + const content = copy[area]; + + return ( + + + {content.heading} + {content.subheading} + + + } + content={ + +
+ + + + + {content.eyebrow} + + + {content.title} + {content.body} + +
+
+ } + /> + ); +} diff --git a/ui/astryx-reference/DockedComposer.tsx b/ui/astryx-reference/DockedComposer.tsx new file mode 100644 index 000000000..339c1b30a --- /dev/null +++ b/ui/astryx-reference/DockedComposer.tsx @@ -0,0 +1,258 @@ +import { useLocalStorage, useWindowSize } from "@uidotdev/usehooks"; +import { Avatar } from "@astryxdesign/core/Avatar"; +import { BottomSheet } from "@astryxdesign/core/BottomSheet"; +import { Button } from "@astryxdesign/core/Button"; +import { + ChatComposer, + ChatLayout, + ChatMessage, + ChatMessageBubble, + ChatMessageList, +} from "@astryxdesign/core/Chat"; +import { Heading } from "@astryxdesign/core/Heading"; +import { useMediaQuery } from "@astryxdesign/core/hooks"; +import { Icon } from "@astryxdesign/core/Icon"; +import { IconButton } from "@astryxdesign/core/IconButton"; +import { Popover } from "@astryxdesign/core/Popover"; +import { HStack, StackItem, VStack } from "@astryxdesign/core/Stack"; +import { Text } from "@astryxdesign/core/Text"; +import { Toolbar } from "@astryxdesign/core/Toolbar"; +import mark from "../../assets/brand/archie-mark.svg?url"; + +export type DockedMessage = { + id: string; + sender: "user" | "assistant"; + text: string; +}; + +type DockedComposerProps = { + context: string; + messages: DockedMessage[]; + draft: string; + onDraftChange: (value: string) => void; + onSubmit: (value: string) => void; + onOpenConversation: () => void; +}; + +const suggestedPrompts = [ + "Why does this need approval?", + "What is the risk?", + "What happens if I decline?", +] as const; + +export function DockedComposer({ + context, + messages, + draft, + onDraftChange, + onSubmit, + onOpenConversation, +}: DockedComposerProps) { + const isNarrow = useMediaQuery("(max-width: 48rem)"); + const [isConversationOpen, setIsConversationOpen] = useLocalStorage( + "archie.astryx-reference.chat-open", + messages.length > 0, + ); + const { height: viewportHeight } = useWindowSize(); + const conversationHeight = Math.max( + 280, + Math.min(560, (viewportHeight ?? 656) - 96), + ); + + function submit(value: string) { + setIsConversationOpen(true); + onSubmit(value); + } + + const composer = ( + + ); + + const conversation = ( + + + + + Archie + + {context} + + + + } + endContent={ + +