austere-axi 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -101
- package/dist/austere.js +126 -126
- package/dist/catalog.json +1 -1
- package/dist/chrome/chrome.js +5 -5
- package/dist/cli.mjs +837 -462
- package/dist/pack-kit.mjs +23 -23
- package/dist/packs/mermaid/catalog.json +3 -3
- package/dist/packs/mermaid/pack.js +4 -4
- package/dist/packs/shadcn/catalog.json +3 -3
- package/dist/packs/shadcn/pack.js +5 -5
- package/dist/prompt.md +1 -1
- package/package.json +17 -14
- package/skills/austere/SKILL.md +2 -0
- package/types/pack-kit.d.ts +4 -3
- package/types/pack.d.ts +27 -8
package/dist/catalog.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"format":1,"pack":"core","version":"0.5.2","groups":[{"name":"Layout","notes":["- A page is root = Stack([...sections], \"column\", \"l\"). Each section is a Card([CardHeader(title, subtitle), ...content]).","- Side by side: Stack([a, b], \"row\", \"m\", \"stretch\", \"start\", true). Cards in a row share the width.","- Tabs for alternative views, Accordion for detail the reader may skip, Steps for ordered procedures. Several blocks in one Card: label each with InlineHeader.","- Card children must match its list; anything else (Accordion, Tag, a Callout row) can sit in a Stack inside the Card, or directly in root's Stack."]},{"name":"Content","notes":["- MarkDownRenderer for prose, bullet lists and inline code; one statement per paragraph group so each is annotatable.","- Callout for the one thing the reader must not miss: a risk, a decision needed, a caveat.","- CodeBlock for a whole snippet. Image src may be a path relative to the artifact file.","- Architecture for systems: services, stores, queues, trust boundaries. Name every Node, Edge and Group. Over ~15 nodes, use lanes or split the diagram.","- lanes: for systems split by owner, repo or tier. Groups are the columns, left to right as listed; put every node in one, in reading order (plain groups for a heading without a frame). About 4 columns fit a laptop; wider ones scroll (check warns). Phones get the lanes stacked as bands. Pin row only to put boxes side by side or line them up.","- Diff for code changes: show the hunks that matter, not whole files. Hunk counts are recomputed, so only start lines matter.","- Mermaid for sequences, state machines, ER, gantt and quick flowcharts."]},{"name":"Data","notes":["- Table is COLUMN-oriented: Table([Col(\"Option\", names), Col(\"Effort\", efforts), Col(\"Risk\", risks)]). Col data may mix strings and components, e.g. [\"n/a\", Tag(\"high\", null, \"sm\", \"danger\")]. Cells are plain text (no markdown) and wrap; Col type \"number\" for figures.","- EntityList for key/value facts; OverviewCardBlock + OverviewCardItem + MetricIndicatorInline for a KPI row.","- EditableTable when the reviewer should correct or fill in values; edits arrive with the next @ToAssistant from its Form.","- Icon names are lucide kebab-case (circle-check, triangle-alert, git-branch)."]},{"name":"Charts","notes":["- Charts take column arrays: BarChart(labels, [Series(\"p50\", [..]), Series(\"p99\", [..])], \"grouped\", \"Week\", \"ms\").","- PieChart(labels, values) with plain number arrays."]},{"name":"Forms","notes":["- Form(name, buttons, fields). Define each FormControl as its own statement. Never nest a Form in a Form.","- To ask the reviewer to decide: OptionCards or RadioGroup inside a Form whose button is Button(\"Send decision\", @ToAssistant(\"Decision: rollout strategy\"), \"primary\"). The values arrive with that message as form: {<formName>: {<fieldName>: value}}; no context needed. Reviewers can always annotate and message, so add a notes field only when it belongs with the decision.","- OptionCards(\"pick\", \"single\", [OptionCard(\"a\", \"Option A\", \"why\", Icon(\"zap\")), OptionCard(\"b\", \"Option B\")], {required: true}, \"a\") — the last argument pre-selects.","- rules: {required: true, minLength: 10, ...}; the renderer shows the messages."]},{"name":"Buttons","notes":["- @ToAssistant(message, context?) queues a message to the agent; @OpenUrl(url) opens a link. A Button with no action sends its label.","- Use buttons for follow-ups the reviewer can pick in one click: \"Go with option B\", \"Split this into two PRs\"."]}],"components":[{"name":"Card","group":"Layout","signature":"Card(children: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Tabs | Stack | Architecture | Diff | FileTree | Mermaid | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[], variant?: \"card\" | \"sunk\" | \"clear\", direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Styled container. variant: \"card\" (default, elevated) | \"sunk\" (recessed) | \"clear\" (transparent). Always full width. Accepts all Stack flex params (default: direction \"column\"). Cards flex to share space in row/wrap layouts.","tier":"core","pack":"core","examples":[]},{"name":"CardHeader","group":"Layout","signature":"CardHeader(title?: string, subtitle?: string)","description":"Header with optional title and subtitle","tier":"core","pack":"core","examples":[]},{"name":"TextContent","group":"Content","signature":"TextContent(text: string, size?: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\")","description":"Text block. Supports markdown. Optional size: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\".","tier":"core","pack":"core","examples":[]},{"name":"MarkDownRenderer","group":"Content","signature":"MarkDownRenderer(textMarkdown: string, variant?: \"clear\" | \"card\" | \"sunk\")","description":"Renders markdown text with optional container variant","tier":"core","pack":"core","examples":[]},{"name":"Callout","group":"Content","signature":"Callout(variant: \"info\" | \"warning\" | \"error\" | \"success\" | \"neutral\", title: string, description: string, visible?: $binding<boolean>)","description":"Callout banner. Optional visible is a reactive $boolean — auto-dismisses after 3s by setting $visible to false.","tier":"core","pack":"core","examples":[]},{"name":"Image","group":"Content","signature":"Image(alt: string, src?: string)","description":"Image with alt text and optional URL","tier":"core","pack":"core","examples":[]},{"name":"CodeBlock","group":"Content","signature":"CodeBlock(language: string, codeString: string)","description":"Syntax-highlighted code block","tier":"core","pack":"core","examples":[]},{"name":"InlineHeader","group":"Layout","signature":"InlineHeader(heading: string, description?: string)","description":"Compact section heading with an optional one-line description, for use inside cards.","tier":"core","pack":"core","examples":[]},{"name":"Table","group":"Data","signature":"Table(columns: Col[])","description":"Data table — column-oriented. Each Col holds its own data array.","tier":"core","pack":"core","examples":[]},{"name":"Col","group":"Data","signature":"Col(label: string, data: any, type?: \"string\" | \"number\" | \"action\")","description":"Column definition — holds label + data array","tier":"core","pack":"core","examples":[]},{"name":"EditableTable","group":"Data","signature":"EditableTable(name?: string, columns?: {type: \"text\" | \"number\" | \"date-single\" | \"select\" | \"url\", key?: string, header?: string, width?: number, options?: {value: string, label: string}[]}[], data?: {id: string, values: (string | number)[]}[])","description":"Spreadsheet-like table whose cells the user can edit inline (text, number, url, date, select columns); edits are saved back as a form field","tier":"extended","pack":"core","examples":[]},{"name":"BarChart","group":"Charts","signature":"BarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string, height?: number)","description":"Vertical bars; use for comparing values across categories with one or more series","tier":"core","pack":"core","examples":[]},{"name":"LineChart","group":"Charts","signature":"LineChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Lines over categories; use for trends and continuous data over time","tier":"core","pack":"core","examples":[]},{"name":"AreaChart","group":"Charts","signature":"AreaChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Filled area under lines; use for cumulative totals or volume trends over time","tier":"extended","pack":"core","examples":[]},{"name":"HorizontalBarChart","group":"Charts","signature":"HorizontalBarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string)","description":"Horizontal bars; prefer when category labels are long or for ranked lists","tier":"extended","pack":"core","examples":[]},{"name":"Series","group":"Charts","signature":"Series(category: string, values: number[])","description":"One data series","tier":"core","pack":"core","examples":[]},{"name":"PieChart","group":"Charts","signature":"PieChart(labels: string[], values: number[], variant?: \"pie\" | \"donut\", appearance?: \"circular\" | \"semiCircular\")","description":"Circular slices; use plucked arrays: PieChart(data.categories, data.values)","tier":"core","pack":"core","examples":[]},{"name":"ScatterChart","group":"Charts","signature":"ScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string)","description":"X/Y scatter plot; use for correlations, distributions, and clustering","tier":"extended","pack":"core","examples":[]},{"name":"ScatterSeries","group":"Charts","signature":"ScatterSeries(name: string, points: Point[])","description":"Named dataset","tier":"extended","pack":"core","examples":[]},{"name":"Point","group":"Charts","signature":"Point(x: number, y: number, z?: number)","description":"Data point with numeric coordinates","tier":"extended","pack":"core","examples":[]},{"name":"Form","group":"Forms","signature":"Form(name: string, buttons: Buttons, fields?: FormControl[])","description":"Form container with fields and explicit action buttons","tier":"core","pack":"core","examples":[]},{"name":"FormControl","group":"Forms","signature":"FormControl(label: string, input: Input | TextArea | Select | Slider | CheckBoxGroup | RadioGroup | Chips | OptionCards, hint?: string)","description":"Field with label, input component, and optional hint text","tier":"core","pack":"core","examples":[]},{"name":"Label","group":"Forms","signature":"Label(text: string)","description":"Text label","tier":"extended","pack":"core","examples":[]},{"name":"Input","group":"Forms","signature":"Input(name: string, placeholder?: string, type?: \"text\" | \"email\" | \"password\" | \"number\" | \"url\", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"TextArea","group":"Forms","signature":"TextArea(name: string, placeholder?: string, rows?: number, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"Select","group":"Forms","signature":"Select(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>, size?: \"small\" | \"medium\" | \"large\")","description":"","tier":"core","pack":"core","examples":[]},{"name":"SelectItem","group":"Forms","signature":"SelectItem(value: string, label: string)","description":"Option for Select","tier":"core","pack":"core","examples":[]},{"name":"Slider","group":"Forms","signature":"Slider(name: string, variant: \"continuous\" | \"discrete\", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<number[]>)","description":"Numeric slider input; supports continuous and discrete (stepped) variants","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxGroup","group":"Forms","signature":"CheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<Record<string, boolean>>)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxItem","group":"Forms","signature":"CheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"RadioGroup","group":"Forms","signature":"RadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"RadioItem","group":"Forms","signature":"RadioItem(label: string, description: string, value: string)","description":"","tier":"core","pack":"core","examples":[]},{"name":"SwitchGroup","group":"Forms","signature":"SwitchGroup(name: string, items: SwitchItem[], variant?: \"clear\" | \"card\" | \"sunk\", value?: $binding<Record<string, boolean>>)","description":"Group of switch toggles","tier":"extended","pack":"core","examples":[]},{"name":"SwitchItem","group":"Forms","signature":"SwitchItem(label?: string, description?: string, name: string, defaultChecked?: boolean)","description":"Individual switch toggle","tier":"extended","pack":"core","examples":[]},{"name":"ChipItem","group":"Forms","signature":"ChipItem(value: string, label: string, icon?: Icon, disabled?: boolean)","description":"A single selectable chip inside a Chips group, with a value, label and optional icon.","tier":"extended","pack":"core","examples":[]},{"name":"Chips","group":"Forms","signature":"Chips(name: string, type?: \"single\" | \"multiple\", items?: ChipItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of compact selectable chips for choosing one or many short options; the selection is stored under `name`.","tier":"extended","pack":"core","examples":[]},{"name":"OptionCard","group":"Forms","signature":"OptionCard(value: string, title: string, subtitle?: string, topContent?: Icon | Image, disabled?: boolean)","description":"A single selectable card inside an OptionCards group, with a value, title, optional subtitle and an optional Icon or Image on top.","tier":"core","pack":"core","examples":[]},{"name":"OptionCards","group":"Forms","signature":"OptionCards(name: string, type?: \"single\" | \"multiple\", items?: OptionCard[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of selectable cards (title, optional subtitle, optional icon or image) laid out in a responsive grid for choosing one or many options; the selection is stored under `name`.","tier":"core","pack":"core","examples":[]},{"name":"Button","group":"Buttons","signature":"Button(label: string, action?: ActionExpression, variant?: \"primary\" | \"secondary\" | \"tertiary\", type?: \"normal\" | \"destructive\", size?: \"extra-small\" | \"small\" | \"medium\" | \"large\")","description":"Clickable button","tier":"core","pack":"core","examples":[]},{"name":"Buttons","group":"Buttons","signature":"Buttons(buttons: Button[], direction?: \"row\" | \"column\")","description":"Group of Button components. direction: \"row\" (default) | \"column\".","tier":"core","pack":"core","examples":[]},{"name":"Stack","group":"Layout","signature":"Stack(children: any[], direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Flex container. direction: \"row\"|\"column\" (default \"column\"). gap: \"none\"|\"xs\"|\"s\"|\"m\"|\"l\"|\"xl\"|\"2xl\" (default \"m\"). align: \"start\"|\"center\"|\"end\"|\"stretch\"|\"baseline\". justify: \"start\"|\"center\"|\"end\"|\"between\"|\"around\"|\"evenly\".","tier":"core","pack":"core","examples":[]},{"name":"Tabs","group":"Layout","signature":"Tabs(items: TabItem[])","description":"Tabbed container","tier":"core","pack":"core","examples":[]},{"name":"TabItem","group":"Layout","signature":"TabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Mermaid | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is tab label, content is array of components","tier":"core","pack":"core","examples":[]},{"name":"Accordion","group":"Layout","signature":"Accordion(items: AccordionItem[])","description":"Collapsible sections","tier":"core","pack":"core","examples":[]},{"name":"AccordionItem","group":"Layout","signature":"AccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Mermaid | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is section title","tier":"core","pack":"core","examples":[]},{"name":"Steps","group":"Layout","signature":"Steps(items: StepsItem[])","description":"Step-by-step guide","tier":"core","pack":"core","examples":[]},{"name":"StepsItem","group":"Layout","signature":"StepsItem(title: string, details: string)","description":"title and details text for one step","tier":"core","pack":"core","examples":[]},{"name":"Separator","group":"Layout","signature":"Separator(orientation?: \"horizontal\" | \"vertical\", decorative?: boolean)","description":"Visual divider between content sections","tier":"core","pack":"core","examples":[]},{"name":"TagBlock","group":"Data","signature":"TagBlock(tags: string[], size?: \"sm\" | \"md\" | \"lg\")","description":"tags is an array of strings; optional size sm | md | lg","tier":"extended","pack":"core","examples":[]},{"name":"Tag","group":"Data","signature":"Tag(text: string, icon?: Icon, size?: \"sm\" | \"md\" | \"lg\", variant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\")","description":"Styled tag/badge with optional Icon and variant","tier":"core","pack":"core","examples":[]},{"name":"Icon","group":"Data","signature":"Icon(name: string, category?: string)","description":"A lucide icon by kebab-case name (e.g. 'circle-check'). Optional category picks a topical fallback when the name doesn't resolve.","tier":"core","pack":"core","examples":[]},{"name":"EntityList","group":"Data","signature":"EntityList(rows?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}[], size?: \"small\" | \"default\", header?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}, footer?: {left: string, right: string, rightVariant?: \"text\" | \"number\"})","description":"Two-column key/value rows (left label, right value). size 'default' supports optional header and footer rows; rightVariant 'number' uses tabular numbers.","tier":"core","pack":"core","examples":[]},{"name":"Text","group":"Data","signature":"Text(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Plain text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"core","pack":"core","examples":[]},{"name":"BoldText","group":"Data","signature":"BoldText(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Emphasized (bold) text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"extended","pack":"core","examples":[]},{"name":"IconText","group":"Data","signature":"IconText(icon: Icon, iconVariant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"inverted\" | \"filled\" | \"soft\", iconSize?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"sm\" | \"md\" | \"lg\", title: string, subtitle?: string, bold?: boolean, layout?: \"horizontal\" | \"vertical\")","description":"An icon badge with a title and optional subtitle, laid out horizontally or vertically. iconVariant sets the badge color.","tier":"extended","pack":"core","examples":[]},{"name":"MetricIndicatorInline","group":"Data","signature":"MetricIndicatorInline(value: string, subtext?: string, trend?: {direction: \"up\" | \"down\", value: number})","description":"Headline metric value with an optional +/- percentage trend and subtext, all on one line.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardItem","group":"Data","signature":"OverviewCardItem(id?: string, top: IconText | Text, bottom?: MetricIndicatorInline)","description":"One overview card: a heading slot at the top (IconText, ImageText or Text) and an optional MetricIndicatorInline at the bottom.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardBlock","group":"Data","signature":"OverviewCardBlock(items: OverviewCardItem[], layout?: \"grid\" | \"carousel\", responsive?: boolean, action?: ActionExpression, gap?: number | string)","description":"A grid or horizontal carousel of compact overview cards, each with a heading (icon/image/text) on top and an inline metric below; optionally clickable with a shared action.","tier":"core","pack":"core","examples":[]},{"name":"Architecture","group":"Content","signature":"Architecture(nodes: Node[], edges: Edge[], groups?: Group[], direction?: \"auto\" | \"right\" | \"down\" | \"lanes\")","description":"System diagram laid out automatically: write no coordinates. Every Node, Edge and Group is its own statement and click target. direction auto (default) runs right when that fits the page legibly, else down; lanes makes each top-level Group a column.","tier":"core","pack":"core","examples":["platformMap = Architecture([browser, edge, api, sessions, cache], [toEdge, toApi, readSessions, readCache], [vpc])\nbrowser = Node(\"Browser\", \"external\")\nedge = Node(\"Edge worker\", \"cloud\", \"Cloudflare\")\napi = Node(\"API\", \"backend\", \"Node :8080\")\nsessions = Node(\"Sessions\", \"database\", \"Postgres\", \"new\")\ncache = Node(\"Redis\", \"database\", \"read-through\")\ntoEdge = Edge(browser, edge, \"HTTPS\", \"emphasis\")\ntoApi = Edge(edge, api)\nreadSessions = Edge(api, sessions, \"SQL\")\nreadCache = Edge(api, cache, \"cache\", \"dashed\")\nvpc = Group(\"Platform VPC\", [api, sessions, cache])","ownership = Architecture([web, ordersApi, ledger, ordersDb, billingJob], [placeOrder, writeOrder, readOrders, postLedger], [clients, ordersRepo, billingRepo], \"lanes\")\nweb = Node(\"Web app\", \"frontend\")\nordersApi = Node(\"Orders API\", \"backend\", \"Node :8080\")\nordersDb = Node(\"orders table\", \"database\", \"Postgres\", null, \"success\")\nbillingJob = Node(\"Nightly billing\", \"backend\", \"cron 02:00\")\nledger = Node(\"Ledger\", \"database\", \"append-only\", null, \"info\")\nplaceOrder = Edge(web, ordersApi, \"POST /orders\")\nwriteOrder = Edge(ordersApi, ordersDb, \"insert\")\nreadOrders = Edge(billingJob, ordersDb, \"read unbilled\", null, \"danger\")\npostLedger = Edge(billingJob, ledger, \"post\")\nclients = Group(\"CLIENTS\", [web], \"plain\")\nordersRepo = Group(\"orders-service\", [ordersApi, ordersDb])\nbillingRepo = Group(\"billing\", [billingJob, ledger])"]},{"name":"Node","group":"Content","signature":"Node(label: string, kind?: \"frontend\" | \"backend\" | \"database\" | \"messagebus\" | \"cloud\" | \"security\" | \"external\", detail?: string, tag?: string, tone?: \"info\" | \"success\" | \"warning\" | \"danger\" | \"strong\", row?: number)","description":"A box in an Architecture. kind sets icon and color (default backend); detail is monospace, up to 2 lines (\\n breaks); tag is a small chip such as \"new\"; tone tints it (danger = risk, strong = where it ends); row pins it to a row (1, 2, ...) in lanes.","tier":"core","pack":"core","examples":[]},{"name":"Edge","group":"Content","signature":"Edge(from: Node, to: Node, label?: string, style?: \"solid\" | \"dashed\" | \"emphasis\" | \"security\", tone?: \"info\" | \"success\" | \"warning\" | \"danger\")","description":"An arrow between two Node statements (pass their names, not strings). style: dashed for async, emphasis for the main path, security for auth or trust flows. tone colors it, e.g. danger for a risky write, success for a read.","tier":"core","pack":"core","examples":[]},{"name":"Group","group":"Content","signature":"Group(label: string, members: Node[], kind?: \"region\" | \"security\" | \"plain\")","description":"A boundary around Node statements (a VPC, a cluster, a trust zone); members still sit where their edges put them. A group whose members are a subset of another's is drawn inside it; kind security draws it red, plain draws only its name.","tier":"core","pack":"core","examples":[]},{"name":"Diff","group":"Content","signature":"Diff(patch: string, title?: string)","description":"Unified diff (git diff output, one or more files) with line numbers. patch is a raw multi-line string. Clicked lines reach the agent as file:+line.","tier":"core","pack":"core","examples":["retryPatch = Diff(\"diff --git a/src/retry.ts b/src/retry.ts\n--- a/src/retry.ts\n+++ b/src/retry.ts\n@@ -10,2 +10,3 @@\n- for (let i = 0; i < 3; i++) {\n+ for (let i = 0; i < MAX_ATTEMPTS; i++) {\n+ if (i > 0) await sleep(backoff(i));\")"]},{"name":"FileTree","group":"Data","signature":"FileTree(entries: string[])","description":"File tree, one path per entry, optionally prefixed with a git status code (A new, M modified, D deleted, R old -> new) and suffixed with \" # note\". Folders are inferred. Clicked files and folders reach the agent by path.","tier":"core","pack":"core","examples":["changedFiles = FileTree([\"M src/session/store.ts # read-through to Postgres\", \"A src/session/pg-store.ts\", \"A migrations/0042_sessions.sql # table + expiry index\", \"R src/session/redis.ts -> src/session/redis-cache.ts\", \"D src/session/legacy.ts\", \"M src/config.ts # SESSIONS_PG flag\"])"]},{"name":"Mermaid","group":"Content","signature":"Mermaid(source: string, caption?: string)","description":"Diagram from Mermaid source (flowchart, sequence, state, class, ER, gantt). source is a raw multi-line string. Keep node labels to a few words; clicked nodes reach the agent by label.","tier":"core","pack":"@austere-axi/pack-mermaid","examples":["requestPath = Mermaid(\"flowchart LR\n client[Client] --> api[API]\n api --> pg[(Postgres)]\", \"Request path\")"]},{"name":"Progress","group":"Data","signature":"Progress(value: number, label?: string, max?: number)","description":"Progress bar. value counts toward max (default 100); label names what is progressing. Shows a percentage.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["migration = Progress(64, \"Rows migrated\")"]},{"name":"Avatar","group":"Data","signature":"Avatar(name: string, src?: string, size?: \"md\" | \"lg\")","description":"Round avatar for a person. Shows the initials of name; src is an optional https image URL.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["owner = Avatar(\"Ada Lovelace\")"]},{"name":"AvatarGroup","group":"Data","signature":"AvatarGroup(avatars: Avatar[], max?: number)","description":"Overlapping Avatars, for reviewers or owners. max (default 4) shows the rest as +N.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["team = AvatarGroup([ada, grace, linus], 2)\nada = Avatar(\"Ada Lovelace\")\ngrace = Avatar(\"Grace Hopper\")\nlinus = Avatar(\"Linus Torvalds\")"]},{"name":"Tooltip","group":"Content","signature":"Tooltip(text: string, tip: string)","description":"Inline text with a short hint on hover or focus (a term and its definition). Keep tip to one line.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["term = Tooltip(\"idempotent\", \"Safe to run twice with the same result.\")"]},{"name":"HoverCard","group":"Content","signature":"HoverCard(text: string, title: string, body?: string)","description":"Inline text that shows a small card (title and a line or two of body) on hover or focus, e.g. a person or a service.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["svc = HoverCard(\"billing-api\", \"billing-api\", \"Owns invoices and refunds. On call: payments team.\")"]},{"name":"Breadcrumb","group":"Content","signature":"Breadcrumb(items: BreadcrumbItem[])","description":"Path trail such as Repo / Package / File, from BreadcrumbItems. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["trail = Breadcrumb([repo, pkg, file])\nrepo = BreadcrumbItem(\"austere-axi\")\npkg = BreadcrumbItem(\"packs\")\nfile = BreadcrumbItem(\"shadcn\")"]},{"name":"BreadcrumbItem","group":"Content","signature":"BreadcrumbItem(label: string, href?: string)","description":"One step of a Breadcrumb. href is optional; the last item is the current page.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]},{"name":"Kbd","group":"Content","signature":"Kbd(keys: string)","description":"Keyboard shortcut. keys joins keys with \"+\", e.g. \"Ctrl+K\"; each key is drawn as a key cap.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["shortcut = Kbd(\"Ctrl+Shift+P\")"]},{"name":"Skeleton","group":"Content","signature":"Skeleton(lines?: number, shape?: \"lines\" | \"avatar\")","description":"Grey placeholder block for content not yet written or loaded (default 3 lines). shape avatar adds a round head.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["pending = Skeleton(3, \"avatar\")"]},{"name":"Calendar","group":"Data","signature":"Calendar(month: string, highlights?: string[])","description":"Read-only month grid (not a date picker). month is \"YYYY-MM\"; highlights lists \"YYYY-MM-DD\" or \"YYYY-MM-DD label\" entries to mark, e.g. a freeze or a release. Marked days are click targets.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["window = Calendar(\"2026-11\", [\"2026-11-04 Code freeze\", \"2026-11-12 Release\", \"2026-11-13\"])"]},{"name":"Timeline","group":"Content","signature":"Timeline(items: TimelineItem[])","description":"Vertical history or schedule of TimelineItems, oldest first. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["history = Timeline([found, fixed, rollout])\nfound = TimelineItem(\"Bug found\", \"Oct 28\", \"Retries double-charge on timeout.\")\nfixed = TimelineItem(\"Fix merged\", \"Oct 29\", \"Idempotency key added.\", \"current\")\nrollout = TimelineItem(\"Rollout\", \"Nov 3\", \"\", \"upcoming\")"]},{"name":"TimelineItem","group":"Content","signature":"TimelineItem(title: string, date?: string, detail?: string, state?: \"done\" | \"current\" | \"upcoming\")","description":"One event in a Timeline. state: done (default), current or upcoming.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]}]}
|
|
1
|
+
{"format":1,"pack":"core","version":"0.7.0","groups":[{"name":"Layout","notes":["- A page is root = Stack([...sections], \"column\", \"l\"). Each section is a Card([CardHeader(title, subtitle), ...content]).","- Side by side: Stack([a, b], \"row\", \"m\", \"stretch\", \"start\", true). Cards in a row share the width.","- Tabs for alternative views, Accordion for detail the reader may skip, Steps for ordered procedures. Several blocks in one Card: label each with InlineHeader.","- Card children must match its list; anything else (Accordion, Tag, a Callout row) can sit in a Stack inside the Card, or directly in root's Stack."]},{"name":"Content","notes":["- MarkDownRenderer for prose, bullet lists and inline code; one statement per paragraph group so each is annotatable.","- Callout for the one thing the reader must not miss: a risk, a decision needed, a caveat.","- CodeBlock for a whole snippet. Image src may be a path relative to the artifact file.","- Architecture for systems: services, stores, queues, trust boundaries. Name every Node, Edge and Group. Over ~15 nodes, use lanes or split the diagram.","- lanes: for systems split by owner, repo or tier. Groups are the columns, left to right as listed; put every node in one, in reading order (plain groups for a heading without a frame). About 4 columns fit a laptop; wider ones scroll (check warns). Phones get the lanes stacked as bands. Pin row only to put boxes side by side or line them up.","- Diff for code changes: show the hunks that matter, not whole files. Hunk counts are recomputed, so only start lines matter.","- Mermaid for sequences, state machines, ER, gantt and quick flowcharts."]},{"name":"Data","notes":["- Table is COLUMN-oriented: Table([Col(\"Option\", names), Col(\"Effort\", efforts), Col(\"Risk\", risks)]). Col data may mix strings and components, e.g. [\"n/a\", Tag(\"high\", null, \"sm\", \"danger\")]. Cells are plain text (no markdown) and wrap; Col type \"number\" for figures.","- EntityList for key/value facts; OverviewCardBlock + OverviewCardItem + MetricIndicatorInline for a KPI row.","- EditableTable when the reviewer should correct or fill in values; edits arrive with the next @ToAssistant from its Form.","- Icon names are lucide kebab-case (circle-check, triangle-alert, git-branch)."]},{"name":"Charts","notes":["- Charts take column arrays: BarChart(labels, [Series(\"p50\", [..]), Series(\"p99\", [..])], \"grouped\", \"Week\", \"ms\").","- PieChart(labels, values) with plain number arrays."]},{"name":"Forms","notes":["- Form(name, buttons, fields). Define each FormControl as its own statement. Never nest a Form in a Form.","- To ask the reviewer to decide: OptionCards or RadioGroup inside a Form whose button is Button(\"Send decision\", @ToAssistant(\"Decision: rollout strategy\"), \"primary\"). The values arrive with that message as form: {<formName>: {<fieldName>: value}}; no context needed. Reviewers can always annotate and message, so add a notes field only when it belongs with the decision.","- OptionCards(\"pick\", \"single\", [OptionCard(\"a\", \"Option A\", \"why\", Icon(\"zap\")), OptionCard(\"b\", \"Option B\")], {required: true}, \"a\") — the last argument pre-selects.","- rules: {required: true, minLength: 10, ...}; the renderer shows the messages."]},{"name":"Buttons","notes":["- @ToAssistant(message, context?) queues a message to the agent; @OpenUrl(url) opens a link. A Button with no action sends its label.","- Use buttons for follow-ups the reviewer can pick in one click: \"Go with option B\", \"Split this into two PRs\"."]}],"components":[{"name":"Card","group":"Layout","signature":"Card(children: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Tabs | Stack | Architecture | Diff | FileTree | Mermaid | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[], variant?: \"card\" | \"sunk\" | \"clear\", direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Styled container. variant: \"card\" (default, elevated) | \"sunk\" (recessed) | \"clear\" (transparent). Always full width. Accepts all Stack flex params (default: direction \"column\"). Cards flex to share space in row/wrap layouts.","tier":"core","pack":"core","examples":[]},{"name":"CardHeader","group":"Layout","signature":"CardHeader(title?: string, subtitle?: string)","description":"Header with optional title and subtitle","tier":"core","pack":"core","examples":[]},{"name":"TextContent","group":"Content","signature":"TextContent(text: string, size?: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\")","description":"Text block. Supports markdown. Optional size: \"small\" | \"default\" | \"large\" | \"small-heavy\" | \"large-heavy\".","tier":"core","pack":"core","examples":[]},{"name":"MarkDownRenderer","group":"Content","signature":"MarkDownRenderer(textMarkdown: string, variant?: \"clear\" | \"card\" | \"sunk\")","description":"Renders markdown text with optional container variant","tier":"core","pack":"core","examples":[]},{"name":"Callout","group":"Content","signature":"Callout(variant: \"info\" | \"warning\" | \"error\" | \"success\" | \"neutral\", title: string, description: string, visible?: $binding<boolean>)","description":"Callout banner. Optional visible is a reactive $boolean — auto-dismisses after 3s by setting $visible to false.","tier":"core","pack":"core","examples":[]},{"name":"Image","group":"Content","signature":"Image(alt: string, src?: string)","description":"Image with alt text and optional URL","tier":"core","pack":"core","examples":[]},{"name":"CodeBlock","group":"Content","signature":"CodeBlock(language: string, codeString: string)","description":"Syntax-highlighted code block","tier":"core","pack":"core","examples":[]},{"name":"InlineHeader","group":"Layout","signature":"InlineHeader(heading: string, description?: string)","description":"Compact section heading with an optional one-line description, for use inside cards.","tier":"core","pack":"core","examples":[]},{"name":"Table","group":"Data","signature":"Table(columns: Col[])","description":"Data table — column-oriented. Each Col holds its own data array.","tier":"core","pack":"core","examples":[]},{"name":"Col","group":"Data","signature":"Col(label: string, data: any, type?: \"string\" | \"number\" | \"action\")","description":"Column definition — holds label + data array","tier":"core","pack":"core","examples":[]},{"name":"EditableTable","group":"Data","signature":"EditableTable(name?: string, columns?: {type: \"text\" | \"number\" | \"date-single\" | \"select\" | \"url\", key?: string, header?: string, width?: number, options?: {value: string, label: string}[]}[], data?: {id: string, values: (string | number)[]}[])","description":"Spreadsheet-like table whose cells the user can edit inline (text, number, url, date, select columns); edits are saved back as a form field","tier":"extended","pack":"core","examples":[]},{"name":"BarChart","group":"Charts","signature":"BarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string, height?: number)","description":"Vertical bars; use for comparing values across categories with one or more series","tier":"core","pack":"core","examples":[]},{"name":"LineChart","group":"Charts","signature":"LineChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Lines over categories; use for trends and continuous data over time","tier":"core","pack":"core","examples":[]},{"name":"AreaChart","group":"Charts","signature":"AreaChart(labels: string[], series: Series[], variant?: \"linear\" | \"natural\" | \"step\", xLabel?: string, yLabel?: string, height?: number)","description":"Filled area under lines; use for cumulative totals or volume trends over time","tier":"extended","pack":"core","examples":[]},{"name":"HorizontalBarChart","group":"Charts","signature":"HorizontalBarChart(labels: string[], series: Series[], variant?: \"grouped\" | \"stacked\", xLabel?: string, yLabel?: string)","description":"Horizontal bars; prefer when category labels are long or for ranked lists","tier":"extended","pack":"core","examples":[]},{"name":"Series","group":"Charts","signature":"Series(category: string, values: number[])","description":"One data series","tier":"core","pack":"core","examples":[]},{"name":"PieChart","group":"Charts","signature":"PieChart(labels: string[], values: number[], variant?: \"pie\" | \"donut\", appearance?: \"circular\" | \"semiCircular\")","description":"Circular slices; use plucked arrays: PieChart(data.categories, data.values)","tier":"core","pack":"core","examples":[]},{"name":"ScatterChart","group":"Charts","signature":"ScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string)","description":"X/Y scatter plot; use for correlations, distributions, and clustering","tier":"extended","pack":"core","examples":[]},{"name":"ScatterSeries","group":"Charts","signature":"ScatterSeries(name: string, points: Point[])","description":"Named dataset","tier":"extended","pack":"core","examples":[]},{"name":"Point","group":"Charts","signature":"Point(x: number, y: number, z?: number)","description":"Data point with numeric coordinates","tier":"extended","pack":"core","examples":[]},{"name":"Form","group":"Forms","signature":"Form(name: string, buttons: Buttons, fields?: FormControl[])","description":"Form container with fields and explicit action buttons","tier":"core","pack":"core","examples":[]},{"name":"FormControl","group":"Forms","signature":"FormControl(label: string, input: Input | TextArea | Select | Slider | CheckBoxGroup | RadioGroup | Chips | OptionCards, hint?: string)","description":"Field with label, input component, and optional hint text","tier":"core","pack":"core","examples":[]},{"name":"Label","group":"Forms","signature":"Label(text: string)","description":"Text label","tier":"extended","pack":"core","examples":[]},{"name":"Input","group":"Forms","signature":"Input(name: string, placeholder?: string, type?: \"text\" | \"email\" | \"password\" | \"number\" | \"url\", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"TextArea","group":"Forms","signature":"TextArea(name: string, placeholder?: string, rows?: number, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"Select","group":"Forms","signature":"Select(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>, size?: \"small\" | \"medium\" | \"large\")","description":"","tier":"core","pack":"core","examples":[]},{"name":"SelectItem","group":"Forms","signature":"SelectItem(value: string, label: string)","description":"Option for Select","tier":"core","pack":"core","examples":[]},{"name":"Slider","group":"Forms","signature":"Slider(name: string, variant: \"continuous\" | \"discrete\", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<number[]>)","description":"Numeric slider input; supports continuous and discrete (stepped) variants","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxGroup","group":"Forms","signature":"CheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<Record<string, boolean>>)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"CheckBoxItem","group":"Forms","signature":"CheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)","description":"","tier":"extended","pack":"core","examples":[]},{"name":"RadioGroup","group":"Forms","signature":"RadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)","description":"","tier":"core","pack":"core","examples":[]},{"name":"RadioItem","group":"Forms","signature":"RadioItem(label: string, description: string, value: string)","description":"","tier":"core","pack":"core","examples":[]},{"name":"SwitchGroup","group":"Forms","signature":"SwitchGroup(name: string, items: SwitchItem[], variant?: \"clear\" | \"card\" | \"sunk\", value?: $binding<Record<string, boolean>>)","description":"Group of switch toggles","tier":"extended","pack":"core","examples":[]},{"name":"SwitchItem","group":"Forms","signature":"SwitchItem(label?: string, description?: string, name: string, defaultChecked?: boolean)","description":"Individual switch toggle","tier":"extended","pack":"core","examples":[]},{"name":"ChipItem","group":"Forms","signature":"ChipItem(value: string, label: string, icon?: Icon, disabled?: boolean)","description":"A single selectable chip inside a Chips group, with a value, label and optional icon.","tier":"extended","pack":"core","examples":[]},{"name":"Chips","group":"Forms","signature":"Chips(name: string, type?: \"single\" | \"multiple\", items?: ChipItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of compact selectable chips for choosing one or many short options; the selection is stored under `name`.","tier":"extended","pack":"core","examples":[]},{"name":"OptionCard","group":"Forms","signature":"OptionCard(value: string, title: string, subtitle?: string, topContent?: Icon | Image, disabled?: boolean)","description":"A single selectable card inside an OptionCards group, with a value, title, optional subtitle and an optional Icon or Image on top.","tier":"core","pack":"core","examples":[]},{"name":"OptionCards","group":"Forms","signature":"OptionCards(name: string, type?: \"single\" | \"multiple\", items?: OptionCard[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, defaultValue?: string | string[])","description":"A form field of selectable cards (title, optional subtitle, optional icon or image) laid out in a responsive grid for choosing one or many options; the selection is stored under `name`.","tier":"core","pack":"core","examples":[]},{"name":"Button","group":"Buttons","signature":"Button(label: string, action?: ActionExpression, variant?: \"primary\" | \"secondary\" | \"tertiary\", type?: \"normal\" | \"destructive\", size?: \"extra-small\" | \"small\" | \"medium\" | \"large\")","description":"Clickable button","tier":"core","pack":"core","examples":[]},{"name":"Buttons","group":"Buttons","signature":"Buttons(buttons: Button[], direction?: \"row\" | \"column\")","description":"Group of Button components. direction: \"row\" (default) | \"column\".","tier":"core","pack":"core","examples":[]},{"name":"Stack","group":"Layout","signature":"Stack(children: any[], direction?: \"row\" | \"column\", gap?: \"none\" | \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"2xl\", align?: \"start\" | \"center\" | \"end\" | \"stretch\" | \"baseline\", justify?: \"start\" | \"center\" | \"end\" | \"between\" | \"around\" | \"evenly\", wrap?: boolean)","description":"Flex container. direction: \"row\"|\"column\" (default \"column\"). gap: \"none\"|\"xs\"|\"s\"|\"m\"|\"l\"|\"xl\"|\"2xl\" (default \"m\"). align: \"start\"|\"center\"|\"end\"|\"stretch\"|\"baseline\". justify: \"start\"|\"center\"|\"end\"|\"between\"|\"around\"|\"evenly\".","tier":"core","pack":"core","examples":[]},{"name":"Tabs","group":"Layout","signature":"Tabs(items: TabItem[])","description":"Tabbed container","tier":"core","pack":"core","examples":[]},{"name":"TabItem","group":"Layout","signature":"TabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Mermaid | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is tab label, content is array of components","tier":"core","pack":"core","examples":[]},{"name":"Accordion","group":"Layout","signature":"Accordion(items: AccordionItem[])","description":"Collapsible sections","tier":"core","pack":"core","examples":[]},{"name":"AccordionItem","group":"Layout","signature":"AccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | CodeBlock | Image | Separator | HorizontalBarChart | PieChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | InlineHeader | EntityList | EditableTable | OverviewCardBlock | Architecture | Diff | FileTree | Mermaid | Progress | Avatar | AvatarGroup | Tooltip | HoverCard | Breadcrumb | Kbd | Skeleton | Calendar | Timeline)[])","description":"value is unique id, trigger is section title","tier":"core","pack":"core","examples":[]},{"name":"Steps","group":"Layout","signature":"Steps(items: StepsItem[])","description":"Step-by-step guide","tier":"core","pack":"core","examples":[]},{"name":"StepsItem","group":"Layout","signature":"StepsItem(title: string, details: string)","description":"title and details text for one step","tier":"core","pack":"core","examples":[]},{"name":"Separator","group":"Layout","signature":"Separator(orientation?: \"horizontal\" | \"vertical\", decorative?: boolean)","description":"Visual divider between content sections","tier":"core","pack":"core","examples":[]},{"name":"TagBlock","group":"Data","signature":"TagBlock(tags: string[], size?: \"sm\" | \"md\" | \"lg\")","description":"tags is an array of strings; optional size sm | md | lg","tier":"extended","pack":"core","examples":[]},{"name":"Tag","group":"Data","signature":"Tag(text: string, icon?: Icon, size?: \"sm\" | \"md\" | \"lg\", variant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\")","description":"Styled tag/badge with optional Icon and variant","tier":"core","pack":"core","examples":[]},{"name":"Icon","group":"Data","signature":"Icon(name: string, category?: string)","description":"A lucide icon by kebab-case name (e.g. 'circle-check'). Optional category picks a topical fallback when the name doesn't resolve.","tier":"core","pack":"core","examples":[]},{"name":"EntityList","group":"Data","signature":"EntityList(rows?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}[], size?: \"small\" | \"default\", header?: {left: string, right: string, rightVariant?: \"text\" | \"number\"}, footer?: {left: string, right: string, rightVariant?: \"text\" | \"number\"})","description":"Two-column key/value rows (left label, right value). size 'default' supports optional header and footer rows; rightVariant 'number' uses tabular numbers.","tier":"core","pack":"core","examples":[]},{"name":"Text","group":"Data","signature":"Text(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Plain text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"core","pack":"core","examples":[]},{"name":"BoldText","group":"Data","signature":"BoldText(variant?: \"text\" | \"number\", value: string, subtext?: string, subtextVariant?: \"text\" | \"number\" | \"metric\", size?: \"xs\" | \"sm\" | \"md\" | \"lg\")","description":"Emphasized (bold) text line with optional subtext. variant 'number' uses tabular number styling; subtextVariant 'metric' colors a leading +/- subtext green/red.","tier":"extended","pack":"core","examples":[]},{"name":"IconText","group":"Data","signature":"IconText(icon: Icon, iconVariant?: \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"inverted\" | \"filled\" | \"soft\", iconSize?: \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\" | \"sm\" | \"md\" | \"lg\", title: string, subtitle?: string, bold?: boolean, layout?: \"horizontal\" | \"vertical\")","description":"An icon badge with a title and optional subtitle, laid out horizontally or vertically. iconVariant sets the badge color.","tier":"extended","pack":"core","examples":[]},{"name":"MetricIndicatorInline","group":"Data","signature":"MetricIndicatorInline(value: string, subtext?: string, trend?: {direction: \"up\" | \"down\", value: number})","description":"Headline metric value with an optional +/- percentage trend and subtext, all on one line.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardItem","group":"Data","signature":"OverviewCardItem(id?: string, top: IconText | Text, bottom?: MetricIndicatorInline)","description":"One overview card: a heading slot at the top (IconText, ImageText or Text) and an optional MetricIndicatorInline at the bottom.","tier":"core","pack":"core","examples":[]},{"name":"OverviewCardBlock","group":"Data","signature":"OverviewCardBlock(items: OverviewCardItem[], layout?: \"grid\" | \"carousel\", responsive?: boolean, action?: ActionExpression, gap?: number | string)","description":"A grid or horizontal carousel of compact overview cards, each with a heading (icon/image/text) on top and an inline metric below; optionally clickable with a shared action.","tier":"core","pack":"core","examples":[]},{"name":"Architecture","group":"Content","signature":"Architecture(nodes: Node[], edges: Edge[], groups?: Group[], direction?: \"auto\" | \"right\" | \"down\" | \"lanes\")","description":"System diagram laid out automatically: write no coordinates. Every Node, Edge and Group is its own statement and click target. direction auto (default) runs right when that fits the page legibly, else down; lanes makes each top-level Group a column.","tier":"core","pack":"core","examples":["platformMap = Architecture([browser, edge, api, sessions, cache], [toEdge, toApi, readSessions, readCache], [vpc])\nbrowser = Node(\"Browser\", \"external\")\nedge = Node(\"Edge worker\", \"cloud\", \"Cloudflare\")\napi = Node(\"API\", \"backend\", \"Node :8080\")\nsessions = Node(\"Sessions\", \"database\", \"Postgres\", \"new\")\ncache = Node(\"Redis\", \"database\", \"read-through\")\ntoEdge = Edge(browser, edge, \"HTTPS\", \"emphasis\")\ntoApi = Edge(edge, api)\nreadSessions = Edge(api, sessions, \"SQL\")\nreadCache = Edge(api, cache, \"cache\", \"dashed\")\nvpc = Group(\"Platform VPC\", [api, sessions, cache])","ownership = Architecture([web, ordersApi, ledger, ordersDb, billingJob], [placeOrder, writeOrder, readOrders, postLedger], [clients, ordersRepo, billingRepo], \"lanes\")\nweb = Node(\"Web app\", \"frontend\")\nordersApi = Node(\"Orders API\", \"backend\", \"Node :8080\")\nordersDb = Node(\"orders table\", \"database\", \"Postgres\", null, \"success\")\nbillingJob = Node(\"Nightly billing\", \"backend\", \"cron 02:00\")\nledger = Node(\"Ledger\", \"database\", \"append-only\", null, \"info\")\nplaceOrder = Edge(web, ordersApi, \"POST /orders\")\nwriteOrder = Edge(ordersApi, ordersDb, \"insert\")\nreadOrders = Edge(billingJob, ordersDb, \"read unbilled\", null, \"danger\")\npostLedger = Edge(billingJob, ledger, \"post\")\nclients = Group(\"CLIENTS\", [web], \"plain\")\nordersRepo = Group(\"orders-service\", [ordersApi, ordersDb])\nbillingRepo = Group(\"billing\", [billingJob, ledger])"]},{"name":"Node","group":"Content","signature":"Node(label: string, kind?: \"frontend\" | \"backend\" | \"database\" | \"messagebus\" | \"cloud\" | \"security\" | \"external\", detail?: string, tag?: string, tone?: \"info\" | \"success\" | \"warning\" | \"danger\" | \"strong\", row?: number)","description":"A box in an Architecture. kind sets icon and color (default backend); detail is monospace, up to 2 lines (\\n breaks); tag is a small chip such as \"new\"; tone tints it (danger = risk, strong = where it ends); row pins it to a row (1, 2, ...) in lanes.","tier":"core","pack":"core","examples":[]},{"name":"Edge","group":"Content","signature":"Edge(from: Node, to: Node, label?: string, style?: \"solid\" | \"dashed\" | \"emphasis\" | \"security\", tone?: \"info\" | \"success\" | \"warning\" | \"danger\")","description":"An arrow between two Node statements (pass their names, not strings). style: dashed for async, emphasis for the main path, security for auth or trust flows. tone colors it, e.g. danger for a risky write, success for a read.","tier":"core","pack":"core","examples":[]},{"name":"Group","group":"Content","signature":"Group(label: string, members: Node[], kind?: \"region\" | \"security\" | \"plain\")","description":"A boundary around Node statements (a VPC, a cluster, a trust zone); members still sit where their edges put them. A group whose members are a subset of another's is drawn inside it; kind security draws it red, plain draws only its name.","tier":"core","pack":"core","examples":[]},{"name":"Diff","group":"Content","signature":"Diff(patch: string, title?: string)","description":"Unified diff (git diff output, one or more files) with line numbers. patch is a raw multi-line string. Clicked lines reach the agent as file:+line.","tier":"core","pack":"core","examples":["retryPatch = Diff(\"diff --git a/src/retry.ts b/src/retry.ts\n--- a/src/retry.ts\n+++ b/src/retry.ts\n@@ -10,2 +10,3 @@\n- for (let i = 0; i < 3; i++) {\n+ for (let i = 0; i < MAX_ATTEMPTS; i++) {\n+ if (i > 0) await sleep(backoff(i));\")"]},{"name":"FileTree","group":"Data","signature":"FileTree(entries: string[])","description":"File tree, one path per entry, optionally prefixed with a git status code (A new, M modified, D deleted, R old -> new) and suffixed with \" # note\". Folders are inferred. Clicked files and folders reach the agent by path.","tier":"core","pack":"core","examples":["changedFiles = FileTree([\"M src/session/store.ts # read-through to Postgres\", \"A src/session/pg-store.ts\", \"A migrations/0042_sessions.sql # table + expiry index\", \"R src/session/redis.ts -> src/session/redis-cache.ts\", \"D src/session/legacy.ts\", \"M src/config.ts # SESSIONS_PG flag\"])"]},{"name":"Mermaid","group":"Content","signature":"Mermaid(source: string, caption?: string)","description":"Diagram from Mermaid source (flowchart, sequence, state, class, ER, gantt). source is a raw multi-line string. Keep node labels to a few words; clicked nodes reach the agent by label.","tier":"core","pack":"@austere-axi/pack-mermaid","examples":["requestPath = Mermaid(\"flowchart LR\n client[Client] --> api[API]\n api --> pg[(Postgres)]\", \"Request path\")"]},{"name":"Progress","group":"Data","signature":"Progress(value: number, label?: string, max?: number)","description":"Progress bar. value counts toward max (default 100); label names what is progressing. Shows a percentage.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["migration = Progress(64, \"Rows migrated\")"]},{"name":"Avatar","group":"Data","signature":"Avatar(name: string, src?: string, size?: \"md\" | \"lg\")","description":"Round avatar for a person. Shows the initials of name; src is an optional https image URL.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["owner = Avatar(\"Ada Lovelace\")"]},{"name":"AvatarGroup","group":"Data","signature":"AvatarGroup(avatars: Avatar[], max?: number)","description":"Overlapping Avatars, for reviewers or owners. max (default 4) shows the rest as +N.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["team = AvatarGroup([ada, grace, linus], 2)\nada = Avatar(\"Ada Lovelace\")\ngrace = Avatar(\"Grace Hopper\")\nlinus = Avatar(\"Linus Torvalds\")"]},{"name":"Tooltip","group":"Content","signature":"Tooltip(text: string, tip: string)","description":"Inline text with a short hint on hover or focus (a term and its definition). Keep tip to one line.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["term = Tooltip(\"idempotent\", \"Safe to run twice with the same result.\")"]},{"name":"HoverCard","group":"Content","signature":"HoverCard(text: string, title: string, body?: string)","description":"Inline text that shows a small card (title and a line or two of body) on hover or focus, e.g. a person or a service.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["svc = HoverCard(\"billing-api\", \"billing-api\", \"Owns invoices and refunds. On call: payments team.\")"]},{"name":"Breadcrumb","group":"Content","signature":"Breadcrumb(items: BreadcrumbItem[])","description":"Path trail such as Repo / Package / File, from BreadcrumbItems. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["trail = Breadcrumb([repo, pkg, file])\nrepo = BreadcrumbItem(\"austere-axi\")\npkg = BreadcrumbItem(\"packs\")\nfile = BreadcrumbItem(\"shadcn\")"]},{"name":"BreadcrumbItem","group":"Content","signature":"BreadcrumbItem(label: string, href?: string)","description":"One step of a Breadcrumb. href is optional; the last item is the current page.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]},{"name":"Kbd","group":"Content","signature":"Kbd(keys: string)","description":"Keyboard shortcut. keys joins keys with \"+\", e.g. \"Ctrl+K\"; each key is drawn as a key cap.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["shortcut = Kbd(\"Ctrl+Shift+P\")"]},{"name":"Skeleton","group":"Content","signature":"Skeleton(lines?: number, shape?: \"lines\" | \"avatar\")","description":"Grey placeholder block for content not yet written or loaded (default 3 lines). shape avatar adds a round head.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["pending = Skeleton(3, \"avatar\")"]},{"name":"Calendar","group":"Data","signature":"Calendar(month: string, highlights?: string[])","description":"Read-only month grid (not a date picker). month is \"YYYY-MM\"; highlights lists \"YYYY-MM-DD\" or \"YYYY-MM-DD label\" entries to mark, e.g. a freeze or a release. Marked days are click targets.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["window = Calendar(\"2026-11\", [\"2026-11-04 Code freeze\", \"2026-11-12 Release\", \"2026-11-13\"])"]},{"name":"Timeline","group":"Content","signature":"Timeline(items: TimelineItem[])","description":"Vertical history or schedule of TimelineItems, oldest first. Each item is a click target.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":["history = Timeline([found, fixed, rollout])\nfound = TimelineItem(\"Bug found\", \"Oct 28\", \"Retries double-charge on timeout.\")\nfixed = TimelineItem(\"Fix merged\", \"Oct 29\", \"Idempotency key added.\", \"current\")\nrollout = TimelineItem(\"Rollout\", \"Nov 3\", \"\", \"upcoming\")"]},{"name":"TimelineItem","group":"Content","signature":"TimelineItem(title: string, date?: string, detail?: string, state?: \"done\" | \"current\" | \"upcoming\")","description":"One event in a Timeline. state: done (default), current or upcoming.","tier":"extended","pack":"@austere-axi/pack-shadcn","examples":[]}]}
|
package/dist/chrome/chrome.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var y=window.__AUSTERE__??JSON.parse(document.getElementById("austere-boot")?.textContent||"{}"),w=y.id,h=y.hosted||null,b=y.hosted?.base??`/s/${w}`,te=y.viewer||{role:"owner",name:""},m=!h&&te.role==="owner",_=40,A={get(e,n){try{let s=localStorage.getItem(e);return s==null?n:JSON.parse(s)}catch{return n}},set(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}},q={get(e){try{return JSON.parse(sessionStorage.getItem(e)||"null")}catch{return null}},set(e,n){try{sessionStorage.setItem(e,JSON.stringify(n))}catch{}}},v=h?String(A.get("austere:name","")||"").slice(0,_):te.name,t={mode:A.get("austere:mode","annotate"),queue:A.get(`austere:queue:${w}`,[]),transcript:[],presence:"idle",status:"open",endedBy:null,closed:!1,unread:0,more:!1,program:null,revision:0,errorsRevision:0,renderReport:null,thirdParty:!1,frameReady:!1,scrollY:0,parserErrors:[],runtimeErrors:[],changes:[],highlight:!1,sheetOpen:q.get(`austere:sheet:${w}`)===!0,sending:!1,connected:!1,editing:null,links:null},l=(e,n=document)=>n.querySelector(e);function o(e,n={},...s){let r=document.createElement(e);for(let[i,a]of Object.entries(n))a==null||a===!1||(i==="class"?r.className=String(a):i.startsWith("on")?typeof a=="function"&&r.addEventListener(i.slice(2),a):i==="text"?r.textContent=String(a):i==="html"?r.innerHTML=String(a):r.setAttribute(i,a===!0?"":String(a)));for(let i of s.flat())i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}document.body.innerHTML=`
|
|
2
2
|
<div class="app">
|
|
3
3
|
<header class="bar">
|
|
4
4
|
<div class="bar-title"><span class="title"></span><span class="file"></span></div>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<button type="button" data-cmd="copy-path">Copy file path</button>
|
|
18
18
|
<button type="button" data-cmd="copy-link">Copy review link</button>
|
|
19
19
|
<button type="button" data-cmd="reload">Reload artifact</button>
|
|
20
|
-
<a data-cmd="export" href="${
|
|
20
|
+
<a data-cmd="export" href="${b}/export">Download standalone HTML</a>
|
|
21
21
|
<button type="button" data-cmd="end" class="danger">End review</button>
|
|
22
22
|
<button type="button" data-cmd="close" class="danger">Close review</button>
|
|
23
23
|
<button type="button" data-cmd="reopen">Reopen review</button>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
</aside>
|
|
53
53
|
</div>
|
|
54
54
|
<button type="button" class="dock"></button>
|
|
55
|
-
</div>`;if(!m)for(let e of['[data-cmd="copy-path"]','[data-cmd="copy-link"]','[data-cmd="export"]','[data-cmd="end"]','[data-cmd="close"]','[data-cmd="reopen"]',".send-end"])
|
|
55
|
+
</div>`;if(!m)for(let e of['[data-cmd="copy-path"]','[data-cmd="copy-link"]','[data-cmd="export"]','[data-cmd="end"]','[data-cmd="close"]','[data-cmd="reopen"]',".send-end"])l(e)?.remove();function pe(){if(m)return;l(".file").textContent=v?`reviewing as ${v}`:"";let e=h||te.auto?"Enter sends":"the owner sends your notes on \xB7 Enter sends";l(".composer-hint").textContent=v?`Posting as ${v} \xB7 ${e}`:e}var x=h?o("form",{class:"name-ask",hidden:!0},o("label",{for:"austere-name",text:"Your name, shown with your notes"}),o("div",{class:"name-row"},o("input",{id:"austere-name",maxlength:String(_),autocomplete:"name",placeholder:"Name"}),o("button",{type:"submit",class:"btn primary",text:"Continue"}))):null;x&&(l(".composer").before(x),x.addEventListener("submit",e=>{e.preventDefault();let n=l("input",x),s=n.value.trim().slice(0,_);if(!s)return n.focus();v=s,A.set("austere:name",s),x.hidden=!0,pe(),N(!1)}));var f=h?.report?o("form",{class:"report-box",hidden:!0},o("label",{for:"austere-report",text:"What is wrong with this page?"}),o("textarea",{id:"austere-report",rows:"3",maxlength:"1000"}),o("div",{class:"report-row"},o("span",{class:"report-status"}),o("button",{type:"button",class:"btn tiny ghost",text:"Cancel",onclick:()=>{f&&(f.hidden=!0)}}),o("button",{type:"submit",class:"btn tiny primary",text:"Send report"}))):null;if(h){let e=o("footer",{class:"hosted-foot"},o("a",{href:"https://github.com/MandalorianBatman/austere-axi",target:"_blank",rel:"noopener noreferrer",text:"Made with austere-axi"}));f&&(e.append(o("span",{"aria-hidden":"true",text:"\xB7"}),o("button",{type:"button",class:"link-btn report-open",text:"Report",onclick:()=>{f.hidden=!1,l(".report-status",f).textContent="",l("textarea",f).focus()}})),l(".panel").append(f),f.addEventListener("submit",async n=>{n.preventDefault();let s=l("textarea",f).value.trim(),r=l(".report-status",f);if(!s)return l("textarea",f).focus();r.textContent="Sending\u2026";try{let i=await fetch(h.report,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({reason:s})});if(!i.ok)throw new Error(`HTTP ${i.status}`);l("textarea",f).value="",f.hidden=!0,l(".report-open",e).replaceWith(o("span",{class:"report-done",text:"Reported. Thank you."}))}catch(i){r.textContent=`Not sent: ${i.message}`}})),l(".panel").append(e)}var ne=l(".frame"),u=l(".log"),R=l(".composer textarea"),O=l(".banner");l(".title").textContent=y.title;m&&(l(".file").textContent=y.name);pe();l(".file").title=y.file||"";document.title=`${y.title} \xB7 austere`;function B(e){return String(e).replace(/[&<>"']/g,n=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[n])}function F(e){return B(e).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,'<a href="$2" target="_blank" rel="noopener">$1</a>')}function fe(e){let n=String(e).replace(/\r\n/g,`
|
|
56
56
|
`).split(`
|
|
57
|
-
`),s=[],
|
|
58
|
-
`))}</code></pre>`);continue}if(/^\s*([-*]|\d+\.)\s+/.test(a)){let d=/^\s*\d+\./.test(a),l=[];for(;o<t.length&&/^\s*([-*]|\d+\.)\s+/.test(t[o]);)l.push(t[o++].replace(/^\s*([-*]|\d+\.)\s+/,""));s.push(`<${d?"ol":"ul"}>${l.map(v=>`<li>${Q(v)}</li>`).join("")}</${d?"ol":"ul"}>`);continue}if(/^#{1,6}\s+/.test(a)){s.push(`<p><strong>${Q(a.replace(/^#+\s+/,""))}</strong></p>`),o++;continue}if(!a.trim()){o++;continue}let i=[];for(;o<t.length&&t[o].trim()&&!/^```|^\s*([-*]|\d+\.)\s+|^#{1,6}\s/.test(t[o]);)i.push(t[o++]);s.push(`<p>${i.map(Q).join("<br>")}</p>`)}return s.join("")}function C(e){te.contentWindow?.postMessage({austere:1,...e},"*")}function ne(){n.frameReady=!1,te.src=`${b.artifactUrl??`${g}/a/`}?r=${Date.now()}`}window.addEventListener("message",e=>{if(e.source!==te.contentWindow)return;let t=e.data;if(!(!t||t.austere!==1))switch(t.type){case"hello":C({type:"init",mode:n.closed?"explore":n.mode,state:O.get(`austere:form:${x}`),scrollY:n.scrollY});break;case"ready":n.frameReady=!0,t.title&&(c(".title").textContent=t.title,document.title=`${t.title} \xB7 austere`),n.highlight&&G(!1);break;case"annotate":X(t.item);break;case"action":X(t.item),we();break;case"errors":n.parserErrors=(t.errors||[]).filter(s=>s.severity!=="warning"),p();break;case"runtime-error":t.error&&!n.runtimeErrors.some(s=>s.statementId===t.error.statementId&&s.message===t.error.message)&&(n.runtimeErrors.push(t.error),p());break;case"state":O.set(`austere:form:${x}`,t.state);break;case"scroll":n.scrollY=t.y||0;break;case"changes":n.changes=Array.isArray(t.ids)?t.ids.filter(s=>typeof s=="string").slice(0,50):[],re(),n.highlight&&G(!1);break;case"toggle-mode":R(n.mode==="annotate"?"explore":"annotate");break;case"open-url":fe(t.url);break}});function fe(e){let t;try{t=new URL(String(e))}catch{return}!/^(https?|mailto):$/.test(t.protocol)||t.origin===location.origin||window.open(t.href,"_blank","noopener")}function F(){N.set(`austere:queue:${x}`,n.queue)}function X(e){if(!(n.closed||!e||typeof e!="object"||typeof e.kind!="string")){for(let t of["target","component","note","text","selection","excerpt","message","statement"])t in e&&(e[t]=ue(e[t]));e.qid=`q${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,n.queue.push(e),F(),p(!0),L()}}function le(e){n.queue=n.queue.filter(t=>t.qid!==e),F(),p(),L()}function ge(e){return e.kind==="annotation"?{icon:"\u270E",text:e.target,sub:e.component}:e.kind==="action"?{icon:"\u2197",text:e.message,sub:"button"}:e.kind==="render-error"?{icon:"!",text:e.statement||"page",sub:"render issue"}:{icon:"",text:"",sub:""}}function se(e,t=""){let s=[];for(let[o,a]of Object.entries(e||{}))a&&typeof a=="object"&&!Array.isArray(a)?s.push(...se(a,"")):s.push(`${t}${o}: ${Array.isArray(a)?a.join(", "):a}`);return s}var ue=e=>typeof e=="string"?e:e==null?"":String(e);function me(e){if(e.selection)return e.selection;if(e.detail?.part)return e.excerpt?`${e.detail.part} ${e.excerpt}`:e.detail.part;if(e.detail?.column){let t=[e.detail.row&&`row ${e.detail.row}`,`column ${e.detail.column}`].filter(Boolean).join(", ");return e.excerpt?`${e.excerpt} (${t})`:t}return e.kind==="action"&&e.form?se(e.form).join(" \xB7 "):e.kind==="render-error"?e.message:e.excerpt||""}function ie(e,t={}){try{return be(e,t)}catch{return r("div",{class:"item"},r("div",{class:"note",text:"This note could not be displayed."}))}}function be(e,{queued:t,held:s}={}){let o=ge(e),a=r("div",{class:`item kind-${e.kind}`});if(o.text){let l=r("button",{type:"button",class:"anchor",title:e.kind==="annotation"?"Show in the page":"",onclick:()=>{(e.kind==="annotation"||e.kind==="render-error")&&(C({type:"reveal",id:e.target||e.statement}),ae()&&S(!1))}},r("span",{class:"anchor-icon",text:o.icon}),r("span",{class:"anchor-text",text:o.text}),o.sub?r("span",{class:"anchor-sub",text:o.sub}):null);a.append(l)}if(s&&e.kind==="annotation"){let l=(Array.isArray(e.path)?e.path:[]).slice(0,-1).filter(v=>typeof v=="string"&&v!=="root");l.length&&a.append(r("div",{class:"anchor-sub",text:`within ${l.join(" > ")}`})),e.detail&&typeof e.detail=="object"&&a.append(r("div",{class:"anchor-sub",text:se(e.detail).join(" \xB7 ")}))}let i=ue(me(e));i&&a.append(r("blockquote",{text:s||i.length<=260?i:i.slice(0,259)+"\u2026"}));let d=e.kind==="message"?e.text:e.note;if(t&&n.editing===e.qid){let l=r("textarea",{class:"edit",rows:"2"});l.value=d||"";let v=()=>{let k=l.value.trim();if(e.kind==="message"){if(!k)return le(e.qid);e.text=k}else e.note=k;n.editing=null,F(),p()};l.addEventListener("keydown",k=>{k.key==="Enter"&&!k.shiftKey?(k.preventDefault(),v()):k.key==="Escape"&&(n.editing=null,p())}),l.addEventListener("blur",v),a.append(l),setTimeout(()=>l.focus(),0)}else d&&a.append(r("div",{class:"note",text:d}));return a}function z(e){return e?new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}function ye(e){return m?e.author||"You":e.author===w?"You":e.author||"Owner"}async function Y(e,t){try{await fetch(`${g}/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{ids:t}:{all:!0})})}catch{J("Could not reach the server. Try again.")}}function ve(e){if(h)return e.author===w?r("div",{class:"receipt"},r("em",{text:"Sent to the page owner"})):null;if(e.held){let o=r("div",{class:"receipt held"},r("span",{class:"held-label",text:m?"Held \xB7 not sent to the agent":"Waiting for the owner to send it on"}));return m&&o.append(r("button",{type:"button",class:"btn tiny primary",text:"Send",onclick:()=>Y("release",[e.id])}),r("button",{type:"button",class:"btn tiny ghost",text:"Discard",onclick:()=>Y("discard",[e.id])})),o}let t=[["Seen",e.seenAt],["Working",e.workAt],["Done",e.doneAt]],s=r("div",{class:"receipt"});for(let[o,a]of t)s.append(r("span",{class:a?"on":"",title:a?`${o} ${z(a)}`:`Not ${o.toLowerCase()} yet`,text:o}));return e.seenAt||s.append(r("em",{text:n.presence==="listening"?"":n.unread?`waiting for the agent (${n.unread} unread)`:"waiting for the agent"})),s}var ce=0;function p(e=!1){let t=u.scrollHeight-u.scrollTop-u.clientHeight<40;u.textContent="";let s=[...n.parserErrors,...n.runtimeErrors];if(s.length){let i=r("div",{class:"issues"},r("div",{class:"issues-head",text:`Render issues (${s.length})`}));for(let d of s.slice(0,8))i.append(r("div",{class:"issue"},r("div",{class:"issue-text"},d.statementId?r("code",{text:d.statementId}):null," ",d.message),n.closed?null:r("button",{type:"button",class:"btn tiny",text:"Queue fix",onclick:()=>X({kind:"render-error",statement:d.statementId,target:d.statementId,message:d.message,note:"Fix this render error."})})));u.append(i)}n.more&&u.append(r("button",{type:"button",class:"btn tiny ghost load-earlier",text:"Load earlier messages",onclick:xe})),!n.transcript.length&&!n.queue.length&&u.append(r("div",{class:"empty"},r("p",{html:"<strong>Point at anything to comment on it.</strong>"}),r("p",{text:`In Annotate mode, click a section, table cell, diagram node or diff line, or select text. Notes queue here; Send delivers them to the ${h?"page owner":"agent"}.`})));for(let i of n.transcript)if(i.role==="agent")u.append(r("div",{class:"msg agent"},r("div",{class:"who",text:`Agent \xB7 ${z(i.at)}`}),r("div",{class:"md",html:he(i.text)})));else{let d=r("div",{class:`msg user${i.held?" held":""}`},r("div",{class:"who",text:`${ye(i)} \xB7 ${z(i.at)}${i.end?" \xB7 ended review":""}`}));for(let v of i.items||[])d.append(ie(v,{held:!!i.held}));let l=ve(i);l&&d.append(l),u.append(d)}let o=m?n.transcript.filter(i=>i.held).length:0;if(o&&u.append(r("div",{class:"held-bar"},r("span",{text:`${o} held from teammates`}),r("button",{type:"button",class:"btn tiny primary",text:"Send all",onclick:()=>Y("release",n.transcript.filter(i=>i.held).map(i=>i.id))}),r("button",{type:"button",class:"btn tiny ghost",text:"Discard all",onclick:()=>Y("discard")}))),n.queue.length){let i=r("div",{class:"queued"},r("div",{class:"queued-head",text:`Queued \xB7 ${n.queue.length}`}));for(let d of n.queue){let l=ie(d,{queued:!0});l.classList.add("q"),l.append(r("div",{class:"q-actions"},r("button",{type:"button",class:"btn tiny ghost",text:"Edit",onclick:()=>{n.editing=d.qid,p()}}),r("button",{type:"button",class:"btn tiny ghost",text:"Remove",onclick:()=>le(d.qid)}))),i.append(l)}u.append(i)}if(n.closed)u.append(r("div",{class:"ended-note",text:m?"You closed this review.":"The owner closed this review."}));else if(n.status==="ended"){let i=n.endedBy==="agent"?"The agent ended this review.":m?"You ended this review.":"The owner ended this review.";u.append(r("div",{class:"ended-note",text:`${i} Notes you send now reach the agent the next time it polls.`}))}let a=n.transcript.length+n.queue.length;(e||t||a!==ce)&&(u.scrollTop=u.scrollHeight),ce=a,oe()}var I=!1;function oe(){let e=n.closed,t=n.queue.length;A.disabled=e||I||n.sending,c(".send").disabled=e||I||n.sending,c(".send-end")&&(c(".send-end").disabled=e||n.sending),c(".send").textContent=n.sending?"Sending\u2026":t?`Send ${t}`:"Send",A.placeholder=e?"Review closed":t?"Add a message (optional)\u2026":"Message the agent\u2026"}function J(e){let t=c(".composer-error");t.textContent=e||"",t.hidden=!e}async function D(e=!1){if(n.sending||n.closed)return;let t=A.value.trim(),s=n.queue.map(({qid:o,...a})=>a);if(t&&s.push({kind:"message",text:t}),!s.length&&!e){A.focus();return}if(!(e&&!m)&&!(e&&!s.length&&!confirm("End this review? The agent will stop listening; notes you send later still reach it."))){if(h&&!w){T.hidden=!1,c("input",T).focus();return}n.sending=!0,J(""),oe();try{let o=await fetch(`${g}/send`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(h?{name:w,items:s}:{items:s,end:e})}),a=await o.json().catch(()=>({}));if(!o.ok)throw new Error(a.error||`HTTP ${o.status}`);n.queue=[],F(),A.value="",a.entry&&!n.transcript.some(i=>i.id===a.entry.id)&&n.transcript.push(a.entry),h&&j()}catch(o){J(`Not sent: ${o.message}. Your notes are still queued.`)}finally{n.sending=!1,p(!0),L()}}}c(".composer").addEventListener("submit",e=>{e.preventDefault(),D(!1)});c(".send-end")?.addEventListener("click",()=>D(!0));A.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),D(!1))});function R(e){n.mode=e==="explore"?"explore":"annotate",N.set("austere:mode",n.mode);for(let t of document.querySelectorAll(".seg button"))t.classList.toggle("on",t.dataset.mode===n.mode);C({type:"mode",mode:n.closed?"explore":n.mode})}for(let e of document.querySelectorAll(".seg button"))e.addEventListener("click",()=>R(e.dataset.mode));document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(e.key==="i"||e.key==="I")&&(e.preventDefault(),R(n.mode==="annotate"?"explore":"annotate"))});function $(){let e=c(".presence"),t,s;n.closed?[t,s]=["Review closed","ended"]:I?[t,s]=["Page removed","ended"]:n.connected?h?[t,s]=["Shared page","hosted"]:n.presence==="listening"?[t,s]=["Agent listening","listening"]:n.presence==="working"?[t,s]=["Agent working","working"]:n.status==="ended"?[t,s]=["Agent stopped","idle"]:[t,s]=["Agent not listening","idle"]:[t,s]=["Reconnecting\u2026","off"],s==="idle"&&n.unread&&(t+=` \xB7 ${n.unread} waiting`),e.className=`presence ${s}`,e.textContent=t,e.title=s==="idle"?"Your notes are kept and reach the agent the next time it polls.":s==="working"?"The agent has your last batch.":s==="hosted"?"Notes go to the page owner. Replies show up within 30 seconds.":"",document.documentElement.classList.toggle("is-ended",n.closed),m&&(c('[data-cmd="end"]').hidden=n.status==="ended",c('[data-cmd="close"]').hidden=n.closed,c('[data-cmd="reopen"]').hidden=!n.closed&&n.status!=="ended"),L()}function re(){let e=c(".changes");if(e.setAttribute("aria-pressed",String(n.highlight)),!n.changes.length&&!n.highlight){e.hidden=!0;return}e.hidden=!1,e.textContent=`${n.changes.length} changed`,e.title=n.changes.length?`${n.highlight?"Hide":"Highlight"} what the last turn changed: ${n.changes.join(", ")}`:"The last turn changed nothing on the page. Click to stop highlighting."}function G(e){C({type:"highlight",ids:n.highlight?n.changes:[],scroll:e})}c(".changes").addEventListener("click",()=>{n.highlight=!n.highlight,re(),G(n.highlight)});var W=c(".menu-pop");c(".menu-btn").addEventListener("click",e=>{e.stopPropagation(),W.hidden=!W.hidden});document.addEventListener("click",()=>W.hidden=!0);W.addEventListener("click",async e=>{let t=e.target.closest("[data-cmd]")?.dataset.cmd;if(t){if(t==="copy-path"&&navigator.clipboard?.writeText(b.file),t==="copy-link"&&navigator.clipboard?.writeText(n.links?.remote||location.href),t==="reload"&&ne(),t==="end"){if(n.queue.length)return D(!0);if(!confirm("End this review? The agent will stop listening."))return;await fetch(`${g}/end`,{method:"POST"}).catch(()=>{})}if(t==="close"){if(!confirm("Close this review? No one can add notes until you reopen it."))return;await fetch(`${g}/close`,{method:"POST"}).catch(()=>{})}t==="reopen"&&await fetch(`${g}/reopen`,{method:"POST"}).catch(()=>{})}});var ae=()=>window.matchMedia("(max-width: 860px)").matches;function S(e){n.sheetOpen=e,O.set(`austere:sheet:${x}`,e),document.documentElement.classList.toggle("sheet-open",e),e&&setTimeout(()=>u.scrollTop=u.scrollHeight,50)}function L(){let e=c(".dock"),t=n.queue.length,s=["Conversation"];t&&s.push(`${t} queued`);let o=n.transcript[n.transcript.length-1];o?.role==="agent"&&o.at>(O.get(`austere:seen:${x}`)||0)&&s.push("new reply"),e.innerHTML=`<span class="dock-grip"></span><span>${M(s.join(" \xB7 "))}</span><span class="dock-presence ${M(c(".presence").className.replace("presence","").trim())}"></span>`}function we(){let e=c(".dock");e.classList.remove("pulse"),e.offsetWidth,e.classList.add("pulse")}c(".dock").addEventListener("click",()=>{O.set(`austere:seen:${x}`,Date.now()),S(!0),L()});c(".sheet-close").addEventListener("click",()=>S(!1));c(".scrim").addEventListener("click",()=>S(!1));document.addEventListener("keydown",e=>{e.key==="Escape"&&n.sheetOpen&&ae()&&S(!1)});var E=null;c(".panel-head").addEventListener("touchstart",e=>E=e.touches[0].clientY,{passive:!0});c(".panel-head").addEventListener("touchend",e=>{E!=null&&e.changedTouches[0].clientY-E>60&&S(!1),E=null},{passive:!0});c(".dock").addEventListener("touchstart",e=>E=e.touches[0].clientY,{passive:!0});c(".dock").addEventListener("touchend",e=>{E!=null&&E-e.changedTouches[0].clientY>40&&S(!0),E=null},{passive:!0});function Z(e){let t=c(".notice");if(!e||!e.length){t.hidden=!0;return}t.textContent=`Third-party pack code runs in this page: check queued items before you send (${e.join(", ")}).`,t.title=t.textContent,t.hidden=!1}function q(e,t=[]){if(H.textContent="",!e){H.hidden=!0;return}H.append(r("span",{text:e}),...t),H.hidden=!1}function pe(e){for(let t of e){let s=n.transcript.findIndex(o=>o.id===t.id);t.discarded?s>=0&&n.transcript.splice(s,1):s>=0?n.transcript[s]=t:n.transcript.push(t)}n.transcript.sort((t,s)=>t.at-s.at)}async function xe(){let e=n.transcript[0];if(e)try{let t=await fetch(`${g}/transcript?before=${encodeURIComponent(e.id)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);let s=await t.json(),o=new Set(n.transcript.map(i=>i.id));n.transcript=[...(s.entries||[]).filter(i=>!i.discarded&&!o.has(i.id)),...n.transcript],n.more=!!s.more;let a=u.scrollHeight-u.scrollTop;p(),u.scrollTop=u.scrollHeight-a}catch(t){J(`Could not load earlier messages: ${t.message}`)}}var y=null,B=0;function ke(){y=new EventSource(`${g}/events`),y.addEventListener("open",()=>{n.connected=!0,B=0,q(""),$()}),y.addEventListener("error",()=>{n.connected=!1,B||(B=Date.now()),$(),setTimeout(()=>{!n.connected&&Date.now()-B>3500&&q("Lost the austere-axi server. Run any austere-axi command to restart it; this page reconnects on its own.",[r("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})])},4e3)}),y.addEventListener("snapshot",e=>{let t=JSON.parse(e.data);n.transcript=(t.transcript||[]).filter(s=>!s.discarded),n.presence=t.presence,n.status=t.session.status,n.endedBy=t.session.endedBy,n.closed=!!t.session.closed,n.unread=t.session.unread||0,n.more=!!t.more,n.links=t.links,t.version&&t.version!==b.version&&q("austere-axi was updated. This page is running the previous version.",[r("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Z(t.thirdPartyPacks),n.program===null?n.program=t.program:t.program!==n.program&&(n.program=t.program,n.frameReady&&C({type:"source",program:t.program})),$(),p(),R(n.mode)}),y.addEventListener("transcript",e=>{pe(JSON.parse(e.data).entries||[]),p(),L()}),y.addEventListener("presence",e=>{let t=JSON.parse(e.data);n.presence=t.presence,n.status=t.status,n.endedBy=t.endedBy,n.closed=!!t.closed,n.unread=t.unread||0,R(n.mode),$(),p()}),y.addEventListener("changed",e=>{let t=JSON.parse(e.data);n.parserErrors=[],n.runtimeErrors=[],Z(t.thirdPartyPacks),t.shellChanged||!n.frameReady?(n.program=t.program,n.changes=[],re(),ne()):(n.program=t.program,C({type:"source",program:t.program})),p()}),y.addEventListener("ended",e=>{let t=JSON.parse(e.data);n.status="ended",n.endedBy=t.by,t.closed&&(n.closed=!0,C({type:"mode",mode:"explore"})),$(),p()}),y.addEventListener("server",e=>{let t=JSON.parse(e.data);if(t.state==="revoked"){y.close(),n.connected=!1,q("Your invite was revoked. Ask the owner for a new link.");return}t.state==="stopped"&&q("The austere-axi server stopped. Run any austere-axi command to start it again; this page reconnects on its own.")})}var $e=3e4,U=null,K=null,P=null,V=!1;function Ee(e){let t=(e.notes||[]).map(o=>({id:`n${o.seq}`,role:"user",author:String(o.author||"").slice(0,_),items:Array.isArray(o.items)?o.items.filter(a=>a&&typeof a=="object"):[],at:o.at})),s=(e.replies||[]).map(o=>({id:`r${o.seq}`,role:"agent",text:String(o.text||""),at:o.at}));return[...t,...s]}async function j(){if(!I)return P?(V=!0,P):(P=(async()=>{try{let e=await fetch(`${g}/conversation${U==null?"":`?after=${encodeURIComponent(U)}`}`,{cache:"no-store"});if(e.status===404||e.status===410){I=!0,n.connected=!1,q("This page is no longer available."),$(),oe();return}if(!e.ok)throw new Error(`HTTP ${e.status}`);let t=await e.json();n.connected=!0,K==null?K=t.publishedAt:t.publishedAt!==K&&q("New version, reload",[r("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),t.cursor!=null&&(U=t.cursor),pe(Ee(t)),Z(t.thirdPartyPacks)}catch{n.connected=!1}finally{P=null,$(),p(),L()}V&&(V=!1,await j())})(),P)}function Se(){j(),setInterval(j,$e),window.addEventListener("focus",()=>j())}h||window.addEventListener("pagehide",e=>{e.persisted||navigator.sendBeacon?.(`${g}/bye`)});R(n.mode);ae()&&n.sheetOpen&&S(!0);$();p();L();ne();h?Se():ke();})();
|
|
57
|
+
`),s=[],r=0;for(;r<n.length;){let i=n[r];if(/^```/.test(i)){let c=[];for(r++;r<n.length&&!/^```/.test(n[r]);)c.push(n[r++]);r++,s.push(`<pre><code>${B(c.join(`
|
|
58
|
+
`))}</code></pre>`);continue}if(/^\s*([-*]|\d+\.)\s+/.test(i)){let c=/^\s*\d+\./.test(i),d=[];for(;r<n.length&&/^\s*([-*]|\d+\.)\s+/.test(n[r]);)d.push(n[r++].replace(/^\s*([-*]|\d+\.)\s+/,""));s.push(`<${c?"ol":"ul"}>${d.map(g=>`<li>${F(g)}</li>`).join("")}</${c?"ol":"ul"}>`);continue}if(/^#{1,6}\s+/.test(i)){s.push(`<p><strong>${F(i.replace(/^#+\s+/,""))}</strong></p>`),r++;continue}if(!i.trim()){r++;continue}let a=[];for(;r<n.length&&n[r].trim()&&!/^```|^\s*([-*]|\d+\.)\s+|^#{1,6}\s/.test(n[r]);)a.push(n[r++]);s.push(`<p>${a.map(F).join("<br>")}</p>`)}return s.join("")}function C(e){ne.contentWindow?.postMessage({austere:1,...e},"*")}function se(){t.frameReady=!1,ne.src=`${y.artifactUrl??`${b}/a/`}?r=${Date.now()}`}window.addEventListener("message",e=>{if(e.source!==ne.contentWindow)return;let n=e.data;if(!(!n||n.austere!==1))switch(n.type){case"hello":C({type:"init",mode:t.closed?"explore":t.mode,state:q.get(`austere:form:${w}`),scrollY:t.scrollY});break;case"ready":t.frameReady=!0,n.title&&(l(".title").textContent=n.title,document.title=`${n.title} \xB7 austere`),t.highlight&&Z(!1);break;case"annotate":X(n.item);break;case"action":X(n.item),xe();break;case"errors":t.parserErrors=(n.errors||[]).filter(r=>r.severity!=="warning"),t.errorsRevision=t.revision,p(),z();break;case"runtime-error":let s=n.error;s&&!t.runtimeErrors.some(r=>r.statementId===s.statementId&&r.message===s.message)&&(t.runtimeErrors.push(s),t.errorsRevision=t.revision,p(),z());break;case"state":q.set(`austere:form:${w}`,n.state);break;case"scroll":t.scrollY=n.y||0;break;case"changes":t.changes=Array.isArray(n.ids)?n.ids.filter(r=>typeof r=="string").slice(0,50):[],ie(),t.highlight&&Z(!1);break;case"toggle-mode":I(t.mode==="annotate"?"explore":"annotate");break;case"open-url":me(n.url);break}});function me(e){let n;try{n=new URL(String(e))}catch{return}!/^(https?|mailto):$/.test(n.protocol)||n.origin===location.origin||window.open(n.href,"_blank","noopener")}function W(){A.set(`austere:queue:${w}`,t.queue)}function X(e){if(t.closed||!e||typeof e!="object"||typeof e.kind!="string")return;let n=e;for(let r of["target","component","note","text","selection","excerpt","message","statement"])r in n&&(n[r]=D(n[r]));let s=e;s.qid=`q${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,t.queue.push(s),W(),p(!0),S()}var le;function z(){!m||t.closed||t.thirdParty||(clearTimeout(le),le=setTimeout(async()=>{let e=[...t.parserErrors,...t.runtimeErrors].map(s=>({statement:D(s.statementId),message:D(s.message)}));if(!e.length)return;let n=await fetch(`${b}/render-errors`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({revision:t.errorsRevision,errors:e})}).then(async s=>s.ok?await s.json():null,()=>null);t.renderReport=n&&!n.stale?"sent":n?null:"failed",p()},500))}function ge(e){t.queue=t.queue.filter(n=>n.qid!==e),W(),p(),S()}function be(e){return e.kind==="annotation"?{icon:"\u270E",text:e.target,sub:e.component}:e.kind==="action"?{icon:"\u2197",text:e.message,sub:"button"}:e.kind==="render-error"?{icon:"!",text:e.statement||"page",sub:"render issue"}:{icon:"",text:"",sub:""}}function re(e,n=""){let s=[];for(let[r,i]of Object.entries(e||{}))i&&typeof i=="object"&&!Array.isArray(i)?s.push(...re(i,"")):s.push(`${n}${r}: ${Array.isArray(i)?i.join(", "):i}`);return s}var D=e=>typeof e=="string"?e:e==null?"":String(e);function ye(e){if(e.selection)return e.selection;if(e.detail?.part)return e.excerpt?`${e.detail.part} ${e.excerpt}`:e.detail.part;if(e.detail?.column){let n=[e.detail.row&&`row ${e.detail.row}`,`column ${e.detail.column}`].filter(Boolean).join(", ");return e.excerpt?`${e.excerpt} (${n})`:n}return e.kind==="action"&&e.form?re(e.form).join(" \xB7 "):e.kind==="render-error"?e.message:e.excerpt||""}function de(e,n={}){try{return ve(e,n)}catch{return o("div",{class:"item"},o("div",{class:"note",text:"This note could not be displayed."}))}}function ve(e,{queued:n,held:s}={}){let r=be(e),i=o("div",{class:`item kind-${e.kind}`});if(r.text){let d=o("button",{type:"button",class:"anchor",title:e.kind==="annotation"?"Show in the page":"",onclick:()=>{(e.kind==="annotation"||e.kind==="render-error")&&(C({type:"reveal",id:e.target||e.statement}),ae()&&T(!1))}},o("span",{class:"anchor-icon",text:r.icon}),o("span",{class:"anchor-text",text:r.text}),r.sub?o("span",{class:"anchor-sub",text:r.sub}):null);i.append(d)}if(s&&e.kind==="annotation"){let d=(Array.isArray(e.path)?e.path:[]).slice(0,-1).filter(g=>typeof g=="string"&&g!=="root");d.length&&i.append(o("div",{class:"anchor-sub",text:`within ${d.join(" > ")}`})),e.detail&&typeof e.detail=="object"&&i.append(o("div",{class:"anchor-sub",text:re(e.detail).join(" \xB7 ")}))}let a=D(ye(e));a&&i.append(o("blockquote",{text:s||a.length<=260?a:a.slice(0,259)+"\u2026"}));let c=e.kind==="message"?e.text:e.note;if(n&&t.editing===e.qid){let d=o("textarea",{class:"edit",rows:"2"});d.value=c||"";let g=()=>{let k=d.value.trim();if(e.kind==="message"){if(!k)return ge(e.qid);e.text=k}else e.note=k;t.editing=null,W(),p()};d.addEventListener("keydown",k=>{k.key==="Enter"&&!k.shiftKey?(k.preventDefault(),g()):k.key==="Escape"&&(t.editing=null,p())}),d.addEventListener("blur",g),i.append(d),setTimeout(()=>d.focus(),0)}else c&&i.append(o("div",{class:"note",text:c}));return i}function G(e){return e?new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}function we(e){return m?e.author||"You":e.author===v?"You":e.author||"Owner"}async function Y(e,n){try{await fetch(`${b}/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n?{ids:n}:{all:!0})})}catch{Q("Could not reach the server. Try again.")}}function ke(e){if(h)return e.author===v?o("div",{class:"receipt"},o("em",{text:"Sent to the page owner"})):null;if(e.held){let r=o("div",{class:"receipt held"},o("span",{class:"held-label",text:m?"Held \xB7 not sent to the agent":"Waiting for the owner to send it on"}));return m&&r.append(o("button",{type:"button",class:"btn tiny primary",text:"Send",onclick:()=>Y("release",[e.id])}),o("button",{type:"button",class:"btn tiny ghost",text:"Discard",onclick:()=>Y("discard",[e.id])})),r}let n=[["Seen",e.seenAt],["Working",e.workAt],["Done",e.doneAt]],s=o("div",{class:"receipt"});for(let[r,i]of n)s.append(o("span",{class:i?"on":"",title:i?`${r} ${G(i)}`:`Not ${r.toLowerCase()} yet`,text:r}));return e.seenAt||s.append(o("em",{text:t.presence==="listening"?"":t.unread?`waiting for the agent (${t.unread} unread)`:"waiting for the agent"})),s}var ce=0;function p(e=!1){let n=u.scrollHeight-u.scrollTop-u.clientHeight<40;u.textContent="";let s=[...t.parserErrors,...t.runtimeErrors];if(s.length){let a=m&&t.renderReport==="sent",c=`Render issues (${s.length})${a?" \xB7 sent to the agent":""}`,d=o("div",{class:"issues"},o("div",{class:"issues-head",text:c}));for(let g of s.slice(0,8))d.append(o("div",{class:"issue"},o("div",{class:"issue-text"},g.statementId?o("code",{text:g.statementId}):null," ",g.message),t.closed||a?null:o("button",{type:"button",class:"btn tiny",text:"Queue fix",onclick:()=>X({kind:"render-error",statement:g.statementId,target:g.statementId,message:g.message,note:"Fix this render error."})})));u.append(d)}t.more&&u.append(o("button",{type:"button",class:"btn tiny ghost load-earlier",text:"Load earlier messages",onclick:Ee})),!t.transcript.length&&!t.queue.length&&u.append(o("div",{class:"empty"},o("p",{html:"<strong>Point at anything to comment on it.</strong>"}),o("p",{text:`In Annotate mode, click a section, table cell, diagram node or diff line, or select text. Notes queue here; Send delivers them to the ${h?"page owner":"agent"}.`})));for(let a of t.transcript)if(a.role==="agent")u.append(o("div",{class:"msg agent"},o("div",{class:"who",text:`Agent \xB7 ${G(a.at)}`}),o("div",{class:"md",html:fe(a.text)})));else{let c=o("div",{class:`msg user${a.held?" held":""}`},o("div",{class:"who",text:`${we(a)} \xB7 ${G(a.at)}${a.end?" \xB7 ended review":""}`}));for(let g of a.items||[])c.append(de(g,{held:!!a.held}));let d=ke(a);d&&c.append(d),u.append(c)}let r=m?t.transcript.filter(a=>a.held).length:0;if(r&&u.append(o("div",{class:"held-bar"},o("span",{text:`${r} held from teammates`}),o("button",{type:"button",class:"btn tiny primary",text:"Send all",onclick:()=>Y("release",t.transcript.filter(a=>a.held).map(a=>a.id))}),o("button",{type:"button",class:"btn tiny ghost",text:"Discard all",onclick:()=>Y("discard")}))),t.queue.length){let a=o("div",{class:"queued"},o("div",{class:"queued-head",text:`Queued \xB7 ${t.queue.length}`}));for(let c of t.queue){let d=de(c,{queued:!0});d.classList.add("q"),d.append(o("div",{class:"q-actions"},o("button",{type:"button",class:"btn tiny ghost",text:"Edit",onclick:()=>{t.editing=c.qid,p()}}),o("button",{type:"button",class:"btn tiny ghost",text:"Remove",onclick:()=>ge(c.qid)}))),a.append(d)}u.append(a)}if(t.closed)u.append(o("div",{class:"ended-note",text:m?"You closed this review.":"The owner closed this review."}));else if(t.status==="ended"){let a=t.endedBy==="agent"?"The agent ended this review.":m?"You ended this review.":"The owner ended this review.";u.append(o("div",{class:"ended-note",text:`${a} Notes you send now reach the agent the next time it polls.`}))}let i=t.transcript.length+t.queue.length;(e||n||i!==ce)&&(u.scrollTop=u.scrollHeight),ce=i,oe()}var H=!1;function oe(){let e=t.closed,n=t.queue.length;R.disabled=e||H||t.sending,l(".send").disabled=e||H||t.sending,l(".send-end")&&(l(".send-end").disabled=e||t.sending),l(".send").textContent=t.sending?"Sending\u2026":n?`Send ${n}`:"Send",R.placeholder=e?"Review closed":n?"Add a message (optional)\u2026":"Message the agent\u2026"}function Q(e){let n=l(".composer-error");n.textContent=e||"",n.hidden=!e}async function N(e=!1){if(t.sending||t.closed)return;let n=R.value.trim(),s=t.queue.map(({qid:r,...i})=>i);if(n&&s.push({kind:"message",text:n}),!s.length&&!e){R.focus();return}if(!(e&&!m)&&!(e&&!s.length&&!confirm("End this review? The agent will stop listening; notes you send later still reach it."))){if(h&&!v&&x){x.hidden=!1,l("input",x).focus();return}t.sending=!0,Q(""),oe();try{let r=await fetch(`${b}/send`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(h?{name:v,items:s}:{items:s,end:e})}),i=await r.json().catch(()=>({}));if(!r.ok)throw new Error(i.error||`HTTP ${r.status}`);t.queue=[],W(),R.value="";let a=i.entry;a&&!t.transcript.some(c=>c.id===a.id)&&t.transcript.push(a),h&&P()}catch(r){Q(`Not sent: ${r.message}. Your notes are still queued.`)}finally{t.sending=!1,p(!0),S()}}}l(".composer").addEventListener("submit",e=>{e.preventDefault(),N(!1)});l(".send-end")?.addEventListener("click",()=>N(!0));R.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),N(!1))});function I(e){t.mode=e==="explore"?"explore":"annotate",A.set("austere:mode",t.mode);for(let n of document.querySelectorAll(".seg button"))n.classList.toggle("on",n.dataset.mode===t.mode);C({type:"mode",mode:t.closed?"explore":t.mode})}for(let e of document.querySelectorAll(".seg button"))e.addEventListener("click",()=>I(e.dataset.mode));document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(e.key==="i"||e.key==="I")&&(e.preventDefault(),I(t.mode==="annotate"?"explore":"annotate"))});function E(){let e=l(".presence"),n,s;t.closed?[n,s]=["Review closed","ended"]:H?[n,s]=["Page removed","ended"]:t.connected?h?[n,s]=["Shared page","hosted"]:t.presence==="listening"?[n,s]=["Agent listening","listening"]:t.presence==="working"?[n,s]=["Agent working","working"]:t.status==="ended"?[n,s]=["Agent stopped","idle"]:[n,s]=["Agent not listening","idle"]:[n,s]=["Reconnecting\u2026","off"],s==="idle"&&t.unread&&(n+=` \xB7 ${t.unread} waiting`),e.className=`presence ${s}`,e.textContent=n,e.title=s==="idle"?"Your notes are kept and reach the agent the next time it polls.":s==="working"?"The agent has your last batch.":s==="hosted"?"Notes go to the page owner. Replies show up within 30 seconds.":"",document.documentElement.classList.toggle("is-ended",t.closed),m&&(l('[data-cmd="end"]').hidden=t.status==="ended",l('[data-cmd="close"]').hidden=t.closed,l('[data-cmd="reopen"]').hidden=!t.closed&&t.status!=="ended"),S()}function ie(){let e=l(".changes");if(e.setAttribute("aria-pressed",String(t.highlight)),!t.changes.length&&!t.highlight){e.hidden=!0;return}e.hidden=!1,e.textContent=`${t.changes.length} changed`,e.title=t.changes.length?`${t.highlight?"Hide":"Highlight"} what the last turn changed: ${t.changes.join(", ")}`:"The last turn changed nothing on the page. Click to stop highlighting."}function Z(e){C({type:"highlight",ids:t.highlight?t.changes:[],scroll:e})}l(".changes").addEventListener("click",()=>{t.highlight=!t.highlight,ie(),Z(t.highlight)});var J=l(".menu-pop");l(".menu-btn").addEventListener("click",e=>{e.stopPropagation(),J.hidden=!J.hidden});document.addEventListener("click",()=>J.hidden=!0);J.addEventListener("click",async e=>{let n=e.target instanceof Element?e.target.closest("[data-cmd]")?.dataset.cmd:void 0;if(n){if(n==="copy-path"&&navigator.clipboard?.writeText(y.file),n==="copy-link"&&navigator.clipboard?.writeText(t.links?.remote||location.href),n==="reload"&&se(),n==="end"){if(t.queue.length)return N(!0);if(!confirm("End this review? The agent will stop listening."))return;await fetch(`${b}/end`,{method:"POST"}).catch(()=>{})}if(n==="close"){if(!confirm("Close this review? No one can add notes until you reopen it."))return;await fetch(`${b}/close`,{method:"POST"}).catch(()=>{})}n==="reopen"&&await fetch(`${b}/reopen`,{method:"POST"}).catch(()=>{})}});var ae=()=>window.matchMedia("(max-width: 860px)").matches;function T(e){t.sheetOpen=e,q.set(`austere:sheet:${w}`,e),document.documentElement.classList.toggle("sheet-open",e),e&&setTimeout(()=>u.scrollTop=u.scrollHeight,50)}function S(){let e=l(".dock"),n=t.queue.length,s=["Conversation"];n&&s.push(`${n} queued`);let r=t.transcript[t.transcript.length-1];r?.role==="agent"&&r.at>(q.get(`austere:seen:${w}`)||0)&&s.push("new reply"),e.innerHTML=`<span class="dock-grip"></span><span>${B(s.join(" \xB7 "))}</span><span class="dock-presence ${B(l(".presence").className.replace("presence","").trim())}"></span>`}function xe(){let e=l(".dock");e.classList.remove("pulse"),e.offsetWidth,e.classList.add("pulse")}l(".dock").addEventListener("click",()=>{q.set(`austere:seen:${w}`,Date.now()),T(!0),S()});l(".sheet-close").addEventListener("click",()=>T(!1));l(".scrim").addEventListener("click",()=>T(!1));document.addEventListener("keydown",e=>{e.key==="Escape"&&t.sheetOpen&&ae()&&T(!1)});var $=null;l(".panel-head").addEventListener("touchstart",e=>$=e.touches[0].clientY,{passive:!0});l(".panel-head").addEventListener("touchend",e=>{$!=null&&e.changedTouches[0].clientY-$>60&&T(!1),$=null},{passive:!0});l(".dock").addEventListener("touchstart",e=>$=e.touches[0].clientY,{passive:!0});l(".dock").addEventListener("touchend",e=>{$!=null&&$-e.changedTouches[0].clientY>40&&T(!0),$=null},{passive:!0});function ee(e){let n=l(".notice");if(!e||!e.length){n.hidden=!0;return}n.textContent=`Third-party pack code runs in this page: check queued items before you send (${e.join(", ")}).`,n.title=n.textContent,n.hidden=!1}function L(e,n=[]){if(O.textContent="",!e){O.hidden=!0;return}O.append(o("span",{text:e}),...n),O.hidden=!1}function he(e){for(let n of e){let s=t.transcript.findIndex(r=>r.id===n.id);n.discarded?s>=0&&t.transcript.splice(s,1):s>=0?t.transcript[s]=n:t.transcript.push(n)}t.transcript.sort((n,s)=>n.at-s.at)}async function Ee(){let e=t.transcript[0];if(e)try{let n=await fetch(`${b}/transcript?before=${encodeURIComponent(e.id)}`);if(!n.ok)throw new Error(`HTTP ${n.status}`);let s=await n.json(),r=new Set(t.transcript.map(a=>a.id));t.transcript=[...(s.entries||[]).filter(a=>!a.discarded&&!r.has(a.id)),...t.transcript],t.more=!!s.more;let i=u.scrollHeight-u.scrollTop;p(),u.scrollTop=u.scrollHeight-i}catch(n){Q(`Could not load earlier messages: ${n.message}`)}}var ue=null,j=0;function $e(){ue=new EventSource(`${b}/events`);let e=ue;e.addEventListener("open",()=>{t.connected=!0,j=0,L(""),E()}),e.addEventListener("error",()=>{t.connected=!1,j||(j=Date.now()),E(),setTimeout(()=>{!t.connected&&Date.now()-j>3500&&L("Lost the austere-axi server. Run any austere-axi command to restart it; this page reconnects on its own.",[o("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})])},4e3)}),e.addEventListener("snapshot",n=>{let s=JSON.parse(n.data);t.transcript=(s.transcript||[]).filter(r=>!r.discarded),t.presence=s.presence,t.status=s.session.status,t.endedBy=s.session.endedBy,t.closed=!!s.session.closed,t.unread=s.session.unread||0,t.more=!!s.more,t.links=s.links,s.version&&s.version!==y.version&&L("austere-axi was updated. This page is running the previous version.",[o("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),ee(s.thirdPartyPacks),t.thirdParty=!!s.thirdPartyPacks?.length,t.program===null||s.revision===t.revision||s.program===t.program?(s.revision!==t.revision&&(t.errorsRevision=s.revision),t.revision=s.revision,z()):(t.revision=s.revision,t.parserErrors=[],t.runtimeErrors=[],t.renderReport=null),t.program===null?t.program=s.program:s.program!==t.program&&(t.program=s.program,t.frameReady&&C({type:"source",program:s.program})),E(),p(),I(t.mode)}),e.addEventListener("transcript",n=>{he(JSON.parse(n.data).entries||[]),p(),S()}),e.addEventListener("presence",n=>{let s=JSON.parse(n.data);t.presence=s.presence,t.status=s.status,t.endedBy=s.endedBy,t.closed=!!s.closed,t.unread=s.unread||0,I(t.mode),E(),p()}),e.addEventListener("changed",n=>{let s=JSON.parse(n.data);t.revision=s.revision,t.renderReport=null,t.parserErrors=[],t.runtimeErrors=[],ee(s.thirdPartyPacks),t.thirdParty=!!s.thirdPartyPacks?.length,s.shellChanged||!t.frameReady?(t.program=s.program,t.changes=[],ie(),se()):(t.program=s.program,C({type:"source",program:s.program})),p()}),e.addEventListener("ended",n=>{let s=JSON.parse(n.data);t.status="ended",t.endedBy=s.by,s.closed&&(t.closed=!0,C({type:"mode",mode:"explore"})),E(),p()}),e.addEventListener("server",n=>{let s=JSON.parse(n.data);if(s.state==="revoked"){e.close(),t.connected=!1,L("Your invite was revoked. Ask the owner for a new link.");return}s.state==="stopped"&&L("The austere-axi server stopped. Run any austere-axi command to start it again; this page reconnects on its own.")})}var Te=3e4,U=null,K=null,M=null,V=!1;function Se(e){let n=(e.notes||[]).map(r=>({id:`n${r.seq}`,role:"user",author:String(r.author||"").slice(0,_),items:Array.isArray(r.items)?r.items.filter(i=>!!i&&typeof i=="object"):[],at:r.at})),s=(e.replies||[]).map(r=>({id:`r${r.seq}`,role:"agent",text:String(r.text||""),at:r.at}));return[...n,...s]}async function P(){if(!H)return M?(V=!0,M):(M=(async()=>{try{let e=await fetch(`${b}/conversation${U==null?"":`?after=${encodeURIComponent(U)}`}`,{cache:"no-store"});if(e.status===404||e.status===410){H=!0,t.connected=!1,L("This page is no longer available."),E(),oe();return}if(!e.ok)throw new Error(`HTTP ${e.status}`);let n=await e.json();t.connected=!0,K==null?K=n.publishedAt:n.publishedAt!==K&&L("New version, reload",[o("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),n.cursor!=null&&(U=n.cursor),he(Se(n)),ee(n.thirdPartyPacks)}catch{t.connected=!1}finally{M=null,E(),p(),S()}V&&(V=!1,await P())})(),M)}function Le(){P(),setInterval(P,Te),window.addEventListener("focus",()=>P())}h||window.addEventListener("pagehide",e=>{e.persisted||navigator.sendBeacon?.(`${b}/bye`)});I(t.mode);ae()&&t.sheetOpen&&T(!0);E();p();S();se();h?Le():$e();})();
|