@invana/blocks 0.0.34 → 0.0.35

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/kinds.ts","../src/values.ts","../src/parts/actions.tsx","../src/prose.tsx","../src/blocks/activity.tsx","../src/blocks/bars.tsx","../src/parts/suggestion-chips.tsx","../src/blocks/cannot.tsx","../src/blocks/caveat.tsx","../src/format.ts","../src/blocks/citations.tsx","../src/parts/confirm-card.tsx","../src/parts/ask.tsx","../src/blocks/confirm.tsx","../src/blocks/files.tsx","../src/blocks/form.tsx","../src/blocks/gantt.tsx","../src/blocks/grid.tsx","../src/blocks/heatstrip.tsx","../src/blocks/method.tsx","../src/blocks/metric.tsx","../src/blocks/multi.tsx","../src/placeholder.tsx","../src/blocks/multistep.tsx","../src/blocks/narrative.tsx","../src/blocks/proposal.tsx","../src/blocks/quick.tsx","../src/blocks/ranked.tsx","../src/blocks/record.tsx","../src/blocks/scope.tsx","../src/blocks/single.tsx","../src/blocks/suggestions.tsx","../src/blocks/table.tsx","../src/blocks/timeline.tsx","../src/blocks/timeseries.tsx","../src/blocks/trace.tsx","../src/registry.ts","../src/stream/patch.ts","../src/stream/source.ts","../src/stream/use-stream.ts","../src/block.tsx","../src/page.tsx"],"names":["jsx","ClarifyActions","jsxs","React","Button","figure","React2","Fragment","cn","HeatLane","React3","PropertyList","PropertyRow","BarChartV","React4","Eyebrow","CannotAnswerCard","CaveatNote","React5","ChatSessionDisclosure","React6","CitationList","CitationRow","tone","React7","ClarifyFootnote","Kbd","QuestionnaireChoiceTitle","QuestionnaireChoiceDescription","ArtifactCard","Badge","ArtifactTable","React8","useForm","Form","ObjectField","React9","Gantt","MetricGrid","MetricTile","toRow","openKeys","React10","HeatStrip","React11","ChatSessionDisclosureCode","ChatSessionDisclosureSteps","Sparkline","React12","Questionnaire","QuestionnaireItem","QuestionnaireTitle","QuestionnaireDescription","QuestionnaireChoices","QuestionnaireChoice","QuestionnaireInput","React13","step","initial","QuestionnaireProgress","QuestionnaireActions","QuestionnairePrevious","QuestionnaireSkip","QuestionnaireNext","QuestionnaireSubmit","QuestionnaireProgressBar","CitationMarker","ProposalCard","React14","SegmentedControl","BarChartH","Avatar","AvatarFallback","ScopeLine","React15","DataTable","React16","TimelineSection","TimelineEntry","StatusDot","TimelineList","at","LineChart","React17","TraceList","TraceStep","React18","apply","stopPatches","React19","TypographyH3","TypographyMuted","SectionHeader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,EAAE,IAAI,SAAA,EAAW,IAAA,EAAM,WAAW,OAAA,EAAS,SAAA,EAAW,MAAM,OAAA,EAAQ;AAAA,EACpE,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,iBAAiB,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACxE,EAAE,IAAI,OAAA,EAAS,IAAA,EAAM,mBAAmB,OAAA,EAAS,UAAA,EAAY,MAAM,OAAA,EAAQ;AAAA,EAC3E,EAAE,IAAI,OAAA,EAAS,IAAA,EAAM,cAAc,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACpE,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,UAAU,OAAA,EAAS,mBAAA,EAAqB,MAAM,OAAA,EAAQ;AAAA,EAC5E,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,UAAU,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACjE,EAAE,IAAI,OAAA,EAAS,IAAA,EAAM,cAAc,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACpE,EAAE,IAAI,MAAA,EAAQ,IAAA,EAAM,aAAa,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EAClE,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,eAAe,OAAA,EAAS,MAAA,E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,EAAA;AAAA,IAAA,IAAA,CAAK,wBAAQF,cAAAA,CAAC0F,eAAA,EAAA,EAAc,QAAA,EAAA,IAAA,CAAK,OAAM,CAAA,GAAkB,IAAA;AAAA,IACzD,KAAK,WAAA,mBAAc1F,eAAC2F,kBAAA,EAAA,EAAiB,QAAA,EAAA,IAAA,CAAK,aAAY,CAAA,GAAqB;AAAA,GAAA,EAC9E,CAAA,GACE,IAAA;AAAA,EACH,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,EAAS,sBAC3BzF,eAAAA,CAAC,SAAA,EAAA,EAAgB,SAAA,EAAU,6BAAA,EACxB,QAAA,EAAA;AAAA,IAAA,OAAA,CAAQ,wBAAQF,cAAAA,CAAC4F,oBAAc,KAAA,EAAO,OAAA,CAAQ,OAAO,CAAA,GAAK,IAAA;AAAA,IAC1D,QAAQ,WAAA,mBAAc5F,eAAC2F,kBAAA,EAAA,EAAiB,QAAA,EAAA,OAAA,CAAQ,aAAY,CAAA,GAAqB,IAAA;AAAA,IACjF,QAAQ,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,EAAO,sBAC1B3F,cAAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QAEC,IAAA,EAAM,KAAA;AAAA,QACN,QAAA,EACE,WACI,CAAC,MAAA,EAAQ,UACP,QAAA,CAAS,MAAA,EAAQ,KAAA,KAAU,MAAA,GAAY,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,KAAM,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,EAAG,KAAA,EAAO,CAAA,GACnG;AAAA,OAAA;AAAA,MAND;AAAA,KASR;AAAA,GAAA,EAAA,EAdW,CAed,CACD;AAAA,CAAA,EACH,CACD;AACD,IAAA,CAAK,WAAA,GAAc,MAAA","file":"index.cjs","sourcesContent":["// Ids follow the Design Kit Spec (https://claude.ai/artifact/VcN3AYgmbdCpHbxXZjMir5).\n// Do not edit by hand: change the spec first, then copy the ids here.\n// The block registry is keyed by these kinds, so a kind without an entry does not compile.\n\n/**\n * Every block, by kind. A block that returns a value names its type in\n * `returns` (as the spec writes it) and is what an ask turn holds; the rest\n * only show data and are what an answer turn holds. Both are blocks.\n */\nexport const BLOCKS = [\n { id: \"confirm\", name: \"Confirm\", returns: \"boolean\", tier: \"today\" },\n { id: \"single\", name: \"Single choice\", returns: \"string\", tier: \"today\" },\n { id: \"multi\", name: \"Multiple choice\", returns: \"string[]\", tier: \"today\" },\n { id: \"quick\", name: \"Quick pick\", returns: \"string\", tier: \"today\" },\n { id: \"period\", name: \"Period\", returns: \"{from, to, label}\", tier: \"today\" },\n { id: \"number\", name: \"Number\", returns: \"number\", tier: \"today\" },\n { id: \"short\", name: \"Short text\", returns: \"string\", tier: \"today\" },\n { id: \"long\", name: \"Long text\", returns: \"string\", tier: \"today\" },\n { id: \"entity\", name: \"Entity pick\", returns: \"id[]\", tier: \"next\" },\n { id: \"scale\", name: \"Scale\", returns: \"1–5\", tier: \"today\" },\n { id: \"multistep\", name: \"Multi-step\", returns: \"Record<id, value>\", tier: \"today\" },\n { id: \"form\", name: \"Form\", returns: \"Record<field, value>\", tier: \"next\" },\n { id: \"weights\", name: \"Weights\", returns: \"Record<objective, 0–100>\", tier: \"today\" },\n { id: \"approval\", name: \"Approval\", returns: \"approve | reject\", tier: \"today\" },\n { id: \"interpretation\", name: \"Interpretation\", returns: \"Record<slot, value>\", tier: \"today\" },\n { id: \"fork\", name: \"Reading fork\", returns: \"readingId\", tier: \"next\" },\n { id: \"plan\", name: \"Plan preview\", returns: \"stepId[]\", tier: \"next\" },\n { id: \"modelspec\", name: \"Model spec\", returns: \"{outcome, predictors[], group?, controls[]}\", tier: \"next\" },\n { id: \"hypothesis\", name: \"Hypothesis\", returns: \"{test, tails, alpha}\", tier: \"next\" },\n { id: \"range\", name: \"Range\", returns: \"{min, max}\", tier: \"next\" },\n { id: \"suggestions\", name: \"Suggestions\", returns: \"string\", tier: \"today\" },\n { id: \"narrative\", name: \"Narrative\", tier: \"today\" },\n { id: \"metric\", name: \"Metric\", tier: \"today\" },\n { id: \"grid\", name: \"Metric grid\", tier: \"today\" },\n { id: \"table\", name: \"Table preview\", tier: \"today\" },\n { id: \"attr\", name: \"Attribute matrix\", tier: \"today\" },\n { id: \"record\", name: \"Record\", tier: \"today\" },\n { id: \"ranked\", name: \"Ranked list\", tier: \"today\" },\n { id: \"timeseries\", name: \"Time series\", tier: \"today\" },\n { id: \"bars\", name: \"Bar comparison\", tier: \"next\" },\n { id: \"waterfall\", name: \"Bridge\", tier: \"next\" },\n { id: \"matrix\", name: \"Matrix\", tier: \"next\" },\n { id: \"funnel\", name: \"Funnel\", tier: \"next\" },\n { id: \"histogram\", name: \"Distribution\", tier: \"next\" },\n { id: \"timeline\", name: \"Timeline\", tier: \"today\" },\n { id: \"subgraph\", name: \"Subgraph\", tier: \"later\" },\n { id: \"method\", name: \"Method\", tier: \"today\" },\n { id: \"citations\", name: \"Citations\", tier: \"today\" },\n { id: \"files\", name: \"Files\", tier: \"today\" },\n { id: \"proposal\", name: \"Proposal\", tier: \"today\" },\n { id: \"cannot\", name: \"Cannot answer\", tier: \"today\" },\n { id: \"caveat\", name: \"Caveat\", tier: \"today\" },\n { id: \"scope\", name: \"Scope line\", tier: \"today\" },\n { id: \"checks\", name: \"Checks\", tier: \"next\" },\n { id: \"trace\", name: \"Progress trace\", tier: \"today\" },\n { id: \"activity\", name: \"Layer activity\", tier: \"today\" },\n { id: \"gantt\", name: \"Task timeline\", tier: \"today\" },\n { id: \"heatstrip\", name: \"Heat strip\", tier: \"today\" },\n { id: \"test\", name: \"Test result\", tier: \"next\" },\n { id: \"coef\", name: \"Coefficients\", tier: \"next\" },\n { id: \"forest\", name: \"Forest plot\", tier: \"next\" },\n { id: \"scatter\", name: \"Scatter\", tier: \"next\" },\n { id: \"box\", name: \"Box plot\", tier: \"next\" },\n { id: \"correlation\", name: \"Correlation\", tier: \"next\" },\n { id: \"control\", name: \"Control chart\", tier: \"next\" },\n { id: \"pareto\", name: \"Pareto\", tier: \"next\" },\n { id: \"survival\", name: \"Survival curve\", tier: \"next\" },\n { id: \"tornado\", name: \"Tornado\", tier: \"next\" },\n { id: \"decomposition\", name: \"Decomposition\", tier: \"next\" },\n { id: \"modeleval\", name: \"Model evaluation\", tier: \"next\" },\n { id: \"pivot\", name: \"Pivot\", tier: \"next\" },\n { id: \"profile\", name: \"Column profile\", tier: \"next\" },\n { id: \"evidence\", name: \"Evidence strength\", tier: \"next\" },\n { id: \"dumbbell\", name: \"Dumbbell\", tier: \"next\" },\n { id: \"quantiles\", name: \"Quantiles\", tier: \"today\" },\n] as const\n\ntype Block = (typeof BLOCKS)[number]\n\n/** Every block's kind. */\nexport type BlockKind = Block[\"id\"]\n/** The kinds an ask turn can hold: the blocks that return a value. */\nexport type AskKind = Extract<Block, { returns: string }>[\"id\"]\n/** The kinds an answer turn can hold: the blocks that only show data. */\nexport type AnswerKind = Exclude<BlockKind, AskKind>\n\n/** The blocks that return a value, and those that only show data. */\nexport const ASK_KINDS: readonly AskKind[] = BLOCKS.filter((b): b is Extract<Block, { returns: string }> => \"returns\" in b).map((b) => b.id)\nexport const ANSWER_KINDS: readonly AnswerKind[] = BLOCKS.filter((b) => !(\"returns\" in b)).map((b) => b.id as AnswerKind)\n","// Ids follow the Design Kit Spec (https://claude.ai/artifact/VcN3AYgmbdCpHbxXZjMir5).\n// Do not edit by hand: change the spec first, then copy the ids here.\n// Value types are how a block writes a figure, so they live with the blocks.\n\n/**\n * Value types: every figure an answer shows is one of these, written one way\n * by `formatValue`. The unit vocabulary inside `quantity` is open.\n */\nexport const VALUE_TYPES = [\n { id: \"quantity\", name: \"Quantity with unit\", example: \"2,480 kg/ha · 26 d\" },\n { id: \"currency\", name: \"Currency\", example: \"£84k · −£620k · £4.1M\" },\n { id: \"percent\", name: \"Share\", example: \"76% · 8.2%\" },\n { id: \"pp\", name: \"Percentage points\", example: \"+4.8 pts · ▼ 1.8 pts\" },\n { id: \"bp\", name: \"Basis points\", example: \"+12 bp\" },\n { id: \"ratio\", name: \"Ratio or index\", example: \"OR 1.29 · beta 0.38 · 1.3×\" },\n { id: \"rate\", name: \"Rate per N\", example: \"8.2 per 100 discharges\" },\n { id: \"count\", name: \"Count with n\", example: \"1,284 plots · n = 1,061\" },\n { id: \"duration\", name: \"Duration\", example: \"1.2 s · 3 min · 26 d\" },\n { id: \"estimate\", name: \"Estimate with interval\", example: \"1.29 (95% CI 1.04–1.60)\" },\n { id: \"pvalue\", name: \"p-value\", example: \"p = 0.02 · p < 0.001\" },\n { id: \"score\", name: \"Ordinal score\", example: \"7 / 9 · 4 of 5\" },\n { id: \"time\", name: \"Point in time\", example: \"as of 29 Sep 06:00 · Q3 2026\" },\n] as const\n\nexport type ValueTypeId = (typeof VALUE_TYPES)[number][\"id\"]\n","import * as React from \"react\"\nimport { Button, type ButtonProps } from \"@invana/ui\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport type { ActionOption } from \"../types\"\n\nconst VARIANT: Record<NonNullable<ActionOption[\"variant\"]>, ButtonProps[\"variant\"]> = {\n primary: \"default\",\n secondary: \"outline\",\n ghost: \"ghost\",\n link: \"link\",\n}\n\n/**\n * The actions under a block, in the order given; the first with `push` starts\n * the group at the far end. Each is sent as an `action` event.\n */\nexport function ActionRow({\n actions,\n onAction,\n}: {\n actions: ActionOption[]\n onAction: (id: string) => void\n}) {\n return (\n <ClarifyActions className=\"w-full\">\n {actions.map((a) => (\n <React.Fragment key={a.id}>\n {a.push ? <span aria-hidden className=\"flex-1\" /> : null}\n <Button\n size=\"xs\"\n variant={VARIANT[a.variant ?? \"secondary\"]}\n onClick={() => onAction(a.id)}\n >\n {a.label}\n </Button>\n </React.Fragment>\n ))}\n </ClarifyActions>\n )\n}\n","import * as React from \"react\"\n\n/**\n * `**…**` spans as strong, the rest as text. The only markup the grammar\n * allows in prose: the figure the sentence leads with, or what yes will cost.\n */\nexport function strong(text: string): React.ReactNode[] {\n return text\n .split(/(\\*\\*[^*]+\\*\\*)/)\n .filter(Boolean)\n .map((part, i) =>\n part.startsWith(\"**\") && part.endsWith(\"**\") ? (\n <strong key={i}>{part.slice(2, -2)}</strong>\n ) : (\n part\n ),\n )\n}\n\nconst DIRECTION = /([▲▼]\\s?[+−-]?[\\d.,]+(?:\\s?(?:pts|pp|bps|%))?)/\nconst MARKER = /(\\[\\d+\\])/\n\nfunction tone(figure: string) {\n return figure.startsWith(\"▲\") ? \"text-primary\" : \"text-destructive\"\n}\n\n/**\n * Prose as an answer writes it: `**…**` a figure, `[n]` the marker for source\n * n where the clause it backs ends, and a figure led by `▲` or `▼` in the tone\n * of its direction — the arrow is the direction, so the colour follows it.\n */\nexport function prose(text: string, marker: (n: number) => React.ReactNode): React.ReactNode[] {\n let key = 0\n const plain = (part: string): React.ReactNode[] =>\n part\n .split(MARKER)\n .filter(Boolean)\n .flatMap((piece): React.ReactNode[] => {\n const cite = piece.match(/^\\[(\\d+)\\]$/)\n if (cite) return [<React.Fragment key={key++}>{marker(Number(cite[1]))}</React.Fragment>]\n return piece\n .split(DIRECTION)\n .filter(Boolean)\n .map((bit) =>\n DIRECTION.test(bit) && /^[▲▼]/.test(bit) ? (\n <span key={key++} className={tone(bit)}>\n {bit}\n </span>\n ) : (\n <React.Fragment key={key++}>{bit}</React.Fragment>\n ),\n )\n })\n return text\n .split(/(\\*\\*[^*]+\\*\\*)/)\n .filter(Boolean)\n .flatMap((part): React.ReactNode[] => {\n if (!(part.startsWith(\"**\") && part.endsWith(\"**\"))) return plain(part)\n const figure = part.slice(2, -2)\n return [\n <strong key={key++} className={/^[▲▼]/.test(figure) ? tone(figure) : undefined}>\n {figure}\n </strong>,\n ]\n })\n}\n","import * as React from \"react\"\nimport { HeatLane } from \"@invana/charts\"\nimport { Button, cn, PropertyList, PropertyRow } from \"@invana/ui\"\n\nimport { ActionRow } from \"../parts/actions\"\nimport { strong } from \"../prose\"\nimport type { ActivityLane, BlockProps } from \"../types\"\n\nconst RATE_TONE = { hot: \"text-info\", bad: \"text-destructive\" } as const\n\n/** A lane is lit when anything in it was busy. */\nconst lit = (lane: ActivityLane) => lane.cells.some((v) => v != null && v > 0)\n\ninterface Pin {\n lane: string\n at: number\n}\n\nfunction LaneRow({\n lane,\n depth,\n open,\n onToggle,\n stale,\n cell,\n pin,\n onPin,\n}: {\n lane: ActivityLane\n depth: number\n open: boolean\n onToggle?: () => void\n stale: boolean\n cell?: string\n pin: Pin | null\n onPin: (pin: Pin | null) => void\n}) {\n const name = (\n <>\n <span className=\"truncate @max-[300px]/activity:hidden\">{lane.label}</span>\n <span className=\"truncate @min-[301px]/activity:hidden\">{lane.short ?? lane.label}</span>\n </>\n )\n return (\n <>\n {onToggle ? (\n <button\n type=\"button\"\n aria-expanded={open}\n onClick={onToggle}\n className=\"flex min-w-0 items-center gap-1 text-left hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n >\n <span aria-hidden className=\"w-2.5 shrink-0 text-muted-foreground\">\n {open ? \"▾\" : \"▸\"}\n </span>\n {name}\n </button>\n ) : (\n <span\n className={cn(\n \"flex min-w-0 items-center\",\n (lane.off || depth > 0) && \"text-muted-foreground\",\n depth > 0 && \"pl-3.5 text-sm\",\n )}\n >\n {name}\n </span>\n )}\n <HeatLane\n aria-label={lane.label}\n values={lane.off ? lane.cells.map(() => null) : lane.cells}\n marks={lane.marks}\n stale={stale}\n cellLabel={cell ? (i) => `${lane.label} · cell ${i + 1} · ${cell}` : undefined}\n pinned={pin?.lane === lane.id ? pin.at : null}\n onPin={stale ? undefined : (at) => onPin(at == null ? null : { lane: lane.id, at })}\n />\n <span\n className={cn(\n \"truncate text-right font-mono text-sm text-muted-foreground tabular-nums\",\n !stale && lane.rateTone && RATE_TONE[lane.rateTone],\n )}\n >\n {stale ? \"—\" : lane.rate}\n </span>\n </>\n )\n}\n\n/**\n * Which layers a run kept busy, and when: one lane per layer — graph, models,\n * skills, the LLM, third parties, the cache — over a shared axis, brighter\n * where it was busier, its rate at the right, the run's steps banded above.\n *\n * Live, it follows the last seconds; settled, it is the whole run. A layer\n * opens into its parts; a lit cell pins, and the operation behind it is\n * recorded under the lanes. A refusal and a crossing of the boundary are\n * marked in their cell. When the signal stops the lanes are dimmed, not\n * cooled: silence is not calm. Under 300px of its own width it switches to\n * short labels.\n */\nexport function ActivityBlock({ spec, onAction }: BlockProps<\"activity\">) {\n const stale = spec.state === \"stale\"\n const [opened, setOpened] = React.useState<Set<string>>(\n () => new Set(spec.lanes.filter((l) => l.open).map((l) => l.id)),\n )\n const [pin, setPin] = React.useState<Pin | null>(\n spec.pinned ? { lane: spec.pinned.lane, at: spec.pinned.at } : null,\n )\n const toggle = (id: string) =>\n setOpened((s) => {\n const next = new Set(s)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n return next\n })\n const pinCell = (next: Pin | null) => {\n setPin(next)\n if (next) onAction?.(\"pin\", next)\n }\n const record = spec.pinned && pin && spec.pinned.lane === pin.lane && spec.pinned.at === pin.at ? spec.pinned : null\n const total = spec.lanes.length\n const lighted = spec.lanes.filter(lit).length\n\n return (\n <div className=\"@container/activity flex min-w-0 flex-col gap-2\">\n <div className=\"grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)_minmax(2.5rem,auto)] items-center gap-x-2 gap-y-1.5 @max-[300px]/activity:grid-cols-[4rem_minmax(0,1fr)_minmax(1.5rem,auto)]\">\n {spec.bands?.length ? (\n <>\n <span />\n <div className=\"flex min-w-0 gap-px text-xs\">\n {spec.bands.map((b, i) => (\n <span\n key={i}\n style={{ flex: b.span }}\n className={cn(\n \"min-w-0 truncate rounded-[2px] px-1\",\n b.current ? \"bg-info/15 text-foreground\" : \"bg-muted text-muted-foreground\",\n )}\n >\n {b.label}\n </span>\n ))}\n </div>\n <span className=\"text-right text-xs text-muted-foreground\">{spec.state === \"live\" ? \"now\" : \"\"}</span>\n </>\n ) : null}\n {spec.lanes.map((lane) => {\n const open = opened.has(lane.id)\n const kids = lane.children?.length ? lane.children : null\n return (\n <React.Fragment key={lane.id}>\n <LaneRow\n lane={lane}\n depth={0}\n open={open}\n onToggle={kids ? () => toggle(lane.id) : undefined}\n stale={stale}\n cell={spec.cell}\n pin={pin}\n onPin={pinCell}\n />\n {open && kids\n ? kids.map((child) => (\n <LaneRow\n key={child.id}\n lane={child}\n depth={1}\n open={false}\n stale={stale}\n cell={spec.cell}\n pin={pin}\n onPin={pinCell}\n />\n ))\n : null}\n </React.Fragment>\n )\n })}\n {spec.axis?.length ? (\n <>\n <span />\n <div className=\"flex min-w-0 justify-between text-xs text-muted-foreground tabular-nums\">\n {spec.axis.map((a, i) => (\n <span key={i}>{a}</span>\n ))}\n </div>\n <span />\n </>\n ) : null}\n </div>\n\n {record ? (\n <div className=\"flex flex-col gap-1.5 rounded-control border border-border bg-muted/40 p-2\">\n <div className=\"flex min-w-0 items-baseline gap-2\">\n <span className=\"min-w-0 flex-1 truncate font-medium\">{record.title}</span>\n {record.time ? <span className=\"shrink-0 font-mono text-sm text-muted-foreground\">{record.time}</span> : null}\n </div>\n {record.query ? <code className=\"truncate font-mono text-sm\">{record.query}</code> : null}\n {record.rows?.length ? (\n <PropertyList>\n {record.rows.map((r) => (\n <PropertyRow key={r.label} label={r.label}>\n {r.value}\n </PropertyRow>\n ))}\n </PropertyList>\n ) : null}\n {record.note || record.action ? (\n <div className=\"flex min-w-0 items-center gap-2 text-sm text-muted-foreground\">\n <span className=\"min-w-0 flex-1 truncate\">{record.note}</span>\n {record.action ? (\n <Button\n variant=\"link\"\n size=\"xs\"\n className=\"h-auto p-0\"\n onClick={() => onAction?.(\"action\", record.action!.id)}\n >\n {record.action.label}\n </Button>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {spec.legend ? (\n <div className=\"flex flex-wrap gap-3 text-sm text-muted-foreground\">\n <span className=\"flex items-center gap-1.5\"><i aria-hidden className=\"size-2 rounded-[1px] bg-info\" />touched</span>\n <span className=\"flex items-center gap-1.5\"><i aria-hidden className=\"size-2 rounded-[1px] bg-destructive\" />refused</span>\n <span className=\"flex items-center gap-1.5\"><i aria-hidden className=\"size-2 rounded-[1px] bg-warning\" />left the boundary</span>\n </div>\n ) : null}\n\n {spec.hint ? (\n <p className={cn(\"text-sm text-muted-foreground\", stale && \"text-warning\")}>{strong(spec.hint)}</p>\n ) : null}\n\n {spec.actions?.length ? (\n <div className=\"flex min-w-0 items-center gap-2 border-t border-border pt-1.5 text-sm text-muted-foreground\">\n <span className=\"shrink-0 tabular-nums\">\n {total} layers · {lighted} lit\n </span>\n <ActionRow actions={spec.actions} onAction={(id) => onAction?.(\"action\", id)} />\n </div>\n ) : null}\n </div>\n )\n}\n","import { BarChartV } from \"@invana/charts\"\n\nimport type { BlockProps } from \"../types\"\n\n\n/** Places after the point, so a column of `6.1, 6.0` is not written `6.1, 6`. */\nconst decimals = (v: number) => (String(v).split(\".\")[1] ?? \"\").length\n\n/** A series drawn as the comparison — last quarter behind this one. */\nconst MUTED = \"color-mix(in srgb, var(--color-muted-foreground) 45%, transparent)\"\n\n/**\n * Groups compared as columns. Two or more series sit side by side in each group\n * with a legend, a muted one drawn as the comparison, against a dashed target.\n * One series is drawn muted with the called-out group in primary and its value\n * on the cap. A plan per group is a dashed column each actual stands inside.\n */\nexport function BarsBlock({ spec }: BlockProps<\"bars\">) {\n const single = spec.series.length === 1\n const places = Math.max(0, ...spec.series.flatMap((s) => s.values.map(decimals)))\n // A percent sign travels with the figure; any other unit is named once, in the header.\n const write = (v: number) =>\n v.toLocaleString(\"en-GB\", { minimumFractionDigits: places, maximumFractionDigits: places }) +\n (spec.unit === \"%\" ? \"%\" : \"\")\n const highlight = spec.highlight == null ? -1 : spec.groups.indexOf(spec.highlight)\n const called = single && highlight >= 0\n return (\n <BarChartV\n aria-label={spec.series.map((s) => s.name).join(\", \") + (spec.unit ? `, ${spec.unit}` : \"\")}\n variant=\"comparison\"\n height={80}\n labelMode={called ? \"last\" : \"none\"}\n color={called ? \"var(--color-muted-foreground)\" : \"var(--color-primary)\"}\n highlightColor=\"var(--color-primary)\"\n highlightIndex={called ? highlight : null}\n target={spec.target ? { ...spec.target, color: \"var(--color-warning)\" } : undefined}\n planLabel={spec.plan?.name}\n series={\n single && !spec.plan\n ? undefined\n : spec.series.map((s) => ({\n name: s.name,\n color: s.muted ? MUTED : \"var(--color-primary)\",\n }))\n }\n data={spec.groups.map((label, i) =>\n single\n ? {\n label,\n value: spec.series[0]!.values[i] ?? 0,\n display: write(spec.series[0]!.values[i] ?? 0),\n plan: spec.plan?.values[i],\n }\n : {\n label,\n values: spec.series.map((s) => s.values[i] ?? 0),\n display: spec.series.map((s) => write(s.values[i] ?? 0)),\n },\n )}\n />\n )\n}\n","import * as React from \"react\"\nimport { Button, Eyebrow, cn } from \"@invana/ui\"\n\nexport interface SuggestionChipsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Two to four follow-ups, each a whole prompt — `Compare with Q3 last year`. */\n items?: string[]\n /** Follow-ups under a heading each — `Go deeper`, `Act` — in place of `items`. */\n groups?: { label: React.ReactNode; items: string[] }[]\n /**\n * `wrap` (the default) runs the chips along a line; `stack` puts one per\n * line, full width. A narrow thread stacks them either way.\n */\n layout?: \"wrap\" | \"stack\"\n /** A line above the chips that says what they are — `I can answer instead`. */\n lead?: React.ReactNode\n /** Follow-ups already sent from here. They stay where they were, dimmed and disabled. */\n sent?: string[]\n /** A follow-up was picked; it goes out as the next prompt. */\n onSelect?: (text: string) => void\n}\n\nfunction Chips({\n items,\n layout,\n sent,\n onSelect,\n}: Pick<SuggestionChipsProps, \"layout\" | \"sent\" | \"onSelect\"> & { items: string[] }) {\n const stack = layout === \"stack\"\n return (\n <div\n className={cn(\n \"flex gap-1.5\",\n stack ? \"flex-col\" : \"flex-wrap @max-[22rem]:flex-col\",\n )}\n >\n {items.map((text) => {\n const done = sent?.includes(text)\n return (\n <Button\n key={text}\n type=\"button\"\n size=\"xs\"\n variant=\"outline\"\n disabled={done}\n className={cn(\n // A follow-up is a whole prompt and can outrun the line: it wraps\n // within the thread rather than running past it.\n \"h-auto min-h-control-xs max-w-full items-start whitespace-normal py-0.5 text-left font-normal\",\n stack\n ? \"w-full justify-start\"\n : \"rounded-full @max-[22rem]:w-full @max-[22rem]:justify-start @max-[22rem]:rounded-control\",\n )}\n onClick={() => onSelect?.(text)}\n >\n <span aria-hidden className=\"text-muted-foreground\">\n ↳\n </span>\n {text}\n </Button>\n )\n })}\n </div>\n )\n}\n\n/**\n * What to ask next, under an answer. Each chip is a whole prompt that reuses\n * the current scope, so picking one sends it as it reads — nothing to fill in.\n */\nexport const SuggestionChips = React.forwardRef<HTMLDivElement, SuggestionChipsProps>(\n ({ items, groups, layout, sent, lead, onSelect, className, ...props }, ref) => (\n <div ref={ref} className={cn(\"@container flex flex-col gap-1.5\", className)} {...props}>\n {lead != null ? <p className=\"text-xs text-muted-foreground\">{lead}</p> : null}\n {groups?.length\n ? groups.map((group, i) => (\n <React.Fragment key={i}>\n <Eyebrow>{group.label}</Eyebrow>\n <Chips items={group.items} layout={layout} sent={sent} onSelect={onSelect} />\n </React.Fragment>\n ))\n : items?.length\n ? <Chips items={items} layout={layout} sent={sent} onSelect={onSelect} />\n : null}\n </div>\n ),\n)\nSuggestionChips.displayName = \"SuggestionChips\"\n","import { CannotAnswerCard } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { SuggestionChips } from \"../parts/suggestion-chips\"\n\n/**\n * What the data does not hold, and what would change the answer — then the\n * nearby questions it can answer, each sent as a new prompt. Answered in\n * part, the card says which part is missing, above the answer for the rest.\n */\nexport function CannotBlock({ spec, onAction }: BlockProps<\"cannot\">) {\n return (\n <>\n <CannotAnswerCard\n remedy={spec.remedy}\n label={spec.partial ? \"answered in part\" : undefined}\n tone={spec.partial ? \"info\" : \"default\"}\n >\n {spec.reason}\n </CannotAnswerCard>\n {spec.nearest?.length ? (\n <SuggestionChips\n lead=\"I can answer instead\"\n items={spec.nearest}\n onSelect={(text) => onAction?.(\"prompt\", text)}\n />\n ) : null}\n </>\n )\n}\n","import * as React from \"react\"\nimport { CaveatNote } from \"@invana/ui\"\n\nimport { ChatSessionDisclosure } from \"@invana/ui\"\nimport type { BlockProps, CaveatNoteOptions, CaveatTone } from \"../types\"\n\nconst TONE: Record<CaveatTone, \"warning\" | \"info\" | \"destructive\"> = {\n warning: \"warning\",\n info: \"info\",\n bad: \"destructive\",\n}\n\nfunction Note({\n note,\n onAction,\n}: {\n note: CaveatNoteOptions\n onAction: (id: string) => void\n}) {\n return (\n <CaveatNote\n label={note.label}\n tone={TONE[note.tone ?? \"warning\"]}\n action={note.action?.label}\n onAction={note.action ? () => onAction(note.action!.id) : undefined}\n >\n {note.text}\n </CaveatNote>\n )\n}\n\n/**\n * What was excluded, imputed or assumed, and how far to trust the figure. A\n * caveat with the rows behind it links to them; several can fold behind one\n * line that names their kinds.\n */\nexport function CaveatBlock({ spec, onAction }: BlockProps<\"caveat\">) {\n const [open, setOpen] = React.useState(!spec.folded)\n const act = (id: string) => onAction?.(\"action\", id)\n if (!spec.items) return <Note note={spec} onAction={act} />\n const notes = spec.items.map((note, i) => <Note key={i} note={note} onAction={act} />)\n if (!spec.folded) return <>{notes}</>\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={`${spec.items.length} caveats`}\n meta={open ? undefined : spec.items.map((n) => n.label).join(\" · \")}\n open={open}\n onOpenChange={setOpen}\n >\n <>{notes}</>\n </ChatSessionDisclosure>\n )\n}\n","import type { MetricTone } from \"@invana/ui\"\n\nimport type { Figure, MetricOptions, Tone } from \"./types\"\n\n/**\n * A figure as text. A string arrives already written; a number or a typed\n * value is written here, plainly, until `formatValue` lands in `@invana/ui`.\n */\nexport function figureText(figure: Figure): string {\n if (typeof figure === \"string\") return figure\n if (typeof figure === \"number\") return figure.toLocaleString(\"en-GB\")\n const n = figure.value.toLocaleString(\"en-GB\")\n return figure.unit ? `${n} ${figure.unit}` : n\n}\n\n/** A figure's value, or a muted dash when there is none to give. */\nexport function metricValue(value: MetricOptions[\"value\"]) {\n return value == null ? \"—\" : figureText(value)\n}\n\n/** The tones, as a caption's. `neutral` leaves it muted. */\nexport const CAPTION_TONE: Record<Tone, MetricTone | undefined> = {\n good: \"success\",\n bad: \"error\",\n warn: \"warning\",\n neutral: undefined,\n}\n\n/** The tones, as a `Badge`'s. */\nexport const BADGE_TONE: Record<Tone, \"success\" | \"destructive\" | \"warning\" | \"muted\"> = {\n good: \"success\",\n bad: \"destructive\",\n warn: \"warning\",\n neutral: \"muted\",\n}\n\n/**\n * A metric's gauge as the tile draws it: shares of the scale, and its ends and\n * target written in `unit` — or, with no target, a plain meter.\n */\nexport function gaugeProps(gauge: MetricOptions[\"gauge\"]) {\n if (!gauge) return {}\n const min = gauge.min ?? 0\n const span = gauge.max - min || 1\n const fill = (gauge.value - min) / span\n if (gauge.target == null) return { meter: fill }\n const write = (n: number) => `${n.toLocaleString(\"en-GB\")}${gauge.unit ?? \"\"}`\n return {\n gauge: {\n fill,\n mark: (gauge.target - min) / span,\n labels: [write(min), `target ${write(gauge.target)}`, write(gauge.max)] as [string, string, string],\n },\n }\n}\n","import * as React from \"react\"\nimport { CitationList, CitationRow } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ChatSessionDisclosure } from \"@invana/ui\"\nimport { figureText } from \"../format\"\n\n/**\n * The sources an answer rests on, numbered as its markers cite them, with\n * record counts at the right and what kind of source each is, and how fresh,\n * under it. The row a marker in the prose points at is lit, when the shell tracks it. Folded, one line\n * says how many sources and records; a source with no records is said out loud.\n */\nexport interface CitationsBlockProps extends BlockProps<\"citations\"> {\n /** The source the reader is on, when the shell tracks it. Defaults to the spec's `active`. */\n active?: number\n}\n\nexport function CitationsBlock({ spec, active = spec.active }: CitationsBlockProps) {\n const [open, setOpen] = React.useState(!spec.folded)\n const counts = spec.sources.map((s) => s.count)\n const total = counts.every((c) => typeof c === \"number\")\n ? (counts as number[]).reduce((a, b) => a + b, 0)\n : undefined\n\n const list = (\n <CitationList note={spec.note} noteTone={total === 0 ? \"warning\" : \"muted\"}>\n {spec.sources.map((source, i) => (\n <CitationRow\n key={i}\n marker={i + 1}\n active={active === i + 1}\n detail={source.detail}\n count={source.count == null ? undefined : figureText(source.count)}\n >\n {source.label}\n </CitationRow>\n ))}\n </CitationList>\n )\n if (!spec.folded) return list\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={`${spec.sources.length} sources`}\n meta={total != null ? `${total.toLocaleString(\"en-GB\")} records` : undefined}\n open={open}\n onOpenChange={setOpen}\n >\n {list}\n </ChatSessionDisclosure>\n )\n}\n","import * as React from \"react\"\nimport { cn } from \"@invana/ui\"\n\nimport { ClarifyActions, ClarifyFootnote } from \"@invana/ui\"\n\nexport interface ConfirmCost {\n /** What it measures — `rows scanned`, `time`, `records written`. */\n label: React.ReactNode\n /**\n * The figure, already written — `2.3B`, `about 40 s`, `0`. A string is\n * drawn whole as the figure; pass nodes to mark only part of it.\n */\n value: React.ReactNode\n /** `warning` for the cost that changes something — records it will write. */\n tone?: \"warning\"\n}\n\nexport interface ConfirmCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** What yes does, in one sentence — or a short heading over a `description`. */\n question: React.ReactNode\n /** A muted line under the question; makes the question a heading. */\n description?: React.ReactNode\n /** Set the question as a heading without a description. */\n heading?: boolean\n /** What yes costs, figure by figure, between the question and the buttons. */\n cost?: ConfirmCost[]\n /**\n * `line` writes the cost as a sentence, each figure before its label;\n * `strip` sets the figures in cells, each label above. @default \"line\"\n */\n costAs?: \"line\" | \"strip\"\n /**\n * The strip without its box: only the rules between its cells, and the\n * outer cells flush with the question — for a card whose frame is already\n * the edge.\n */\n seamless?: boolean\n /** Something to weigh before answering, under the cost — a `CaveatNote`. */\n caveat?: React.ReactNode\n /** The line under the buttons — where the default came from. */\n hint?: React.ReactNode\n /** The yes and no buttons. */\n children?: React.ReactNode\n}\n\nconst figure = (value: React.ReactNode, tone?: \"warning\") =>\n typeof value === \"string\" || typeof value === \"number\" ? (\n <b className={cn(\"font-mono font-normal text-foreground\", tone === \"warning\" && \"text-warning\")}>{value}</b>\n ) : (\n value\n )\n\n/**\n * Yes or no, where yes states what it costs: the rows it scans, the time it\n * takes, the records it writes. The cost is stated before the button, not\n * after — as a line of figures under the question, or as a strip of cells\n * when the figures are the point.\n *\n * The body of a confirm ask, inside its `ClarifyCard`.\n */\nexport const ConfirmCard = React.forwardRef<HTMLDivElement, ConfirmCardProps>(\n (\n { question, description, heading, cost, costAs = \"line\", seamless, caveat, hint, className, children, ...props },\n ref,\n ) => (\n <div ref={ref} className={cn(\"flex flex-col gap-2\", className)} {...props}>\n <p className={heading || description ? \"font-semibold\" : undefined}>{question}</p>\n {description ? <p className=\"-mt-1.5 text-sm text-muted-foreground\">{description}</p> : null}\n {cost?.length && costAs === \"strip\" ? (\n <dl\n className={cn(\n \"grid\",\n // Seamless: it reaches out by a cell's padding and clips that off,\n // so the outer cells are flush.\n seamless\n ? \"-mx-2 -my-1 [clip-path:inset(0.25rem_0.5rem)]\"\n : \"overflow-hidden rounded-md border border-border\",\n )}\n style={{ gridTemplateColumns: `repeat(${cost.length}, minmax(0, 1fr))` }}\n >\n {cost.map((c, i) => (\n <div key={i} className=\"flex min-w-0 flex-col border-e border-border/60 px-2 py-1 last:border-e-0\">\n <dt className=\"truncate text-xs text-muted-foreground\">{c.label}</dt>\n <dd className={cn(\"font-mono font-medium tabular-nums\", c.tone === \"warning\" && \"text-warning\")}>\n {c.value}\n </dd>\n </div>\n ))}\n </dl>\n ) : cost?.length ? (\n <p className=\"text-xs text-muted-foreground\">\n {cost.map((c, i) => (\n <React.Fragment key={i}>\n {i > 0 ? \" · \" : null}\n {figure(c.value, c.tone)} {c.label}\n </React.Fragment>\n ))}\n </p>\n ) : null}\n {caveat}\n <ClarifyActions>{children}</ClarifyActions>\n {hint ? <ClarifyFootnote>{hint}</ClarifyFootnote> : null}\n </div>\n ),\n)\nConfirmCard.displayName = \"ConfirmCard\"\n","import * as React from \"react\"\nimport {\n Button,\n Kbd,\n PropertyList,\n PropertyRow,\n QuestionnaireChoiceDescription,\n QuestionnaireChoiceTitle,\n type QuestionnaireChoiceProps,\n type QuestionnaireFigureTone,\n} from \"@invana/ui\"\n\nimport { ClarifyActions, ClarifyFootnote } from \"@invana/ui\"\nimport type { AskText, ChoiceOption, Tone } from \"../types\"\nimport { strong } from \"../prose\"\n\n/*\n * The parts every ask shares, so the six renderers draw one language: the\n * question (plain or a heading with its description), the hint under a\n * control, a choice's lead and figure, and the summary an answered ask\n * settles into.\n */\n\n/** A question is a heading when it says so, or when a description follows it. */\nexport const isHeading = (text: AskText) => Boolean(text.heading || text.description)\n\n/** The question, and the muted line under it when there is one. */\nexport function AskQuestion({ text, aside }: { text: AskText; aside?: React.ReactNode }) {\n const question = <p className={isHeading(text) ? \"font-semibold\" : undefined}>{strong(text.question)}</p>\n return (\n <>\n {aside ? (\n <div className=\"flex items-baseline justify-between gap-2\">\n {question}\n {aside}\n </div>\n ) : (\n question\n )}\n {text.description ? <p className=\"-mt-1.5 text-sm text-muted-foreground\">{text.description}</p> : null}\n </>\n )\n}\n\n/**\n * A hint's markup: `**…**` a figure, in mono at full strength, and `` `…` ``\n * a key. Everything else is the hint's own muted text.\n */\nexport function hintText(text: string): React.ReactNode[] {\n return text\n .split(/(\\*\\*[^*]+\\*\\*|`[^`]+`)/)\n .filter(Boolean)\n .map((part, i) => {\n if (part.startsWith(\"**\") && part.endsWith(\"**\"))\n return (\n <b key={i} className=\"font-mono font-normal text-foreground\">\n {part.slice(2, -2)}\n </b>\n )\n if (part.startsWith(\"`\") && part.endsWith(\"`\")) return <Kbd key={i}>{part.slice(1, -1)}</Kbd>\n return part\n })\n}\n\n/** A small action in the ask's own text — `Select all`, `Edit`. */\nexport function AskLink({ children, onClick }: { children: React.ReactNode; onClick?: () => void }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"shrink-0 whitespace-nowrap font-sans text-xs font-normal text-primary hover:underline focus-visible:underline focus-visible:outline-none\"\n >\n {children}\n </button>\n )\n}\n\n/** The line under a control. */\nexport function AskHint({ children, tone }: { children?: string; tone?: \"warning\" | \"error\" }) {\n if (!children) return null\n return (\n <ClarifyFootnote className={tone === \"warning\" ? \"text-warning\" : tone === \"error\" ? \"text-destructive\" : undefined}>\n {hintText(children)}\n </ClarifyFootnote>\n )\n}\n\nconst FIGURE_TONE: Record<Tone, QuestionnaireFigureTone | undefined> = {\n good: \"success\",\n bad: \"error\",\n warn: \"warning\",\n neutral: undefined,\n}\n\n/** A 16×16 stroked icon from its path data. */\nfunction Icon({ path }: { path: string }) {\n return (\n <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.3} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d={path} />\n </svg>\n )\n}\n\n/** A choice's props and body, from the grammar's option. */\nexport function choiceParts(o: ChoiceOption): {\n props: Pick<QuestionnaireChoiceProps, \"detail\" | \"lead\" | \"figure\">\n body: React.ReactNode\n} {\n return {\n props: {\n detail: o.figure ? undefined : (o.note ?? o.detail),\n lead: o.icon ? <Icon path={o.icon} /> : o.lead,\n figure: o.figure && { value: o.figure.value, unit: o.figure.unit, tone: o.figure.tone && FIGURE_TONE[o.figure.tone] },\n },\n body: (\n <>\n <QuestionnaireChoiceTitle>{o.label}</QuestionnaireChoiceTitle>\n {o.description ? <QuestionnaireChoiceDescription>{o.description}</QuestionnaireChoiceDescription> : null}\n </>\n ),\n }\n}\n\n/** How a picked option reads in a summary: its `summary`, else its label and source. */\nexport function pickText(o: ChoiceOption | undefined, value: unknown): string {\n if (!o) return value == null || value === \"\" ? \"—\" : String(value)\n if (o.summary) return o.summary\n return o.detail ? `${o.label} · ${o.detail}` : o.label\n}\n\n/**\n * Several picks as one line. Labels join with commas — `Stores, Online`; a\n * `summary` may hold a comma of its own — `Semi-arid, 3 sites` — so picks\n * that carry one join with a dot — `Rust ≥ 6 · maturity ≤ 115 d`.\n */\nexport function joinPicks(picked: ChoiceOption[]): string {\n if (!picked.length) return \"—\"\n const summarised = picked.some((o) => o.summary)\n return picked.map((o) => o.summary ?? o.label).join(summarised ? \" · \" : \", \")\n}\n\n/** The answers an ask settled into, as label/value pairs, and the way back into it. */\nexport function AskSummary({\n rows,\n change,\n onChange,\n children,\n}: {\n rows: { label: string; value: React.ReactNode }[]\n /** The words of the button that reopens the ask — `Change answer`. */\n change?: string\n onChange?: () => void\n /** Anything under the pairs — what the answer led to. */\n children?: React.ReactNode\n}) {\n return (\n <>\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {rows.map((r) => (\n <PropertyRow key={r.label} label={r.label} mono>\n {r.value}\n </PropertyRow>\n ))}\n </PropertyList>\n {children}\n {change ? (\n <ClarifyActions>\n <Button size=\"xs\" variant=\"ghost\" onClick={onChange}>\n {change}\n </Button>\n </ClarifyActions>\n ) : null}\n </>\n )\n}\n","import { Button, CaveatNote } from \"@invana/ui\"\n\nimport { ConfirmCard, type ConfirmCost } from \"../parts/confirm-card\"\nimport type { BlockProps, ConfirmOptions } from \"../types\"\nimport { strong } from \"../prose\"\nimport { AskHint, AskSummary, hintText } from \"../parts/ask\"\n\n/** The grammar's cost, as the card's figures. A value with `**…**` bolds only that part. */\nfunction costOf(cost: ConfirmOptions[\"cost\"]): ConfirmCost[] | undefined {\n return cost?.map((c) => ({\n label: c.label,\n value: c.value.includes(\"**\") ? hintText(c.value) : c.value,\n tone: c.tone === \"warn\" || c.tone === \"bad\" ? \"warning\" : undefined,\n }))\n}\n\n/**\n * Yes or no, where the question says what yes will do and the cost — rows\n * scanned, time, records written — is stated before the buttons, as a line or\n * a strip of figures. A caveat to weigh sits under the cost. The default is the\n * primary button; with `align: \"end\"` it takes the card's right edge and the\n * other its left, and a `dismiss` no draws quiet. `hint` says where the\n * default came from.\n *\n * Answered, it settles into the decision, in `settled` words when given, with\n * the hint the API patches in to say what it led to.\n */\nexport function ConfirmAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"confirm\">) {\n const pending = state === \"pending\"\n\n if (!pending) {\n const yes = given === undefined ? (spec.default ?? true) : given === true\n const words = yes ? (spec.settled?.yes ?? spec.yes) : (spec.settled?.no ?? spec.no)\n return (\n <AskSummary rows={[{ label: spec.label ?? \"Decision\", value: words }]}>\n <AskHint>{spec.hint}</AskHint>\n </AskSummary>\n )\n }\n\n const chosen = spec.default ?? true\n const end = spec.align === \"end\"\n const button = (value: boolean) => (\n <Button\n key={String(value)}\n size=\"xs\"\n variant={value === chosen ? \"default\" : value === false && spec.dismiss ? \"ghost\" : \"outline\"}\n className={end && value === chosen ? \"ms-auto\" : undefined}\n onClick={() => onAction?.(\"reply\", value)}\n >\n {value ? spec.yes : spec.no}\n </Button>\n )\n // Together, the default leads; apart, it takes the right edge.\n const order = end ? [!chosen, chosen] : [chosen, !chosen]\n\n return (\n <ConfirmCard\n question={strong(spec.question)}\n description={spec.description}\n heading={spec.heading}\n cost={costOf(spec.cost)}\n costAs={spec.costAs}\n seamless\n caveat={spec.caveat ? <CaveatNote label={spec.caveat.label}>{spec.caveat.text}</CaveatNote> : undefined}\n hint={spec.hint ? hintText(spec.hint) : undefined}\n >\n {order.map(button)}\n </ConfirmCard>\n )\n}\n","import { ArtifactCard, ArtifactTable, Badge, Button } from \"@invana/ui\"\n\nimport type { BlockProps, FileItem } from \"../types\"\nimport { BADGE_TONE } from \"../format\"\n\n/** A page with its corner folded — a file, whatever its type. */\nfunction FileGlyph() {\n return (\n <svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" aria-hidden>\n <path d=\"M4 1.5h5.5L13 5v9.5H4z\" />\n <path d=\"M9.5 1.5V5H13\" />\n </svg>\n )\n}\n\nconst noteOf = (file: FileItem) => file.note ?? file.size\n\n/**\n * The files an answer hands over. Several are a list, each addressed by its\n * digest or offered for download; one file is a card that says what it holds,\n * with its download or its state at the right.\n */\nexport function FilesBlock({ spec, onAction }: BlockProps<\"files\">) {\n const download = (file: FileItem) =>\n onAction?.(\"download\", file.digest ?? file.name)\n\n if (spec.files.length === 1) {\n const file = spec.files[0]!\n return (\n <ArtifactCard\n file={{ name: file.name, size: file.size, digest: file.digest }}\n note={noteOf(file)}\n aside={\n file.status ? (\n <Badge variant=\"soft\" size=\"xs\" tone={BADGE_TONE[file.status.tone ?? \"neutral\"]} className=\"font-normal\">\n {file.status.label}\n </Badge>\n ) : spec.download ? (\n <Button type=\"button\" variant=\"outline\" size=\"xs\" onClick={() => download(file)}>\n Download\n </Button>\n ) : undefined\n }\n />\n )\n }\n\n return (\n <ArtifactTable\n variant=\"list\"\n files={spec.files.map((file) => ({\n name: file.name,\n size: file.size,\n digest: spec.download ? undefined : file.digest,\n icon: spec.download ? <FileGlyph /> : undefined,\n }))}\n onDownload={spec.download ? (_, i) => download(spec.files[i]!) : undefined}\n />\n )\n}\n","import * as React from \"react\"\nimport { useForm } from \"react-hook-form\"\nimport { Button } from \"@invana/ui\"\nimport {\n Form,\n ObjectField,\n type FieldConfig,\n type FieldType,\n type FieldValues,\n} from \"@invana/forms\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport type { BlockProps, FormOptions } from \"../types\"\nimport { AskHint, AskQuestion, AskSummary } from \"../parts/ask\"\n\ntype Spec = FormOptions[\"fields\"][number]\ntype Values = Record<string, unknown>\n\n/**\n * The grammar's field types, as the form generator's. A date is typed text\n * until the kit has a date field: its default is already the label the analyst\n * reads, `1 Nov 2026`. A checkbox is the generator's boolean drawn as a box.\n */\nconst FIELD_TYPE: Record<Spec[\"type\"], FieldType> = {\n number: \"number\",\n text: \"text\",\n date: \"text\",\n select: \"select\",\n textarea: \"textarea\",\n checkbox: \"boolean\",\n radio: \"radio\",\n}\n\nconst blank = (v: unknown) => v == null || (typeof v === \"string\" && v.trim() === \"\")\n\n/**\n * The field's rules: `required` (a checkbox must be ticked) and a number's\n * bounds, each as the message that says which one it broke.\n */\nfunction rules(f: Spec): FieldConfig[\"rules\"] {\n if (!f.required && f.above == null && f.below == null) return undefined\n return {\n validate: (v: unknown) => {\n if (f.required && (f.type === \"checkbox\" ? v !== true : blank(v))) return \"Required\"\n const n = Number(v)\n if (f.above != null && !(n > f.above)) return `Must be above ${f.above}`\n if (f.below != null && !(n < f.below)) return `Must be below ${f.below}`\n return true\n },\n }\n}\n\n/**\n * A select's or radio's choices. A select sent without them still shows its\n * default, as its one choice.\n */\nfunction optionsOf(f: Spec): FieldConfig[\"options\"] {\n if (f.options) return f.options\n if (f.type === \"select\" && f.default != null) {\n return [{ value: String(f.default), label: String(f.default) }]\n }\n return undefined\n}\n\nconst toField = (f: Spec): FieldConfig => ({\n name: f.name,\n type: FIELD_TYPE[f.type],\n control: f.type === \"checkbox\" ? \"checkbox\" : undefined,\n label: f.label,\n unit: f.unit,\n aside: f.aside,\n description: f.hint,\n group: f.group,\n options: optionsOf(f),\n rows: f.rows,\n disabled: f.disabled,\n rules: rules(f),\n placeholder: f.placeholder ?? \"\",\n // A long answer takes the row; so does a list of described choices.\n colSpan: f.type === \"textarea\" || (f.type === \"radio\" && f.options?.some((o) => o.description)) ? 2 : undefined,\n})\n\n/** A field's value before the analyst touches it: a checkbox is off unless it says. */\nconst initial = (f: Spec) => (f.type === \"checkbox\" ? (f.default ?? false) : f.default)\n\n/** A value with its unit, as the summary reads it — `30%`, `17 d`. */\nfunction withUnit(value: unknown, unit?: string): string {\n if (value == null || value === \"\") return \"—\"\n if (!unit) return String(value)\n return /^[A-Za-z]/.test(unit) ? `${value} ${unit}` : `${value}${unit}`\n}\n\n/** A field's answer as the summary reads it: a checkbox `Yes`/`No`, a choice its label. */\nfunction answerOf(f: Spec, value: unknown): string {\n if (f.type === \"checkbox\") return value === true ? \"Yes\" : \"No\"\n const picked = f.options?.find((o) => o.value === value)\n return picked ? picked.label : withUnit(value, f.unit)\n}\n\n/**\n * Several related values answered together, where they only make sense as a\n * set — scenario inputs. The fields render through the form generator: with\n * `labels: \"side\"` in a column on the left, with `\"top\"` over each field, two\n * to a row where the card is wide enough; a field's `group` sets it under a\n * small caps name. A `textarea` and a list of described `radio` choices take\n * the row; a `checkbox` sits beside its label. A number out of its\n * `above`/`below` bounds, or a `required` field left empty, says so under\n * itself and holds the submit back. The submit sends a `reply` keyed by field\n * name.\n *\n * Answered, it settles into its values as label/value pairs; Change inputs\n * reopens the form with them filled in, and sending again is a `change`.\n */\nexport function FormAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"form\">) {\n // The <form>'s element id: unique on the page, whatever the turn ids are.\n const auto = React.useId()\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const current = (given ?? {}) as Values\n const top = spec.labels === \"top\"\n\n const defaults = Object.fromEntries(\n spec.fields.map((f) => [f.name, pending ? initial(f) : current[f.name]]),\n )\n // Untyped past the root: ObjectField takes any form's control.\n const form = useForm<FieldValues>({ defaultValues: { values: defaults }, mode: \"onChange\" })\n\n if (!pending && !editing) {\n return (\n <AskSummary\n rows={spec.fields.map((f) => ({ label: f.label, value: answerOf(f, current[f.name]) }))}\n change={state === \"answered\" ? \"Change inputs\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n // The <form> holds only the fields, so the question, hint and actions stay\n // in the card's own rhythm; the submit reaches it through `form`.\n return (\n <Form {...form}>\n <AskQuestion text={spec} />\n <form\n id={`${auto}-form`}\n onSubmit={form.handleSubmit(({ values }) => {\n onAction?.(editing ? \"change\" : \"reply\", values)\n setEditing(false)\n })}\n >\n <ObjectField\n control={form.control}\n name=\"values\"\n fields={spec.fields.map(toField)}\n labelPosition={top ? \"top\" : \"side\"}\n size=\"xs\"\n columns={top ? 2 : 1}\n fit=\"container\"\n groupAs=\"section\"\n />\n </form>\n <AskHint>{spec.hint}</AskHint>\n <ClarifyActions>\n <Button\n type=\"submit\"\n form={`${auto}-form`}\n size=\"xs\"\n className={top ? \"ms-auto\" : undefined}\n disabled={!form.formState.isValid}\n >\n {spec.submit ?? \"Submit\"}\n </Button>\n </ClarifyActions>\n </Form>\n )\n}\n","import * as React from \"react\"\nimport { Badge, Gantt, type ExpandedKeys, type GanttRow } from \"@invana/ui\"\n\nimport { BADGE_TONE } from \"../format\"\nimport type { BlockProps, GanttSpecBar, GanttSpecRow } from \"../types\"\n\n/** The tasks drawn open at first, by key — every task the spec marks `open`. */\nconst openKeys = (tasks: GanttSpecRow[]): Record<string, boolean> =>\n Object.fromEntries(\n tasks.flatMap((t) => [...(t.open ? [[t.key, true] as const] : []), ...Object.entries(openKeys(t.subtasks ?? []))]),\n )\n\n/** Every task's key, nested ones too. */\nconst allKeys = (tasks: GanttSpecRow[]): string[] => tasks.flatMap((t) => [t.key, ...allKeys(t.subtasks ?? [])])\n\n/** A bar's chip, as the badge the JSON names. */\nconst toBar = ({ chip, ...bar }: GanttSpecBar) => ({\n ...bar,\n chip: chip ? (\n <Badge variant=\"soft\" tone={BADGE_TONE[chip.tone ?? \"neutral\"]}>\n {chip.label}\n </Badge>\n ) : undefined,\n})\n\n/** A plan read in order counts steps, not milliseconds. */\nconst STEP_TICK = (n: number) => `step ${Math.round(n)}`\nconst STEPS = (n: number) => (Math.round(n) === 1 ? \"1 step\" : `${Math.round(n)} steps`)\n\n/**\n * The spec's words as the Gantt's: a task is a row, its `subtasks` the rows it\n * opens into, its `segments` the bars it holds — the open flag left behind.\n */\nconst toRow = ({ open: _open, subtasks, segments, ...task }: GanttSpecRow): GanttRow => ({\n ...task,\n bars: segments?.map(toBar),\n rows: subtasks?.map(toRow),\n})\n\n/**\n * Where a run's time went: one row per task on the run's own clock, a retry's\n * failed attempt to the left of the one that stuck, a task that never ran as an\n * outline. A task that split into others opens into them; one with no timing of\n * its own draws the stretch they cover. Hover a row for what it produced; pick\n * one and it is sent as `select` with the task's key.\n *\n * A row's `segments` are many bars on one row — what a worker slot held, what a\n * layer was reached for — painted by `palette`. A keyed bar is picked on its\n * own and sent as `select` with its key. With `scale: \"seq\"` the clock counts a\n * plan's steps, so the same drawing reads a plan before it runs. The reader opens\n * and closes rows; a spec whose `open` flags change opens and closes them again.\n */\nexport function GanttBlock({ spec, onAction }: BlockProps<\"gantt\">) {\n const [selected, setSelected] = React.useState<string | null>(spec.selected ?? null)\n const [expanded, setExpanded] = React.useState<ExpandedKeys>(() => openKeys(spec.tasks))\n // Two ways the spec opens rows. A task that streams in marked `open` opens, and the rows the\n // reader opened or closed keep their choice. A patch that changes the `open` flags of tasks\n // already drawn (an `Expand all`) wins again, compared by the keys it opens, so a new spec\n // object with the same flags (a selection moved) leaves the reader's rows alone.\n const keys = allKeys(spec.tasks)\n const flagged = openKeys(spec.tasks)\n const openedAmong = (among: string[]) => among.filter((key) => flagged[key]).sort().join(\"\\n\")\n const [seen, setSeen] = React.useState(() => new Set(keys))\n const [lastOpened, setLastOpened] = React.useState(() => openedAmong(keys))\n const fresh = keys.filter((key) => !seen.has(key))\n const reflagged = openedAmong(keys.filter((key) => seen.has(key))) !== lastOpened\n if (fresh.length || reflagged) {\n setSeen(new Set(keys))\n setLastOpened(openedAmong(keys))\n if (reflagged) setExpanded(flagged)\n else {\n const arrived = fresh.filter((key) => flagged[key])\n if (arrived.length)\n setExpanded((e) => (e === true ? e : { ...e, ...Object.fromEntries(arrived.map((k) => [k, true])) }))\n }\n }\n const rows = React.useMemo(() => spec.tasks.map(toRow), [spec.tasks])\n const pick = (key: string) => {\n setSelected(key)\n onAction?.(\"select\", key)\n }\n\n return (\n <Gantt\n rows={rows}\n spanMs={spec.spanMs}\n nowMs={spec.nowMs}\n openEnded={spec.openEnded}\n ticks={spec.ticks}\n formatTick={spec.scale === \"seq\" ? STEP_TICK : undefined}\n formatDuration={spec.scale === \"seq\" ? STEPS : undefined}\n labelWidth={spec.labelWidth}\n durationWidth={spec.durationWidth}\n palette={spec.palette}\n seams={spec.seams}\n density={spec.density}\n expanded={expanded}\n onExpandedChange={setExpanded}\n selectedKey={selected}\n onSelectRow={onAction ? pick : undefined}\n onSelectBar={onAction ? pick : undefined}\n />\n )\n}\n","import { MetricGrid, MetricTile } from \"@invana/ui\"\n\nimport { CAPTION_TONE, gaugeProps, metricValue } from \"../format\"\nimport type { BlockProps } from \"../types\"\n\n/** Three across; four sit two by two rather than three and one; more wrap in threes. */\nconst columnsFor = (n: number) => (n === 4 ? 2 : Math.min(n, 3))\n\n/**\n * A band of figures that belong to one answer, each with its change beneath it\n * and, where a figure has a ceiling or a target, a bar under it.\n */\nexport function GridBlock({ spec }: BlockProps<\"grid\">) {\n return (\n <MetricGrid\n joined\n seamless\n minTileWidth={spec.minTileWidth}\n columns={spec.minTileWidth ? undefined : columnsFor(spec.tiles.length)}\n >\n {spec.tiles.map((tile) => (\n <MetricTile\n key={tile.label}\n variant=\"figure\"\n label={tile.label}\n value={metricValue(tile.value)}\n tone={tile.value == null ? \"muted\" : undefined}\n caption={tile.delta}\n captionTone={tile.tone ? CAPTION_TONE[tile.tone] : undefined}\n flagged={tile.flag}\n {...gaugeProps(tile.gauge)}\n />\n ))}\n </MetricGrid>\n )\n}\n","import * as React from \"react\"\nimport { HeatStrip, type HeatStripRow, type HeatState } from \"@invana/charts\"\n\nimport type { BlockProps, HeatStripRowOptions, Tone } from \"../types\"\n\n/** The grammar's tones, as the status colours a square is drawn in. */\nconst COLOR: Record<Tone, string> = {\n good: \"var(--color-success)\",\n bad: \"var(--color-destructive)\",\n warn: \"var(--color-warning)\",\n neutral: \"var(--color-muted-foreground)\",\n}\n\nconst toRow = ({ id, label, cells, children }: HeatStripRowOptions): HeatStripRow => ({\n key: id,\n label,\n cells,\n children: children?.map(toRow),\n})\n\nconst openKeys = (rows: HeatStripRowOptions[]): Record<string, boolean> =>\n Object.fromEntries(\n rows.flatMap((r) => [...(r.open ? [[r.id, true] as const] : []), ...Object.entries(openKeys(r.children ?? []))]),\n )\n\n/**\n * A run of firings, one square each, in time order — a schedule's day, most\n * green and the one that is not. With `rows`, several strips over one axis, and\n * a row opens into its children, so the red square can be followed down to the\n * job that went red. The legend is always drawn: a square has no label of its own.\n */\nexport function HeatStripBlock({ spec }: BlockProps<\"heatstrip\">) {\n const states = React.useMemo<HeatState[]>(\n () => spec.states.map((s) => ({ key: s.key, label: s.label, hollow: s.hollow, color: COLOR[s.tone ?? \"neutral\"] })),\n [spec.states],\n )\n const rows = React.useMemo(() => spec.rows?.map(toRow), [spec.rows])\n const defaultExpanded = React.useMemo(() => openKeys(spec.rows ?? []), [spec.rows])\n\n return (\n <HeatStrip\n cells={spec.cells}\n rows={rows}\n states={states}\n ticks={spec.ticks}\n defaultExpanded={defaultExpanded}\n />\n )\n}\n","import * as React from \"react\"\nimport { PropertyList, PropertyRow } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport {\n ChatSessionDisclosure,\n ChatSessionDisclosureCode,\n ChatSessionDisclosureSteps,\n} from \"@invana/ui\"\nimport { strong } from \"../prose\"\n\n/**\n * The query, formula or model behind the figure, folded. Closed, the line\n * carries the meta at the right, or the code itself when there is none; open,\n * the code moves into its own block, with what a model rests on under it, or\n * the steps of a method that took several.\n */\nexport function MethodBlock({ spec }: BlockProps<\"method\">) {\n const [open, setOpen] = React.useState(spec.open ?? false)\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={spec.label ?? \"method\"}\n meta={spec.meta ?? (open ? undefined : spec.code?.replace(/\\*\\*/g, \"\"))}\n open={open}\n onOpenChange={setOpen}\n >\n <>\n {spec.code ? <ChatSessionDisclosureCode>{strong(spec.code)}</ChatSessionDisclosureCode> : null}\n {spec.facts?.length ? (\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {spec.facts.map((fact) => (\n <PropertyRow key={fact.label} label={fact.label} mono>\n {fact.value}\n </PropertyRow>\n ))}\n </PropertyList>\n ) : null}\n {spec.steps?.length ? <ChatSessionDisclosureSteps steps={spec.steps} /> : null}\n </>\n </ChatSessionDisclosure>\n )\n}\n","import { Sparkline } from \"@invana/charts\"\nimport { MetricTile } from \"@invana/ui\"\n\nimport { CAPTION_TONE, gaugeProps, metricValue } from \"../format\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * The one figure an answer turns on, with its comparison worded under it — and,\n * when the answer has them, a bar against its target or its recent run beside it.\n */\nexport function MetricBlock({ spec }: BlockProps<\"metric\">) {\n return (\n <MetricTile\n variant=\"hero\"\n label={spec.label}\n value={metricValue(spec.value)}\n tone={spec.value == null ? \"muted\" : undefined}\n caption={spec.delta}\n captionTone={spec.tone ? CAPTION_TONE[spec.tone] : undefined}\n {...gaugeProps(spec.gauge)}\n aside={\n spec.trend?.length ? (\n <Sparkline\n values={spec.trend}\n width={96}\n height={32}\n strokeWidth={1.4}\n endMarker={false}\n color=\"color-mix(in srgb, var(--color-foreground) 70%, transparent)\"\n label={`${spec.label}, recent run`}\n />\n ) : undefined\n }\n />\n )\n}\n","import * as React from \"react\"\nimport {\n Button,\n cn,\n Questionnaire,\n QuestionnaireChoice,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireItem,\n QuestionnaireTitle,\n} from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport { AskHint, AskLink, AskSummary, choiceParts, hintText, isHeading, joinPicks } from \"../parts/ask\"\nimport { strong } from \"../prose\"\n\n/**\n * The submit's words, from the ask's `submit` or else from the question. A\n * prompt that is a phrase — `Adjust for` — is already the verb: `Adjust for 4`.\n * A question — `Who should receive it?` — is not, so it says what is being\n * sent: `Use 2 selected`.\n */\nfunction submitLabel(question: string, count: number, submit?: string) {\n if (submit) return submit.replace(\"{count}\", String(count))\n const q = question.trim()\n return q.endsWith(\"?\") ? `Use ${count} selected` : `${q} ${count}`\n}\n\n/**\n * Several choices from a list the data model holds — filters, or the\n * assumptions an analysis will make, where the one left off says why in its\n * `note`. The defaults arrive ticked; `min` holds the submit back until enough\n * are, and `max` counts toward its limit beside the submit — at the limit the\n * rest stop being offered. Options take the same description, lead and\n * figure a single choice does. Submit sends the ticked values as a `reply`, in\n * the ask's order.\n *\n * Answered, it settles into one label/value pair; Change answer reopens it.\n */\nexport function MultiAsk({ spec, state = \"pending\", value: given, id: idProp, onAction }: BlockProps<\"multi\">) {\n const auto = React.useId()\n const id = idProp ?? auto\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const [picked, setPicked] = React.useState<string[]>(\n pending ? (spec.default ?? []) : ((given as string[] | undefined) ?? []),\n )\n\n if (!pending && !editing) {\n const value = (given as string[] | undefined) ?? spec.default ?? []\n const text = joinPicks(spec.options.filter((o) => value.includes(o.value)))\n return (\n <AskSummary\n rows={[{ label: spec.label ?? \"Answer\", value: text || \"—\" }]}\n change={state === \"answered\" ? \"Change answer\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const full = spec.max != null && picked.length >= spec.max\n const short = spec.min != null && picked.length < spec.min\n const toggle = (v: string) =>\n setPicked((now) => (now.includes(v) ? now.filter((x) => x !== v) : [...now, v]))\n const all = spec.options.filter((o) => !o.disabled).map((o) => o.value)\n\n return (\n <>\n <Questionnaire\n id={`${auto}-form`}\n onSubmit={(e) => {\n e.preventDefault()\n if (short) return\n const value = spec.options.map((o) => o.value).filter((v) => picked.includes(v))\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n }}\n >\n <QuestionnaireItem name={id} multiple>\n <QuestionnaireTitle\n className={cn(\n isHeading(spec) && \"font-semibold\",\n spec.selectAll && \"flex w-full items-baseline justify-between gap-2\",\n )}\n >\n {strong(spec.question)}\n {spec.selectAll ? (\n <AskLink onClick={() => setPicked(spec.max != null ? all.slice(0, spec.max) : all)}>Select all</AskLink>\n ) : null}\n </QuestionnaireTitle>\n {spec.description ? <QuestionnaireDescription>{spec.description}</QuestionnaireDescription> : null}\n <QuestionnaireChoices>\n {spec.options.map((o) => {\n const checked = picked.includes(o.value)\n const { props, body } = choiceParts(o)\n return (\n <QuestionnaireChoice\n key={o.value}\n value={o.value}\n {...props}\n disabled={o.disabled || (full && !checked)}\n checked={checked}\n onChange={() => toggle(o.value)}\n >\n {body}\n </QuestionnaireChoice>\n )\n })}\n </QuestionnaireChoices>\n </QuestionnaireItem>\n </Questionnaire>\n <AskHint>{spec.hint}</AskHint>\n <ClarifyActions>\n {spec.max != null ? (\n full && spec.max < spec.options.length ? (\n <AskHint tone=\"warning\">Limit reached · clear one to swap</AskHint>\n ) : (\n <span className=\"text-xs text-muted-foreground\">{hintText(`**${picked.length}** of ${spec.max}`)}</span>\n )\n ) : null}\n <Button type=\"submit\" form={`${auto}-form`} size=\"xs\" className=\"ms-auto\" disabled={short}>\n {submitLabel(spec.question, picked.length, spec.submit)}\n </Button>\n </ClarifyActions>\n </>\n )\n}\n","import { cn } from \"@invana/ui\"\n\nexport interface PlaceholderProps {\n /** The block's kind. */\n kind: string\n /** The block's spec exactly as it was sent. */\n options: unknown\n className?: string\n}\n\n/**\n * A block with no renderer yet: its kind and the JSON it was sent.\n *\n * Shown rather than skipped, and never an error. A conversation is data that\n * outlives the code reading it, and a silently missing block is worse than a\n * visible one, because the analyst reads an answer they believe is complete.\n * While the kit is being built, the placeholders in a session story are also\n * the work left, in the place it will appear.\n */\nexport function Placeholder({ kind, options, className }: PlaceholderProps) {\n const { kind: _kind, ...rest } = (options ?? {}) as Record<string, unknown>\n const json = JSON.stringify(rest, null, 2)\n return (\n <div\n data-placeholder={kind}\n className={cn(\"flex min-w-0 flex-col gap-1 border border-dashed border-border p-2\", className)}\n >\n <span className=\"text-sm text-muted-foreground\">\n No renderer yet for the block <span className=\"font-mono text-foreground\">{kind}</span>\n </span>\n {json !== \"{}\" ? (\n <pre className=\"max-h-40 overflow-auto font-mono text-sm text-muted-foreground\">{json}</pre>\n ) : null}\n </div>\n )\n}\n","import * as React from \"react\"\nimport {\n Button,\n PropertyList,\n PropertyRow,\n Questionnaire,\n QuestionnaireActions,\n QuestionnaireChoice,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireInput,\n QuestionnaireItem,\n QuestionnaireNext,\n QuestionnairePrevious,\n QuestionnaireProgress,\n QuestionnaireProgressBar,\n QuestionnaireSkip,\n QuestionnaireSubmit,\n QuestionnaireTitle,\n} from \"@invana/ui\"\n\nimport { Placeholder } from \"../placeholder\"\nimport type { BlockProps, MultistepOptions } from \"../types\"\nimport { strong } from \"../prose\"\nimport { AskHint, AskLink, AskSummary, choiceParts, joinPicks } from \"../parts/ask\"\n\ntype Step = MultistepOptions[\"steps\"][number]\ntype Answers = Record<string, unknown>\ntype Status = \"unanswered\" | \"answered\" | \"skipped\"\n\n/** A step's question: always a heading, its description under it. */\nfunction StepTitle({ step }: { step: Step }) {\n if (!(\"question\" in step)) return null\n return (\n <>\n <QuestionnaireTitle className=\"font-semibold\">{strong(step.question ?? \"\")}</QuestionnaireTitle>\n {\"description\" in step && step.description ? (\n <QuestionnaireDescription>{step.description}</QuestionnaireDescription>\n ) : null}\n </>\n )\n}\n\n/** A step's own answer, as the form holds it before it is sent. */\nfunction StepItem({\n step,\n value,\n onStatusChange,\n}: {\n step: Step\n value: unknown\n onStatusChange: (status: Status) => void\n}) {\n const item = { name: step.id, required: step.required, onStatusChange }\n switch (step.kind) {\n case \"single\":\n case \"multi\": {\n const multiple = step.kind === \"multi\"\n const chosen = (v: string) =>\n multiple ? Array.isArray(value) && value.includes(v) : value === v\n return (\n <QuestionnaireItem {...item} multiple={multiple}>\n <StepTitle step={step} />\n <QuestionnaireChoices>\n {step.options.map((o) => {\n const { props, body } = choiceParts(o)\n return (\n <QuestionnaireChoice\n key={o.value}\n value={o.value}\n {...props}\n disabled={o.disabled}\n defaultChecked={chosen(o.value)}\n >\n {body}\n </QuestionnaireChoice>\n )\n })}\n </QuestionnaireChoices>\n </QuestionnaireItem>\n )\n }\n case \"number\":\n case \"short\":\n case \"long\":\n return (\n <QuestionnaireItem {...item}>\n <StepTitle step={step} />\n <QuestionnaireInput\n type={step.kind === \"number\" ? \"number\" : \"text\"}\n unit={step.kind === \"number\" ? step.unit : undefined}\n min={step.kind === \"number\" ? step.min : undefined}\n max={step.kind === \"number\" ? step.max : undefined}\n step={step.kind === \"number\" ? step.step : undefined}\n defaultValue={value == null ? undefined : String(value)}\n aria-label={step.question}\n />\n {\"hint\" in step ? <AskHint>{step.hint}</AskHint> : null}\n </QuestionnaireItem>\n )\n default:\n return (\n <QuestionnaireItem {...item}>\n <Placeholder kind={step.kind} options={step} />\n </QuestionnaireItem>\n )\n }\n}\n\n/** A number as the summary reads it — `2,200 kg/ha`, `55%`. */\nfunction numberText(value: unknown, unit?: string) {\n const n = typeof value === \"number\" ? value : Number(value)\n const text = Number.isFinite(n) ? n.toLocaleString(\"en-GB\") : String(value)\n if (!unit) return text\n return /^[A-Za-z]/.test(unit) ? `${text} ${unit}` : `${text}${unit}`\n}\n\n/** What each step's answer reads as in the review and the settled summary. */\nfunction answerText(step: Step, value: unknown): string {\n if (value == null || value === \"\" || (Array.isArray(value) && !value.length)) return \"—\"\n switch (step.kind) {\n case \"single\":\n case \"quick\": {\n const o = step.options.find((x) => x.value === value)\n return o ? ((\"summary\" in o && o.summary) || o.label) : String(value)\n }\n case \"multi\": {\n const values = Array.isArray(value) ? value : [value]\n return joinPicks(values.map((v) => step.options.find((x) => x.value === v) ?? { value: String(v), label: String(v) }))\n }\n case \"number\":\n return numberText(value, step.unit)\n default:\n return typeof value === \"object\" ? JSON.stringify(value) : String(value)\n }\n}\n\n/** A step's name in a summary: its `label`, else its id — `until` → `Until`. */\nconst labelOf = (step: Step) =>\n (\"label\" in step && step.label) || step.id.charAt(0).toUpperCase() + step.id.slice(1)\n\n/** The form's answers, typed by each step's block. */\nfunction collect(steps: Step[], form: HTMLFormElement): Answers {\n const data = new FormData(form)\n const out: Answers = {}\n for (const step of steps) {\n const all = data.getAll(step.id).map(String).filter(Boolean)\n if (step.kind === \"multi\") out[step.id] = all\n else if (!all.length) continue\n else if (step.kind === \"number\") out[step.id] = Number(all[0])\n else out[step.id] = all[0]\n }\n return out\n}\n\n/**\n * Several related asks sent as one request, one step at a time with its\n * progress. Skip is offered on a step that is not `required` and not the\n * last; a required step holds Next back, saying why, until it is answered.\n * With `review`, the last step leads to the answers laid out once more, each\n * with Edit, before they are sent. The value is keyed by step id.\n *\n * Answered, it settles into the answers as label/value pairs; Change answers\n * reopens the steps with them filled in, and sending again is a `change`,\n * which re-runs from this turn.\n */\nexport function MultistepAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"multistep\">) {\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const steps = spec.steps\n const [item, setItem] = React.useState(steps[0]?.id ?? \"\")\n // A step that arrives with a default is answered before anything is touched.\n const [status, setStatus] = React.useState<Record<string, Status>>(() =>\n Object.fromEntries(\n steps.filter((s) => \"default\" in s && s.default != null).map((s) => [s.id, \"answered\" as Status]),\n ),\n )\n const [review, setReview] = React.useState<Answers | null>(null)\n const formRef = React.useRef<HTMLFormElement>(null)\n const current = (given ?? {}) as Answers\n\n if (!pending && !editing) {\n return (\n <AskSummary\n rows={steps.map((step) => ({ label: labelOf(step), value: answerText(step, current[step.id]) }))}\n change={state === \"answered\" ? \"Change answers\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const send = (value: Answers) => {\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n setReview(null)\n }\n const initial = (step: Step): unknown =>\n editing ? current[step.id] : \"default\" in step ? step.default : undefined\n\n const index = Math.max(0, steps.findIndex((s) => s.id === item))\n const step = steps[index]\n const last = index === steps.length - 1\n const blocked = Boolean(step?.required && status[step.id] !== \"answered\")\n\n return (\n <>\n <Questionnaire\n ref={formRef}\n item={item}\n onItemChange={setItem}\n hidden={review != null}\n onSubmit={(e) => {\n e.preventDefault()\n send(collect(steps, e.currentTarget))\n }}\n >\n <QuestionnaireProgress />\n {steps.map((s) => (\n <StepItem\n key={s.id}\n step={s}\n value={initial(s)}\n onStatusChange={(st) => setStatus((now) => ({ ...now, [s.id]: st }))}\n />\n ))}\n {blocked ? <AskHint tone=\"error\">Pick one to continue · this step is required</AskHint> : null}\n <QuestionnaireActions>\n <QuestionnairePrevious />\n {!last && !step?.required ? <QuestionnaireSkip /> : null}\n <QuestionnaireNext disabled={blocked} />\n {last && spec.review ? (\n <Button\n type=\"button\"\n size=\"xs\"\n className=\"col-start-3 row-start-1 justify-self-end\"\n disabled={blocked}\n onClick={() => formRef.current && setReview(collect(steps, formRef.current))}\n >\n Review\n </Button>\n ) : (\n <QuestionnaireSubmit disabled={blocked} />\n )}\n </QuestionnaireActions>\n </Questionnaire>\n {review ? (\n <>\n <QuestionnaireProgressBar label=\"Review\" value={1} />\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {steps.map((s) => (\n <PropertyRow key={s.id} label={labelOf(s)} mono>\n <span className=\"flex items-baseline gap-2\">\n <span className=\"min-w-0 flex-1\">{answerText(s, review[s.id])}</span>\n <AskLink\n onClick={() => {\n setItem(s.id)\n setReview(null)\n }}\n >\n Edit\n </AskLink>\n </span>\n </PropertyRow>\n ))}\n </PropertyList>\n <QuestionnaireActions>\n <Button type=\"button\" size=\"xs\" variant=\"outline\" className=\"justify-self-start\" onClick={() => setReview(null)}>\n Previous\n </Button>\n <Button type=\"button\" size=\"xs\" className=\"col-start-3 justify-self-end\" onClick={() => send(review)}>\n {`Submit ${steps.length} answers`}\n </Button>\n </QuestionnaireActions>\n </>\n ) : null}\n </>\n )\n}\n","import type * as React from \"react\"\nimport { CitationMarker } from \"@invana/ui\"\n\nimport { prose } from \"../prose\"\nimport type { BlockProps } from \"../types\"\n\nexport interface NarrativeBlockProps extends BlockProps<\"narrative\"> {\n /** The source the reader is on, when the shell tracks it. Defaults to the spec's `active`. */\n active?: number\n /** Pointing at a marker, or away from it. A shell that tracks the source lights its row too. */\n onActiveChange?: (n: number | undefined) => void\n /** Drawn after the text — the conversation's caret while the answer is still being written. */\n trailing?: React.ReactNode\n}\n\n/**\n * The answer in two or three sentences, leading with the number. Markers sit\n * where the text places them (`[n]`), or after it (`cites`); pointing at one\n * lights its source in the citations when the shell tracks it. `trailing` ends\n * the text — the caret, while a conversation is still writing it.\n */\nexport function NarrativeBlock({ spec, active = spec.active, onActiveChange, trailing }: NarrativeBlockProps) {\n const marker = (n: number) => (\n <CitationMarker\n key={`cite-${n}`}\n data-active={active === n || undefined}\n onMouseEnter={() => onActiveChange?.(n)}\n onMouseLeave={() => onActiveChange?.(undefined)}\n >\n {n}\n </CitationMarker>\n )\n return (\n <p>\n {prose(spec.text, marker)}\n {spec.cites?.map(marker)}\n {trailing}\n </p>\n )\n}\n","import {\n MetricGrid,\n MetricTile,\n ProposalCard,\n PropertyList,\n PropertyRow,\n} from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ActionRow } from \"../parts/actions\"\n\n/**\n * Something the answer proposes to write: what it proposes, the draft or what\n * writing it does as figures, what writing it would do in words, and the\n * actions, each sent as its id. Nothing is written until the shell acts on one;\n * once written, a stamp says so. The shell gives it its card and its header.\n */\nexport function ProposalBlock({ spec, onAction }: BlockProps<\"proposal\">) {\n return (\n <ProposalCard\n flush\n seamless\n title={spec.heading}\n done={spec.done?.label}\n consequence={spec.consequence}\n actions={\n spec.actions.length ? (\n <ActionRow\n actions={spec.actions}\n onAction={(id) => onAction?.(\"action\", id)}\n />\n ) : undefined\n }\n >\n {spec.rows?.length ? (\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {spec.rows.map((row) => (\n <PropertyRow key={row.label} label={row.label} mono>\n {row.value}\n </PropertyRow>\n ))}\n </PropertyList>\n ) : null}\n {spec.figures?.length ? (\n <MetricGrid joined seamless minTileWidth={72}>\n {spec.figures.map((f) => (\n <MetricTile key={f.label} variant=\"figure\" label={f.label} value={f.value} />\n ))}\n </MetricGrid>\n ) : null}\n </ProposalCard>\n )\n}\n","import * as React from \"react\"\nimport { SegmentedControl } from \"@invana/ui\"\n\nimport type { BlockProps, QuickPick } from \"../types\"\nimport { AskHint, AskQuestion, AskSummary } from \"../parts/ask\"\n\ntype Row = QuickPick & { key: string }\n\n/**\n * Two to five short spec in one row — a granularity, a confidence level,\n * an output format — where picking one is the reply. With no `default`\n * nothing is picked, so the reader answers rather than accepts. An option can\n * carry a second line (`±1.4 pp`); `stretch` gives each an equal share of the\n * card. `more` adds rows answered in the same card: the value is then keyed\n * by row, and it is sent once every row has a pick.\n *\n * Answered, each row settles into a label/value pair; Change reopens them.\n */\nexport function QuickAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"quick\">) {\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const keyed = Boolean(spec.more?.length)\n const rows: Row[] = [\n { ...spec, key: spec.label ?? spec.question },\n ...(spec.more ?? []).map((r) => ({ ...r, key: r.id })),\n ]\n\n const settled = (): Record<string, string | undefined> => {\n const value = given\n if (keyed) return (value ?? {}) as Record<string, string>\n return { [rows[0]!.key]: (value as string | undefined) ?? spec.default }\n }\n const [picked, setPicked] = React.useState<Record<string, string | undefined>>(() =>\n pending ? Object.fromEntries(rows.map((r) => [r.key, r.default])) : settled(),\n )\n\n if (!pending && !editing) {\n const value = settled()\n return (\n <AskSummary\n rows={rows.map((r) => ({\n label: r.label ?? r.question,\n value: r.options.find((o) => o.value === value[r.key])?.label ?? value[r.key] ?? \"—\",\n }))}\n change={state === \"answered\" ? (keyed ? \"Change answers\" : \"Change answer\") : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const pick = (key: string, v: string) => {\n const next = { ...picked, [key]: v }\n setPicked(next)\n if (rows.some((r) => next[r.key] == null)) return\n const value = keyed ? (next as Record<string, string>) : v\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n }\n\n return (\n <>\n {rows.map((r, i) => (\n <React.Fragment key={r.key}>\n {i === 0 ? <AskQuestion text={spec} /> : <p className=\"mt-1\">{r.question}</p>}\n <SegmentedControl\n size=\"sm\"\n aria-label={r.question}\n variant=\"solid\"\n stretch={spec.stretch}\n options={r.options}\n defaultValue={picked[r.key] ?? null}\n onValueChange={(v) => pick(r.key, v)}\n />\n <AskHint>{r.hint}</AskHint>\n </React.Fragment>\n ))}\n </>\n )\n}\n","import { BarChartH } from \"@invana/charts\"\n\nimport { figureText } from \"../format\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * Items in the order they matter — drivers, top-N, likely causes — each with\n * its bar, and its value in a column at the right. A negative contribution\n * draws in the destructive colour; the rest, folded into one line, is muted.\n * `diverging` grows the bars both ways from zero.\n */\nexport function RankedBlock({ spec }: BlockProps<\"ranked\">) {\n return (\n <BarChartH\n variant=\"ranked\"\n color=\"var(--color-primary)\"\n diverging={spec.diverging}\n data={spec.items.map((item) => ({\n label: item.label,\n value: item.value,\n display: item.display ?? figureText(item.value),\n muted: item.muted,\n }))}\n />\n )\n}\n","import { Avatar, AvatarFallback, Badge, Eyebrow, PropertyList, PropertyRow } from \"@invana/ui\"\n\nimport { BADGE_TONE } from \"../format\"\nimport type { BlockProps, RecordRow } from \"../types\"\n\nfunction Rows({ rows }: { rows: RecordRow[] }) {\n return (\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {rows.map((row) => (\n <PropertyRow key={row.label} label={row.label} mono={row.mono ?? true}>\n {row.value}\n {row.source ? <span className=\"text-xs text-muted-foreground\"> · {row.source}</span> : null}\n </PropertyRow>\n ))}\n </PropertyList>\n )\n}\n\n/**\n * One entity, or the assumptions behind an answer, as label/value pairs — with\n * who it is and its state above them, rows under headings, and where each\n * value came from when that is the point.\n */\nexport function RecordBlock({ spec }: BlockProps<\"record\">) {\n const { header } = spec\n return (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {header ? (\n <div className=\"flex items-center gap-2\">\n {header.initials ? (\n <Avatar className=\"size-7 border border-border\">\n <AvatarFallback className=\"text-xs font-semibold text-muted-foreground\">\n {header.initials}\n </AvatarFallback>\n </Avatar>\n ) : null}\n <span className=\"min-w-0 truncate font-semibold\">{header.title}</span>\n {header.status ? (\n <Badge\n variant=\"soft\"\n size=\"xs\"\n tone={BADGE_TONE[header.status.tone ?? \"neutral\"]}\n className=\"ms-auto font-normal\"\n >\n {header.status.label}\n </Badge>\n ) : null}\n </div>\n ) : null}\n {spec.rows?.length ? <Rows rows={spec.rows} /> : null}\n {spec.groups?.map((group, i) => (\n <div key={group.label} className={i > 0 || spec.rows?.length ? \"mt-1 flex flex-col gap-1\" : \"flex flex-col gap-1\"}>\n <Eyebrow>{group.label}</Eyebrow>\n <Rows rows={group.rows} />\n </div>\n ))}\n </div>\n )\n}\n","import { ScopeLine } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * Period, filters, population and freshness, as the query applied them. Each\n * part is edited in place — typed, or picked from its choices — and sent as a\n * `scope` action with `{ part, value }`; a part the shell marks `fixed` — a\n * freshness, say — is a fact about the data and stays as it is. A part carried from an earlier question and changed since,\n * or resting on late data, is marked, and a hint about late data is a warning.\n */\nexport interface ScopeBlockProps extends BlockProps<\"scope\"> {\n /** Parts that are facts, not choices — a freshness the data states. Drawn, never edited. */\n fixed?: number[]\n}\n\nexport function ScopeBlock({ spec, fixed, onAction }: ScopeBlockProps) {\n const stale = spec.parts.some((p) => typeof p === \"object\" && p.mark === \"stale\")\n return (\n <ScopeLine\n parts={spec.parts}\n fixedParts={fixed}\n defaultOpenPart={spec.openPart}\n note={spec.hint}\n noteTone={stale ? \"warning\" : \"muted\"}\n seamless\n onPartChange={(part, value) => onAction?.(\"scope\", { part, value })}\n />\n )\n}\n","import * as React from \"react\"\nimport {\n Button,\n Questionnaire,\n QuestionnaireChoice,\n QuestionnaireChoiceTitle,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireInput,\n QuestionnaireItem,\n QuestionnaireTitle,\n} from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport { AskHint, AskSummary, choiceParts, isHeading, pickText } from \"../parts/ask\"\nimport { strong } from \"../prose\"\n\n/** The value an “Other…” pick holds until its words are typed. */\nconst OTHER = \"\\u0000other\"\n\n/**\n * One choice from a list the data model holds. Picking an option is the reply,\n * so the default is one keypress away — unless the ask names a `submit`, when\n * the pick waits for that button (and Skip, when `skippable`). An option can\n * carry a description under its label, a lead tag or icon before it, and a\n * figure on the right. With `other`, an “Other…” choice opens a field for the\n * analyst's own words, sent with Use this.\n *\n * Answered, it settles into one label/value pair; Change answer reopens it,\n * and picking again is a `change`.\n */\nexport function SingleAsk({ spec, state = \"pending\", value: given, id: idProp, onAction }: BlockProps<\"single\">) {\n const auto = React.useId()\n const id = idProp ?? auto\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const [picked, setPicked] = React.useState<string | undefined>(spec.default)\n const settledValue = (given as string | undefined) ?? spec.default\n\n if (!pending && !editing) {\n const option = spec.options.find((o) => o.value === settledValue)\n return (\n <AskSummary\n rows={[{ label: spec.label ?? \"Answer\", value: pickText(option, settledValue) }]}\n change={state === \"answered\" ? \"Change answer\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const send = (value: string) => {\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n }\n const pick = (value: string) => {\n setPicked(value)\n if (value !== OTHER && !spec.submit) send(value)\n }\n\n const other = picked === OTHER\n const buttons = spec.submit || spec.skippable || other\n\n return (\n <>\n <Questionnaire\n onSubmit={(e) => {\n e.preventDefault()\n if (other) {\n // The item holds the Other pick and the typed words under one name.\n const text = new FormData(e.currentTarget).getAll(id).map(String).find((v) => v !== OTHER)\n if (text?.trim()) send(text.trim())\n } else if (picked) send(picked)\n }}\n id={`${auto}-form`}\n >\n <QuestionnaireItem name={id}>\n <QuestionnaireTitle className={isHeading(spec) ? \"font-semibold\" : undefined}>\n {strong(spec.question)}\n </QuestionnaireTitle>\n {spec.description ? <QuestionnaireDescription>{spec.description}</QuestionnaireDescription> : null}\n <QuestionnaireChoices>\n {spec.options.map((o) => {\n const { props, body } = choiceParts(o)\n return (\n <QuestionnaireChoice\n key={o.value}\n value={o.value}\n {...props}\n disabled={o.disabled}\n checked={picked === o.value}\n onChange={() => pick(o.value)}\n >\n {body}\n </QuestionnaireChoice>\n )\n })}\n {spec.other ? (\n <QuestionnaireChoice value={OTHER} checked={other} onChange={() => pick(OTHER)}>\n <QuestionnaireChoiceTitle>Other…</QuestionnaireChoiceTitle>\n </QuestionnaireChoice>\n ) : null}\n </QuestionnaireChoices>\n {other ? <QuestionnaireInput aria-label=\"Your answer\" autoFocus /> : null}\n </QuestionnaireItem>\n </Questionnaire>\n <AskHint>{spec.hint}</AskHint>\n {buttons ? (\n <ClarifyActions align=\"end\">\n {spec.skippable && !other ? (\n <Button size=\"xs\" variant=\"ghost\" onClick={() => onAction?.(\"skip\")}>\n Skip\n </Button>\n ) : null}\n <Button type=\"submit\" form={`${auto}-form`} size=\"xs\" disabled={!picked}>\n {other ? \"Use this\" : (spec.submit ?? \"Use this\")}\n </Button>\n </ClarifyActions>\n ) : null}\n </>\n )\n}\n","import { SuggestionChips } from \"../parts/suggestion-chips\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * Follow-ups after an answer, each a whole prompt that reuses the current\n * scope; picking one is the reply, and the API sends it on as the next prompt.\n * They run along a line, stack one per line, or sit under headings.\n *\n * Answered, the one picked stays, dimmed, and the rest can still be sent: each\n * is its own next question. Superseded or expired, none can.\n */\nexport function SuggestionsAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"suggestions\">) {\n const open = state === \"pending\" || state === \"answered\"\n const picked = typeof given === \"string\" ? [given] : []\n const all = spec.groups?.length ? spec.groups.flatMap((g) => g.items) : (spec.items ?? [])\n return (\n <SuggestionChips\n items={spec.items}\n groups={spec.groups}\n layout={spec.layout}\n sent={open ? picked : all}\n onSelect={(text) => onAction?.(\"reply\", text)}\n />\n )\n}\n","import { cn } from \"@invana/ui\"\nimport { DataTable, type ColumnDef } from \"@invana/tables\"\n\nimport { figureText } from \"../format\"\nimport type { BlockProps, Cell } from \"../types\"\n\ntype Row = Record<string, Cell>\n\n/** Wider than this many columns, a table keeps them legible and scrolls sideways. */\nconst FITS = 5\n/** The narrowest a column is drawn once the table scrolls, in px. */\nconst COLUMN_MIN = 66\n\n/** A cell's figure as text — what a row's key is compared and sent as. */\nfunction cellText(cell: Cell): string | undefined {\n if (cell == null) return undefined\n if (typeof cell !== \"object\" || !(\"value\" in cell) || \"type\" in cell) return figureText(cell)\n return figureText(cell.value)\n}\n\n/**\n * One cell. A good or bad change is inked by its tone, and the figure a row\n * turns on is strong; an empty cell is a dash, never blank.\n */\nfunction CellText({ cell }: { cell: Cell }) {\n if (cell == null) return <>—</>\n if (typeof cell !== \"object\" || !(\"value\" in cell) || \"type\" in cell) {\n return <>{figureText(cell)}</>\n }\n return (\n <span\n className={cn(\n cell.tone === \"good\" && \"text-success\",\n cell.tone === \"bad\" && \"text-destructive\",\n cell.strong && \"font-semibold\",\n )}\n >\n {figureText(cell.value)}\n </span>\n )\n}\n\n/**\n * The first rows of a longer table, and how many there are in all. When rows\n * are held back, `Open all` asks for them with the `open` action. The column the\n * rows are ordered by is marked, rows an answer turns on are called out, and a\n * total sits under the rows in bold. With a `rowKey`, picking a row sends\n * `select` with its key, and the `selected` row is drawn picked.\n */\nexport function TableBlock({ spec, onAction, seamless }: BlockProps<\"table\">) {\n const truncated = spec.total != null && spec.total > spec.rows.length\n const highlighted = new Set(spec.highlight?.map((i) => spec.rows[i]))\n const data = spec.totals ? [...spec.rows, spec.totals] : spec.rows\n const columns: ColumnDef<Row>[] = spec.columns.map((c) => {\n const sorted = spec.sort?.key === c.key ? spec.sort.dir : undefined\n return {\n id: c.key,\n header: sorted\n ? () => <span className=\"text-foreground\">{`${c.label} ${sorted === \"asc\" ? \"▴\" : \"▾\"}`}</span>\n : c.label,\n accessorFn: (row) => row[c.key],\n cell: (ctx) => <CellText cell={ctx.getValue() as Cell} />,\n meta: { align: c.align, cellClassName: cn(\"whitespace-nowrap\", c.mono && \"font-mono\") },\n }\n })\n const { rowKey } = spec\n const keyOf = (row: Row) => (rowKey != null && row !== spec.totals ? cellText(row[rowKey]) : undefined)\n const noun = [spec.noun, spec.note].filter(Boolean).join(\" · \") || undefined\n return (\n <DataTable\n columns={columns}\n data={data}\n density=\"compact\"\n // The shell frames a block, so the table draws no box of its own.\n bordered={false}\n seamless={seamless}\n enableSorting={false}\n enableColumnVisibility={false}\n minWidth={spec.columns.length > FITS ? spec.columns.length * COLUMN_MIN : undefined}\n isRowHighlighted={highlighted.size ? (row) => highlighted.has(row) : undefined}\n isTotalRow={spec.totals ? (row) => row === spec.totals : undefined}\n isRowSelected={spec.selected != null ? (row) => keyOf(row) === spec.selected : undefined}\n onRowClick={\n rowKey != null && onAction\n ? (row) => {\n const key = keyOf(row)\n if (key != null) onAction(\"select\", key)\n }\n : undefined\n }\n preview={{\n total: spec.total,\n noun,\n onOpen: truncated && onAction ? () => onAction(\"open\") : undefined,\n }}\n />\n )\n}\n","import * as React from \"react\"\nimport { StatusDot, TimelineEntry, TimelineList, TimelineSection, type StatusDotProps } from \"@invana/ui\"\n\nimport type { BlockProps, TimelineEvent, Tone } from \"../types\"\n\n/** The grammar's tones, as the dot's. An event with none is a plain marker. */\nconst DOT_TONE: Record<Tone, StatusDotProps[\"tone\"]> = {\n good: \"success\",\n bad: \"error\",\n warn: \"warning\",\n neutral: \"muted\",\n}\n\n/** A run of events, each with its section label where a new one starts, and its own events under it. */\nfunction Events({ events }: { events: TimelineEvent[] }) {\n return (\n <>\n {events.map((event, i) => (\n <React.Fragment key={i}>\n {event.section && event.section !== events[i - 1]?.section ? (\n <TimelineSection>{event.section}</TimelineSection>\n ) : null}\n <TimelineEntry\n when={event.when}\n marker={<StatusDot tone={DOT_TONE[event.tone ?? \"neutral\"]} size=\"md\" />}\n highlight={event.highlight ? \"error\" : undefined}\n nested={event.children?.length ? <Events events={event.children} /> : undefined}\n defaultOpen={event.open}\n >\n {event.text}\n {event.detail ? <span className=\"text-xs text-muted-foreground\">{event.detail}</span> : null}\n </TimelineEntry>\n </React.Fragment>\n ))}\n </>\n )\n}\n\n/**\n * A few dated events, in order, each marked by what it did to the figure — with\n * a detail line under an event, and labelled runs of events around the one an\n * answer is about, which is called out. An event that breaks into smaller ones\n * opens into them, so a three-day hold can be read step by step.\n */\nexport function TimelineBlock({ spec }: BlockProps<\"timeline\">) {\n return (\n <TimelineList variant=\"compact\">\n <Events events={spec.events} />\n </TimelineList>\n )\n}\n","import { LineChart } from \"@invana/charts\"\n\nimport { figureText } from \"../format\"\nimport type { BlockProps, Tone } from \"../types\"\n\n/** The tones, as the tokens a ring is drawn in. */\nconst RING_COLOR: Record<Tone, string> = {\n good: \"var(--color-success)\",\n bad: \"var(--color-destructive)\",\n warn: \"var(--color-warning)\",\n neutral: \"var(--color-muted-foreground)\",\n}\n\n/**\n * A measure over time: the line in the foreground, the range it is judged\n * against shaded in primary beneath it, and the periods that stand out ringed\n * in their tone. A reference — an alert level, a budget — is a dashed rule,\n * and every point over it is ringed as a breach; a missing point breaks the\n * line. The first series is the line; any others are drawn behind it to read\n * it against, each named at its right end. A period is named by its label.\n */\nexport function TimeseriesBlock({ spec }: BlockProps<\"timeseries\">) {\n const series = spec.series[0]\n if (!series) return null\n const labels = series.points.map(([at]) => at)\n const values = series.points.map(([, value]) => value)\n const at = (label: string | undefined) => (label == null ? -1 : labels.indexOf(label))\n const forecastFrom = at(spec.forecastFrom)\n // Above the reference: a breach, ringed in the bad tone.\n const breaches = spec.reference\n ? values.flatMap((value, index) => (value != null && value > spec.reference!.value ? [{ index, color: RING_COLOR.bad }] : []))\n : []\n const format = (value: number) => {\n const n = figureText(Math.round(value * 10) / 10)\n return spec.unit ? `${n} ${spec.unit}` : n\n }\n return (\n <LineChart\n aria-label={series.name}\n values={values}\n name={series.name}\n compare={spec.series.slice(1).map((other) => ({\n name: other.name,\n // Aligned on the first series' periods: a period it lacks is a gap.\n values: labels.map((label) => other.points.find(([at]) => at === label)?.[1] ?? null),\n }))}\n labels={labels}\n format={format}\n zero={false}\n color=\"var(--color-foreground)\"\n band={spec.band && { ...spec.band, color: \"var(--color-primary)\" }}\n reference={spec.reference}\n highlights={[...(spec.marks ?? []).map((mark) => ({ index: at(mark.at), color: RING_COLOR[mark.tone ?? \"neutral\"] })), ...breaches]\n .filter((mark) => mark.index >= 0)}\n forecastFrom={forecastFrom >= 0 ? forecastFrom : undefined}\n forecastLabel={spec.forecastLabel}\n />\n )\n}\n","import * as React from \"react\"\nimport { TraceList, TraceStep } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ChatSessionDisclosure } from \"@invana/ui\"\nimport { ActionRow } from \"../parts/actions\"\n\n/**\n * What the answer is doing, step by step, while it runs — and the record of it\n * after, folded to one line. A failed step says why under it, with what can be\n * done about it; a step held on the analyst waits hollow, in the info tone.\n */\nexport function TraceBlock({ spec, onAction }: BlockProps<\"trace\">) {\n const [open, setOpen] = React.useState(!spec.folded)\n const list = (\n <TraceList variant=\"progress\">\n {spec.steps.map((step, i) => (\n <TraceStep\n key={step.id ?? i}\n name={step.label}\n duration={step.detail}\n status={step.state}\n error={step.error}\n />\n ))}\n </TraceList>\n )\n const actions = spec.actions?.length ? (\n <ActionRow actions={spec.actions} onAction={(id) => onAction?.(\"action\", id)} />\n ) : null\n if (!spec.folded) {\n return (\n <>\n {list}\n {actions}\n </>\n )\n }\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={`${spec.steps.length} steps`}\n meta={spec.summary}\n open={open}\n onOpenChange={setOpen}\n >\n {list}\n </ChatSessionDisclosure>\n )\n}\n","import type * as React from \"react\"\n\nimport { ActivityBlock } from \"./blocks/activity\"\nimport { BarsBlock } from \"./blocks/bars\"\nimport { CannotBlock } from \"./blocks/cannot\"\nimport { CaveatBlock } from \"./blocks/caveat\"\nimport { CitationsBlock } from \"./blocks/citations\"\nimport { ConfirmAsk } from \"./blocks/confirm\"\nimport { FilesBlock } from \"./blocks/files\"\nimport { FormAsk } from \"./blocks/form\"\nimport { GanttBlock } from \"./blocks/gantt\"\nimport { GridBlock } from \"./blocks/grid\"\nimport { HeatStripBlock } from \"./blocks/heatstrip\"\nimport { MethodBlock } from \"./blocks/method\"\nimport { MetricBlock } from \"./blocks/metric\"\nimport { MultiAsk } from \"./blocks/multi\"\nimport { MultistepAsk } from \"./blocks/multistep\"\nimport { NarrativeBlock } from \"./blocks/narrative\"\nimport { ProposalBlock } from \"./blocks/proposal\"\nimport { QuickAsk } from \"./blocks/quick\"\nimport { RankedBlock } from \"./blocks/ranked\"\nimport { RecordBlock } from \"./blocks/record\"\nimport { ScopeBlock } from \"./blocks/scope\"\nimport { SingleAsk } from \"./blocks/single\"\nimport { SuggestionsAsk } from \"./blocks/suggestions\"\nimport { TableBlock } from \"./blocks/table\"\nimport { TimelineBlock } from \"./blocks/timeline\"\nimport { TimeseriesBlock } from \"./blocks/timeseries\"\nimport { TraceBlock } from \"./blocks/trace\"\nimport type { BlockKind, BlockProps } from \"./types\"\n\n/** What draws each kind; `null` is a kind with no renderer yet, drawn as a labelled placeholder. */\nexport type BlockRenderers = { [K in BlockKind]: React.ComponentType<BlockProps<K>> | null }\n\n/** Keyed by every kind, so a kind added to the list and not here does not compile. */\nexport const BLOCK_RENDERERS: BlockRenderers = {\n confirm: ConfirmAsk,\n single: SingleAsk,\n multi: MultiAsk,\n quick: QuickAsk,\n period: null,\n number: null,\n short: null,\n long: null,\n entity: null,\n scale: null,\n multistep: MultistepAsk,\n form: FormAsk,\n weights: null,\n approval: null,\n interpretation: null,\n fork: null,\n plan: null,\n modelspec: null,\n hypothesis: null,\n range: null,\n suggestions: SuggestionsAsk,\n narrative: NarrativeBlock,\n metric: MetricBlock,\n grid: GridBlock,\n table: TableBlock,\n attr: null,\n record: RecordBlock,\n ranked: RankedBlock,\n timeseries: TimeseriesBlock,\n bars: BarsBlock,\n waterfall: null,\n matrix: null,\n funnel: null,\n histogram: null,\n timeline: TimelineBlock,\n subgraph: null,\n method: MethodBlock,\n citations: CitationsBlock,\n files: FilesBlock,\n proposal: ProposalBlock,\n cannot: CannotBlock,\n caveat: CaveatBlock,\n scope: ScopeBlock,\n checks: null,\n trace: TraceBlock,\n activity: ActivityBlock,\n gantt: GanttBlock,\n heatstrip: HeatStripBlock,\n test: null,\n coef: null,\n forest: null,\n scatter: null,\n box: null,\n correlation: null,\n control: null,\n pareto: null,\n survival: null,\n tornado: null,\n decomposition: null,\n modeleval: null,\n pivot: null,\n profile: null,\n evidence: null,\n dumbbell: null,\n quantiles: null,\n}\n","/**\n * Where in a spec a patch lands, from its root: a name reads a field of an\n * object; on a list, a name is the item whose `key` (or `id`) it is, and a\n * number is an index. `[\"tasks\", \"plan\", \"subtasks\"]` is the subtasks of the\n * task keyed `plan`. Empty, it is the spec itself.\n */\nexport type PatchPath = (string | number)[]\n\n/**\n * How a block changes while it streams — the same four ways for every kind,\n * so a conversation, a board or a page streams any block alike. The API sends\n * these; {@link applyBlockPatch} returns a new spec and never mutates the old.\n *\n * A merge (`set`, `upsert`) is a JSON merge patch one level deep: a field sent\n * as `null` is removed — the *now* line dropped as a run ends — since JSON\n * cannot send `undefined`.\n */\nexport type BlockPatch =\n /** Merge `fields` into the object at `at` — the clock moving, a run settling. */\n | { op: \"set\"; at?: PatchPath; fields: Record<string, unknown> }\n /** Add `text` to the end of the string at `at` — a narrative's words. */\n | { op: \"append\"; at: PatchPath; text: string }\n /** Add `items` to the end of the list at `at` — a chart's points, a table's rows. */\n | { op: \"push\"; at: PatchPath; items: unknown[] }\n /**\n * Merge `item` into the list item at `at` with the same `key` (or `id`), or\n * add it at the end — a task starting, then settling.\n */\n | { op: \"upsert\"; at: PatchPath; item: Record<string, unknown> }\n\nexport type BlockPatchOp = BlockPatch[\"op\"]\n\nexport class BlockPatchError extends Error {}\n\ntype Obj = Record<string, unknown>\n\nconst isObj = (v: unknown): v is Obj => typeof v === \"object\" && v !== null && !Array.isArray(v)\n\n/** `fields` merged over `target`; a field sent as `null` is removed. */\nfunction merge(target: Obj, fields: Obj): Obj {\n const next = { ...target, ...fields }\n for (const [name, value] of Object.entries(fields)) if (value === null) delete next[name]\n return next\n}\n\n/** An item's identity on a list: its `key`, else its `id`. */\nconst identity = (item: unknown) => (isObj(item) ? (item.key ?? item.id) : undefined)\n\nconst where = (path: PatchPath, depth: number) => JSON.stringify(path.slice(0, depth))\n\n/** The index `segment` names on `list` — by position, or by key. */\nfunction indexOn(list: unknown[], segment: string | number, path: PatchPath, depth: number) {\n const at = typeof segment === \"number\" ? segment : list.findIndex((item) => identity(item) === segment)\n if (at < 0 || at >= list.length) throw new BlockPatchError(`No item ${JSON.stringify(segment)} at ${where(path, depth)}.`)\n return at\n}\n\n/**\n * `node` with the value at `path[depth..]` replaced by `fn(value)`, copying\n * only along the path. A missing field reads as `undefined`, so `fn` can\n * create it — a first `push` makes the list.\n */\nfunction update(node: unknown, path: PatchPath, depth: number, fn: (value: unknown) => unknown): unknown {\n if (depth === path.length) return fn(node)\n const segment = path[depth]\n if (Array.isArray(node)) {\n const at = indexOn(node, segment, path, depth)\n const next = node.slice()\n next[at] = update(node[at], path, depth + 1, fn)\n return next\n }\n if (isObj(node) && typeof segment === \"string\") {\n return { ...node, [segment]: update(node[segment], path, depth + 1, fn) }\n }\n throw new BlockPatchError(`Nothing to read ${JSON.stringify(segment)} from at ${where(path, depth)}.`)\n}\n\nfunction patchValue(value: unknown, patch: BlockPatch): unknown {\n const at = JSON.stringify(patch.at ?? [])\n switch (patch.op) {\n case \"set\":\n if (!isObj(value)) throw new BlockPatchError(`\"set\": ${at} is not an object.`)\n return merge(value, patch.fields)\n case \"append\":\n if (value !== undefined && typeof value !== \"string\") throw new BlockPatchError(`\"append\": ${at} is not text.`)\n return (value ?? \"\") + patch.text\n case \"push\":\n if (value !== undefined && !Array.isArray(value)) throw new BlockPatchError(`\"push\": ${at} is not a list.`)\n return [...((value as unknown[]) ?? []), ...patch.items]\n case \"upsert\": {\n if (value !== undefined && !Array.isArray(value)) throw new BlockPatchError(`\"upsert\": ${at} is not a list.`)\n const id = identity(patch.item)\n if (id === undefined) throw new BlockPatchError(`\"upsert\": the item at ${at} has no key or id.`)\n const list = (value as unknown[]) ?? []\n const found = list.findIndex((item) => identity(item) === id)\n if (found < 0) return [...list, merge({}, patch.item)]\n return list.map((item, i) => (i === found ? merge(item as Obj, patch.item) : item))\n }\n }\n}\n\n/**\n * A block's spec after one patch. Any spec — a block's options, or a block\n * spec with its `kind`, which no patch can change.\n */\nexport function applyBlockPatch<S extends object>(spec: S, patch: BlockPatch): S {\n const next = update(spec, patch.at ?? [], 0, (value) => patchValue(value, patch)) as S\n return \"kind\" in spec ? ({ ...next, kind: (spec as Obj).kind } as S) : next\n}\n\n/** Apply patches in order — a recorded stream, replayed. */\nexport function applyBlockPatches<S extends object>(spec: S, patches: BlockPatch[]): S {\n return patches.reduce<S>(applyBlockPatch, spec)\n}\n","import type { BlockPatch } from \"./patch\"\n\n/**\n * A spec arrives once, then as patches. These are the ways the patches can\n * arrive — one at a time or in batches, from a fetch body, an EventSource, a\n * generator, or a recorded script — read the same way by every shell that\n * streams: a block (`useBlockStream`), a conversation, a board. `P` is the\n * shell's patch; a block's is {@link BlockPatch}.\n */\nexport type PatchChunk<P = BlockPatch> = P | P[]\nexport type PatchSource<P = BlockPatch> = AsyncIterable<PatchChunk<P>> | Iterable<PatchChunk<P>>\n\nconst toArray = <P>(chunk: PatchChunk<P>) => (Array.isArray(chunk) ? chunk : [chunk])\n\n/** Every patch of a source, in the batches they arrived in. */\nexport async function* patchesOf<P = BlockPatch>(source: PatchSource<P>): AsyncGenerator<P[]> {\n for await (const chunk of source as AsyncIterable<PatchChunk<P>>) yield toArray(chunk)\n}\n\n// ── wire adapters ───────────────────────────────────────────────────────────\n\n/**\n * Patches from a newline-delimited JSON body: one patch, or an array of them,\n * per line. Pass the `Response` of a streaming `fetch`, or its body.\n */\nexport async function* fromNdjson<P = BlockPatch>(\n input: Response | ReadableStream<Uint8Array>,\n): AsyncGenerator<PatchChunk<P>> {\n const body = input instanceof Response ? input.body : input\n if (!body) return\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffered = \"\"\n try {\n for (;;) {\n const { value, done } = await reader.read()\n buffered += decoder.decode(value, { stream: !done })\n let newline = buffered.indexOf(\"\\n\")\n while (newline >= 0) {\n const line = buffered.slice(0, newline).trim()\n buffered = buffered.slice(newline + 1)\n if (line) yield JSON.parse(line) as PatchChunk<P>\n newline = buffered.indexOf(\"\\n\")\n }\n if (done) break\n }\n const rest = buffered.trim()\n if (rest) yield JSON.parse(rest) as PatchChunk<P>\n } finally {\n reader.releaseLock()\n }\n}\n\nexport interface EventSourceOptions {\n /** The event whose data is a patch. @default \"message\" */\n event?: string\n /** The event that ends the stream. @default \"done\" */\n done?: string\n /** Close the EventSource when the stream ends. @default true */\n close?: boolean\n}\n\n/** Patches from Server-Sent Events: each event's `data` is a patch, or an array of them. */\nexport async function* fromEventSource<P = BlockPatch>(\n source: EventSource,\n { event = \"message\", done = \"done\", close = true }: EventSourceOptions = {},\n): AsyncGenerator<PatchChunk<P>> {\n const queue: PatchChunk<P>[] = []\n let finished = false\n let failure: unknown\n let wake: (() => void) | undefined\n const notify = () => {\n wake?.()\n wake = undefined\n }\n const onData = (e: MessageEvent) => {\n try {\n queue.push(JSON.parse(e.data as string) as PatchChunk<P>)\n } catch (error) {\n failure = error\n }\n notify()\n }\n const onDone = () => {\n finished = true\n notify()\n }\n const onError = () => {\n // EventSource reconnects on its own while CONNECTING; CLOSED is the end.\n if (source.readyState === EventSource.CLOSED) onDone()\n }\n source.addEventListener(event, onData as EventListener)\n source.addEventListener(done, onDone)\n source.addEventListener(\"error\", onError)\n try {\n for (;;) {\n if (failure) throw failure\n const next = queue.shift()\n if (next) {\n yield next\n continue\n }\n if (finished) return\n await new Promise<void>((resolve) => (wake = resolve))\n }\n } finally {\n source.removeEventListener(event, onData as EventListener)\n source.removeEventListener(done, onDone)\n source.removeEventListener(\"error\", onError)\n if (close) source.close()\n }\n}\n\n// ── recorded scripts ────────────────────────────────────────────────────────\n\n/** A patch and when it lands, in ms from the start of the script. */\nexport interface ScriptStep<P = BlockPatch> {\n at: number\n patch: PatchChunk<P>\n}\n\n/** A recorded stream: plain JSON, replayed by {@link playScript} or step by step with {@link scriptFrames}. */\nexport type PatchScript<P = BlockPatch> = ScriptStep<P>[]\n\nexport interface PlayOptions {\n /** 2 plays twice as fast. @default 1 */\n speed?: number\n signal?: AbortSignal\n}\n\nfunction sleep(ms: number, signal?: AbortSignal) {\n return new Promise<void>((resolve) => {\n if (signal?.aborted || ms <= 0) return resolve()\n const timer = setTimeout(done, ms)\n function done() {\n clearTimeout(timer)\n signal?.removeEventListener(\"abort\", done)\n resolve()\n }\n signal?.addEventListener(\"abort\", done, { once: true })\n })\n}\n\n/**\n * A script's patches, batched by when they land: one batch per moment, in\n * order — what {@link playScript} yields, without the waiting.\n */\nexport function scriptFrames<P>(script: PatchScript<P>): { at: number; patches: P[] }[] {\n const frames: { at: number; patches: P[] }[] = []\n for (const step of [...script].sort((a, b) => a.at - b.at)) {\n const last = frames[frames.length - 1]\n if (last?.at === step.at) last.patches.push(...toArray(step.patch))\n else frames.push({ at: step.at, patches: toArray(step.patch) })\n }\n return frames\n}\n\n/**\n * A script as a stream: each step is yielded when it is due. Steps due at the\n * same moment are yielded together; aborting ends the stream where it stands.\n */\nexport async function* playScript<P>(\n script: PatchScript<P>,\n { speed = 1, signal }: PlayOptions = {},\n): AsyncGenerator<P[]> {\n let clock = 0\n for (const frame of scriptFrames(script)) {\n if (signal?.aborted) return\n await sleep((frame.at - clock) / speed, signal)\n if (signal?.aborted) return\n clock = frame.at\n yield frame.patches\n }\n}\n\n/** Shift every step of a script by `ms` — to chain scripts one after another. */\nexport const offsetScript = <P>(script: PatchScript<P>, ms: number): PatchScript<P> =>\n script.map((s) => ({ ...s, at: s.at + ms }))\n\n/** When a script's last step lands. */\nexport const scriptLength = <P>(script: PatchScript<P>) => script.reduce((m, s) => Math.max(m, s.at), 0)\n","import * as React from \"react\"\n\nimport { applyBlockPatches, type BlockPatch } from \"./patch\"\nimport { patchesOf, type PatchSource } from \"./source\"\n\n/**\n * Patches to apply as they arrive — a streaming fetch (`fromNdjson`), an\n * EventSource (`fromEventSource`), a generator, or a recorded script\n * (`playScript`). Pass a function, `(signal) => source`, to open the source\n * afresh each time the shell mounts — a generator can be read only once. Keep\n * it stable (module scope, `useCallback`): a new one starts a new stream.\n */\nexport type SpecStream<P = BlockPatch> = PatchSource<P> | ((signal: AbortSignal) => PatchSource<P>) | null\n\nexport interface StreamOptions<S, P> {\n /** The stream ended; the spec as it left it. */\n onEnd?: (spec: S) => void\n /** A patch did not apply, or the source failed. The stream stops there. */\n onError?: (error: unknown) => void\n /** What stopping records — the patches that mark what was running as stopped. */\n stopPatches?: (spec: S) => P[]\n}\n\n/**\n * The spec as drawn: the one given, with `stream`'s patches applied by `apply`\n * as they arrive. A new spec starts over from it; `stop()` ends the stream and\n * records how far it got. Every shell that streams — a block, a conversation,\n * a board — reads its stream through this, with its own patch.\n */\nexport function useStreamedSpec<S, P>(\n spec: S,\n stream: SpecStream<P> | undefined,\n apply: (spec: S, patches: P[]) => S,\n { onEnd, onError, stopPatches }: StreamOptions<S, P> = {},\n) {\n const [base, setBase] = React.useState(spec)\n const [live, setLive] = React.useState(spec)\n // A new spec starts over from it, in the same render. With nothing\n // streaming the spec is drawn as given, and nothing is held.\n if (stream && base !== spec) {\n setBase(spec)\n setLive(spec)\n }\n const current = React.useRef(spec)\n const abort = React.useRef<AbortController | null>(null)\n const latest = React.useRef({ apply, onEnd, onError, stopPatches })\n React.useLayoutEffect(() => {\n latest.current = { apply, onEnd, onError, stopPatches }\n current.current = live\n })\n\n const set = React.useCallback((next: S) => {\n current.current = next\n setLive(next)\n }, [])\n\n React.useEffect(() => {\n if (!stream) return\n const controller = new AbortController()\n abort.current = controller\n void (async () => {\n try {\n const source = typeof stream === \"function\" ? stream(controller.signal) : stream\n for await (const batch of patchesOf(source)) {\n if (controller.signal.aborted) return\n set(latest.current.apply(current.current, batch))\n }\n if (!controller.signal.aborted) latest.current.onEnd?.(current.current)\n } catch (error) {\n if (!controller.signal.aborted) latest.current.onError?.(error)\n } finally {\n if (abort.current === controller) abort.current = null\n }\n })()\n return () => controller.abort()\n }, [stream, set])\n\n const stop = React.useCallback(() => {\n if (!abort.current) return\n abort.current.abort()\n abort.current = null\n const { apply, stopPatches } = latest.current\n if (stopPatches) set(apply(current.current, stopPatches(current.current)))\n }, [set])\n\n return { live: stream ? live : spec, stop }\n}\n\n/**\n * One block's spec, streamed: `spec` with `stream`'s {@link BlockPatch}es\n * applied as they arrive. `<Block stream>` reads it; a shell that draws a\n * block directly calls it.\n *\n * ```tsx\n * const { live } = useBlockStream(spec, (signal) => fromNdjson(await fetch(url, { signal })))\n * <GanttBlock spec={live} />\n * ```\n */\nexport function useBlockStream<S extends object>(\n spec: S,\n stream: SpecStream<BlockPatch> | undefined,\n options?: Omit<StreamOptions<S, BlockPatch>, \"stopPatches\">,\n) {\n return useStreamedSpec<S, BlockPatch>(spec, stream, applyBlockPatches, options)\n}\n","import type * as React from \"react\"\n\nimport { Placeholder } from \"./placeholder\"\nimport { BLOCK_RENDERERS } from \"./registry\"\nimport { type BlockPatch, type SpecStream, useBlockStream } from \"./stream\"\nimport type { AskState, BlockKind, BlockProps, BlockSpec } from \"./types\"\n\nexport interface BlockComponentProps {\n spec: BlockSpec\n onAction?: (action: string, value?: unknown) => void\n /** Where a block that returns a value stands. Unset, it is open. */\n state?: AskState\n /** The value given, once answered. */\n value?: unknown\n id?: string\n /**\n * Set into running text: the outer cells of a table sit flush with the words\n * around it. The assistant sets it; a board panel or a page section does not,\n * so its tables keep their padding.\n */\n seamless?: boolean\n /**\n * Patches to `spec` as they arrive — the block draws `spec` with them\n * applied, and a new `spec` starts over from it. See `useBlockStream`.\n */\n stream?: SpecStream<BlockPatch>\n /** The stream ended; the spec as it left it. */\n onStreamEnd?: (spec: BlockSpec) => void\n /** A patch did not apply, or the source failed. The stream stops there. */\n onStreamError?: (error: unknown) => void\n}\n\n/**\n * One block, drawn bare from its spec: no card, no title. The shell around it\n * — an answer card, a question card, a `PanelBox`, a page section — adds the\n * frame. A kind with no renderer yet is a labelled placeholder with its JSON.\n */\nexport function Block({ spec, stream, onStreamEnd, onStreamError, ...props }: BlockComponentProps) {\n const { live } = useBlockStream(spec, stream, { onEnd: onStreamEnd, onError: onStreamError })\n const Renderer = BLOCK_RENDERERS[live.kind] as React.ComponentType<BlockProps<BlockKind>> | null\n if (!Renderer) return <Placeholder kind={live.kind} options={live} />\n return <Renderer spec={live} {...props} />\n}\n","import * as React from \"react\"\nimport { cn, SectionHeader, TypographyH3, TypographyMuted } from \"@invana/ui\"\n\nimport { Block } from \"./block\"\nimport type { BlockSpec } from \"./types\"\n\nexport interface PageSection {\n title?: string\n description?: string\n blocks: BlockSpec[]\n}\n\n/** A page as JSON: a report, or a long answer opened in full. */\nexport interface PageSpec {\n title?: string\n description?: string\n sections: PageSection[]\n}\n\nexport interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n spec: PageSpec\n /**\n * A block's action, with where the block sits and what it carries — `open` on\n * a table in section 1, `select` with the row's key as `value`.\n */\n onAction?: (action: string, at: { section: number; block: number; value?: unknown }) => void\n}\n\n/**\n * Blocks laid out as a document: sections top to bottom, each block bare, no\n * cards and no borders. A section's title is its rule; a page's title is its\n * heading. The same specs a conversation turn or a board panel draws.\n */\nexport const Page = React.forwardRef<HTMLElement, PageProps>(({ spec, onAction, className, ...props }, ref) => (\n <article ref={ref} className={cn(\"flex min-w-0 flex-col gap-6\", className)} {...props}>\n {spec.title || spec.description ? (\n <header className=\"flex flex-col gap-1\">\n {spec.title ? <TypographyH3>{spec.title}</TypographyH3> : null}\n {spec.description ? <TypographyMuted>{spec.description}</TypographyMuted> : null}\n </header>\n ) : null}\n {spec.sections.map((section, s) => (\n <section key={s} className=\"flex min-w-0 flex-col gap-3\">\n {section.title ? <SectionHeader title={section.title} /> : null}\n {section.description ? <TypographyMuted>{section.description}</TypographyMuted> : null}\n {section.blocks.map((block, b) => (\n <Block\n key={b}\n spec={block}\n onAction={\n onAction\n ? (action, value) =>\n onAction(action, value === undefined ? { section: s, block: b } : { section: s, block: b, value })\n : undefined\n }\n />\n ))}\n </section>\n ))}\n </article>\n))\nPage.displayName = \"Page\"\n"]}
1
+ {"version":3,"sources":["../src/kinds.ts","../src/values.ts","../src/parts/actions.tsx","../src/prose.tsx","../src/blocks/activity.tsx","../src/blocks/bars.tsx","../src/parts/suggestion-chips.tsx","../src/blocks/cannot.tsx","../src/blocks/caveat.tsx","../src/format.ts","../src/blocks/citations.tsx","../src/parts/confirm-card.tsx","../src/parts/ask.tsx","../src/blocks/confirm.tsx","../src/blocks/files.tsx","../src/blocks/form.tsx","../src/blocks/gantt.tsx","../src/blocks/grid.tsx","../src/blocks/heatstrip.tsx","../src/blocks/method.tsx","../src/blocks/metric.tsx","../src/blocks/multi.tsx","../src/placeholder.tsx","../src/blocks/multistep.tsx","../src/blocks/narrative.tsx","../src/blocks/proposal.tsx","../src/blocks/quick.tsx","../src/blocks/ranked.tsx","../src/blocks/record.tsx","../src/blocks/scope.tsx","../src/blocks/single.tsx","../src/blocks/suggestions.tsx","../src/blocks/table.tsx","../src/blocks/timeline.tsx","../src/blocks/timeseries.tsx","../src/blocks/trace.tsx","../src/registry.ts","../src/stream/patch.ts","../src/stream/source.ts","../src/stream/use-stream.ts","../src/block.tsx","../src/page.tsx"],"names":["jsx","ClarifyActions","jsxs","React","Button","figure","React2","Fragment","cn","HeatLane","React3","PropertyList","PropertyRow","BarChartV","React4","Eyebrow","CannotAnswerCard","CaveatNote","React5","ChatSessionDisclosure","React6","CitationList","CitationRow","tone","React7","ClarifyFootnote","Kbd","QuestionnaireChoiceTitle","QuestionnaireChoiceDescription","ArtifactCard","Badge","ArtifactTable","React8","useForm","Form","ObjectField","React9","Gantt","MetricGrid","MetricTile","toRow","openKeys","React10","HeatStrip","React11","ChatSessionDisclosureCode","ChatSessionDisclosureSteps","Sparkline","React12","Questionnaire","QuestionnaireItem","QuestionnaireTitle","QuestionnaireDescription","QuestionnaireChoices","QuestionnaireChoice","QuestionnaireInput","React13","step","initial","QuestionnaireProgress","QuestionnaireActions","QuestionnairePrevious","QuestionnaireSkip","QuestionnaireNext","QuestionnaireSubmit","QuestionnaireProgressBar","CitationMarker","ProposalCard","React14","SegmentedControl","BarChartH","Avatar","AvatarFallback","ScopeLine","React15","DataTable","React16","TimelineSection","TimelineEntry","StatusDot","TimelineList","at","LineChart","React17","TraceList","TraceStep","React18","apply","stopPatches","React19","TypographyH3","TypographyMuted","SectionHeader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,IAAM,MAAA,GAAS;AAAA,EACpB,EAAE,IAAI,SAAA,EAAW,IAAA,EAAM,WAAW,OAAA,EAAS,SAAA,EAAW,MAAM,OAAA,EAAQ;AAAA,EACpE,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,iBAAiB,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACxE,EAAE,IAAI,OAAA,EAAS,IAAA,EAAM,mBAAmB,OAAA,EAAS,UAAA,EAAY,MAAM,OAAA,EAAQ;AAAA,EAC3E,EAAE,IAAI,OAAA,EAAS,IAAA,EAAM,cAAc,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACpE,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,UAAU,OAAA,EAAS,mBAAA,EAAqB,MAAM,OAAA,EAAQ;AAAA,EAC5E,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,UAAU,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACjE,EAAE,IAAI,OAAA,EAAS,IAAA,EAAM,cAAc,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EACpE,EAAE,IAAI,MAAA,EAAQ,IAAA,EAAM,aAAa,OAAA,EAAS,QAAA,EAAU,MAAM,OAAA,EAAQ;AAAA,EAClE,EAAE,IAAI,QAAA,EAAU,IAAA,EAAM,eAAe,OAAA,EAAS,MAAA,EAAQ,MAAM,MAAA,EAAO;AAAA,EACnE,EAAE,IAAI,OAAA,EAAS,IAAA,EAAM,SAAS,OAAA,EAAS,UAAA,EAAO,MAAM,OAAA,EAAQ;AAAA,EAC5D,EAAE,IAAI,WAAA,EAAa,IAAA,EAAM,cAAc,OAAA,E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B,IAAA;AAAA,IACzD,KAAK,WAAA,mBAAc1F,eAAC2F,kBAAA,EAAA,EAAiB,QAAA,EAAA,IAAA,CAAK,aAAY,CAAA,GAAqB;AAAA,GAAA,EAC9E,CAAA,GACE,IAAA;AAAA,EACH,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,EAAS,sBAC3BzF,eAAAA,CAAC,SAAA,EAAA,EAAgB,SAAA,EAAU,6BAAA,EACxB,QAAA,EAAA;AAAA,IAAA,OAAA,CAAQ,wBAAQF,cAAAA,CAAC4F,oBAAc,KAAA,EAAO,OAAA,CAAQ,OAAO,CAAA,GAAK,IAAA;AAAA,IAC1D,QAAQ,WAAA,mBAAc5F,eAAC2F,kBAAA,EAAA,EAAiB,QAAA,EAAA,OAAA,CAAQ,aAAY,CAAA,GAAqB,IAAA;AAAA,IACjF,QAAQ,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,EAAO,sBAC1B3F,cAAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QAEC,IAAA,EAAM,KAAA;AAAA,QACN,QAAA,EACE,WACI,CAAC,MAAA,EAAQ,UACP,QAAA,CAAS,MAAA,EAAQ,KAAA,KAAU,MAAA,GAAY,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,KAAM,EAAE,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA,EAAG,KAAA,EAAO,CAAA,GACnG;AAAA,OAAA;AAAA,MAND;AAAA,KASR;AAAA,GAAA,EAAA,EAdW,CAed,CACD;AAAA,CAAA,EACH,CACD;AACD,IAAA,CAAK,WAAA,GAAc,MAAA","file":"index.cjs","sourcesContent":["// Ids follow the Design Kit Spec (https://claude.ai/artifact/VcN3AYgmbdCpHbxXZjMir5).\n// Do not edit by hand: change the spec first, then copy the ids here.\n// The block registry is keyed by these kinds, so a kind without an entry does not compile.\n\n/**\n * Every block, by kind. A block that returns a value names its type in\n * `returns` (as the spec writes it) and is what an ask turn holds; the rest\n * only show data and are what an answer turn holds. Both are blocks.\n */\nexport const BLOCKS = [\n { id: \"confirm\", name: \"Confirm\", returns: \"boolean\", tier: \"today\" },\n { id: \"single\", name: \"Single choice\", returns: \"string\", tier: \"today\" },\n { id: \"multi\", name: \"Multiple choice\", returns: \"string[]\", tier: \"today\" },\n { id: \"quick\", name: \"Quick pick\", returns: \"string\", tier: \"today\" },\n { id: \"period\", name: \"Period\", returns: \"{from, to, label}\", tier: \"today\" },\n { id: \"number\", name: \"Number\", returns: \"number\", tier: \"today\" },\n { id: \"short\", name: \"Short text\", returns: \"string\", tier: \"today\" },\n { id: \"long\", name: \"Long text\", returns: \"string\", tier: \"today\" },\n { id: \"entity\", name: \"Entity pick\", returns: \"id[]\", tier: \"next\" },\n { id: \"scale\", name: \"Scale\", returns: \"1–5\", tier: \"today\" },\n { id: \"multistep\", name: \"Multi-step\", returns: \"Record<id, value>\", tier: \"today\" },\n { id: \"form\", name: \"Form\", returns: \"Record<field, value>\", tier: \"next\" },\n { id: \"weights\", name: \"Weights\", returns: \"Record<objective, 0–100>\", tier: \"today\" },\n { id: \"approval\", name: \"Approval\", returns: \"approve | reject\", tier: \"today\" },\n { id: \"interpretation\", name: \"Interpretation\", returns: \"Record<slot, value>\", tier: \"today\" },\n { id: \"fork\", name: \"Reading fork\", returns: \"readingId\", tier: \"next\" },\n { id: \"plan\", name: \"Plan preview\", returns: \"stepId[]\", tier: \"next\" },\n { id: \"modelspec\", name: \"Model spec\", returns: \"{outcome, predictors[], group?, controls[]}\", tier: \"next\" },\n { id: \"hypothesis\", name: \"Hypothesis\", returns: \"{test, tails, alpha}\", tier: \"next\" },\n { id: \"range\", name: \"Range\", returns: \"{min, max}\", tier: \"next\" },\n { id: \"suggestions\", name: \"Suggestions\", returns: \"string\", tier: \"today\" },\n { id: \"narrative\", name: \"Narrative\", tier: \"today\" },\n { id: \"metric\", name: \"Metric\", tier: \"today\" },\n { id: \"grid\", name: \"Metric grid\", tier: \"today\" },\n { id: \"table\", name: \"Table preview\", tier: \"today\" },\n { id: \"attr\", name: \"Attribute matrix\", tier: \"today\" },\n { id: \"record\", name: \"Record\", tier: \"today\" },\n { id: \"ranked\", name: \"Ranked list\", tier: \"today\" },\n { id: \"timeseries\", name: \"Time series\", tier: \"today\" },\n { id: \"bars\", name: \"Bar comparison\", tier: \"next\" },\n { id: \"waterfall\", name: \"Bridge\", tier: \"next\" },\n { id: \"matrix\", name: \"Matrix\", tier: \"next\" },\n { id: \"funnel\", name: \"Funnel\", tier: \"next\" },\n { id: \"histogram\", name: \"Distribution\", tier: \"next\" },\n { id: \"timeline\", name: \"Timeline\", tier: \"today\" },\n { id: \"subgraph\", name: \"Subgraph\", tier: \"later\" },\n { id: \"method\", name: \"Method\", tier: \"today\" },\n { id: \"citations\", name: \"Citations\", tier: \"today\" },\n { id: \"files\", name: \"Files\", tier: \"today\" },\n { id: \"proposal\", name: \"Proposal\", tier: \"today\" },\n { id: \"cannot\", name: \"Cannot answer\", tier: \"today\" },\n { id: \"caveat\", name: \"Caveat\", tier: \"today\" },\n { id: \"scope\", name: \"Scope line\", tier: \"today\" },\n { id: \"checks\", name: \"Checks\", tier: \"next\" },\n { id: \"trace\", name: \"Progress trace\", tier: \"today\" },\n { id: \"activity\", name: \"Layer activity\", tier: \"today\" },\n { id: \"gantt\", name: \"Task timeline\", tier: \"today\" },\n { id: \"heatstrip\", name: \"Heat strip\", tier: \"today\" },\n { id: \"test\", name: \"Test result\", tier: \"next\" },\n { id: \"coef\", name: \"Coefficients\", tier: \"next\" },\n { id: \"forest\", name: \"Forest plot\", tier: \"next\" },\n { id: \"scatter\", name: \"Scatter\", tier: \"next\" },\n { id: \"box\", name: \"Box plot\", tier: \"next\" },\n { id: \"correlation\", name: \"Correlation\", tier: \"next\" },\n { id: \"control\", name: \"Control chart\", tier: \"next\" },\n { id: \"pareto\", name: \"Pareto\", tier: \"next\" },\n { id: \"survival\", name: \"Survival curve\", tier: \"next\" },\n { id: \"tornado\", name: \"Tornado\", tier: \"next\" },\n { id: \"decomposition\", name: \"Decomposition\", tier: \"next\" },\n { id: \"modeleval\", name: \"Model evaluation\", tier: \"next\" },\n { id: \"pivot\", name: \"Pivot\", tier: \"next\" },\n { id: \"profile\", name: \"Column profile\", tier: \"next\" },\n { id: \"evidence\", name: \"Evidence strength\", tier: \"next\" },\n { id: \"dumbbell\", name: \"Dumbbell\", tier: \"next\" },\n { id: \"quantiles\", name: \"Quantiles\", tier: \"today\" },\n] as const\n\ntype Block = (typeof BLOCKS)[number]\n\n/** Every block's kind. */\nexport type BlockKind = Block[\"id\"]\n/** The kinds an ask turn can hold: the blocks that return a value. */\nexport type AskKind = Extract<Block, { returns: string }>[\"id\"]\n/** The kinds an answer turn can hold: the blocks that only show data. */\nexport type AnswerKind = Exclude<BlockKind, AskKind>\n\n/** The blocks that return a value, and those that only show data. */\nexport const ASK_KINDS: readonly AskKind[] = BLOCKS.filter((b): b is Extract<Block, { returns: string }> => \"returns\" in b).map((b) => b.id)\nexport const ANSWER_KINDS: readonly AnswerKind[] = BLOCKS.filter((b) => !(\"returns\" in b)).map((b) => b.id as AnswerKind)\n","// Ids follow the Design Kit Spec (https://claude.ai/artifact/VcN3AYgmbdCpHbxXZjMir5).\n// Do not edit by hand: change the spec first, then copy the ids here.\n// Value types are how a block writes a figure, so they live with the blocks.\n\n/**\n * Value types: every figure an answer shows is one of these, written one way\n * by `formatValue`. The unit vocabulary inside `quantity` is open.\n */\nexport const VALUE_TYPES = [\n { id: \"quantity\", name: \"Quantity with unit\", example: \"2,480 kg/ha · 26 d\" },\n { id: \"currency\", name: \"Currency\", example: \"£84k · −£620k · £4.1M\" },\n { id: \"percent\", name: \"Share\", example: \"76% · 8.2%\" },\n { id: \"pp\", name: \"Percentage points\", example: \"+4.8 pts · ▼ 1.8 pts\" },\n { id: \"bp\", name: \"Basis points\", example: \"+12 bp\" },\n { id: \"ratio\", name: \"Ratio or index\", example: \"OR 1.29 · beta 0.38 · 1.3×\" },\n { id: \"rate\", name: \"Rate per N\", example: \"8.2 per 100 discharges\" },\n { id: \"count\", name: \"Count with n\", example: \"1,284 plots · n = 1,061\" },\n { id: \"duration\", name: \"Duration\", example: \"1.2 s · 3 min · 26 d\" },\n { id: \"estimate\", name: \"Estimate with interval\", example: \"1.29 (95% CI 1.04–1.60)\" },\n { id: \"pvalue\", name: \"p-value\", example: \"p = 0.02 · p < 0.001\" },\n { id: \"score\", name: \"Ordinal score\", example: \"7 / 9 · 4 of 5\" },\n { id: \"time\", name: \"Point in time\", example: \"as of 29 Sep 06:00 · Q3 2026\" },\n] as const\n\nexport type ValueTypeId = (typeof VALUE_TYPES)[number][\"id\"]\n","import * as React from \"react\"\nimport { Button, type ButtonProps } from \"@invana/ui\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport type { ActionOption } from \"../types\"\n\nconst VARIANT: Record<NonNullable<ActionOption[\"variant\"]>, ButtonProps[\"variant\"]> = {\n primary: \"default\",\n secondary: \"outline\",\n ghost: \"ghost\",\n link: \"link\",\n}\n\n/**\n * The actions under a block, in the order given; the first with `push` starts\n * the group at the far end. Each is sent as an `action` event.\n */\nexport function ActionRow({\n actions,\n onAction,\n}: {\n actions: ActionOption[]\n onAction: (id: string) => void\n}) {\n return (\n <ClarifyActions className=\"w-full\">\n {actions.map((a) => (\n <React.Fragment key={a.id}>\n {a.push ? <span aria-hidden className=\"flex-1\" /> : null}\n <Button\n size=\"xs\"\n variant={VARIANT[a.variant ?? \"secondary\"]}\n onClick={() => onAction(a.id)}\n >\n {a.label}\n </Button>\n </React.Fragment>\n ))}\n </ClarifyActions>\n )\n}\n","import * as React from \"react\"\n\n/**\n * `**…**` spans as strong, the rest as text. The only markup the grammar\n * allows in prose: the figure the sentence leads with, or what yes will cost.\n */\nexport function strong(text: string): React.ReactNode[] {\n return text\n .split(/(\\*\\*[^*]+\\*\\*)/)\n .filter(Boolean)\n .map((part, i) =>\n part.startsWith(\"**\") && part.endsWith(\"**\") ? (\n <strong key={i}>{part.slice(2, -2)}</strong>\n ) : (\n part\n ),\n )\n}\n\nconst DIRECTION = /([▲▼]\\s?[+−-]?[\\d.,]+(?:\\s?(?:pts|pp|bps|%))?)/\nconst MARKER = /(\\[\\d+\\])/\n\nfunction tone(figure: string) {\n return figure.startsWith(\"▲\") ? \"text-primary\" : \"text-destructive\"\n}\n\n/**\n * Prose as an answer writes it: `**…**` a figure, `[n]` the marker for source\n * n where the clause it backs ends, and a figure led by `▲` or `▼` in the tone\n * of its direction — the arrow is the direction, so the colour follows it.\n */\nexport function prose(text: string, marker: (n: number) => React.ReactNode): React.ReactNode[] {\n let key = 0\n const plain = (part: string): React.ReactNode[] =>\n part\n .split(MARKER)\n .filter(Boolean)\n .flatMap((piece): React.ReactNode[] => {\n const cite = piece.match(/^\\[(\\d+)\\]$/)\n if (cite) return [<React.Fragment key={key++}>{marker(Number(cite[1]))}</React.Fragment>]\n return piece\n .split(DIRECTION)\n .filter(Boolean)\n .map((bit) =>\n DIRECTION.test(bit) && /^[▲▼]/.test(bit) ? (\n <span key={key++} className={tone(bit)}>\n {bit}\n </span>\n ) : (\n <React.Fragment key={key++}>{bit}</React.Fragment>\n ),\n )\n })\n return text\n .split(/(\\*\\*[^*]+\\*\\*)/)\n .filter(Boolean)\n .flatMap((part): React.ReactNode[] => {\n if (!(part.startsWith(\"**\") && part.endsWith(\"**\"))) return plain(part)\n const figure = part.slice(2, -2)\n return [\n <strong key={key++} className={/^[▲▼]/.test(figure) ? tone(figure) : undefined}>\n {figure}\n </strong>,\n ]\n })\n}\n","import * as React from \"react\"\nimport { HeatLane } from \"@invana/charts\"\nimport { Button, cn, PropertyList, PropertyRow } from \"@invana/ui\"\n\nimport { ActionRow } from \"../parts/actions\"\nimport { strong } from \"../prose\"\nimport type { ActivityLane, BlockProps } from \"../types\"\n\nconst RATE_TONE = { hot: \"text-info\", bad: \"text-destructive\" } as const\n\n/** A lane is lit when anything in it was busy. */\nconst lit = (lane: ActivityLane) => lane.cells.some((v) => v != null && v > 0)\n\ninterface Pin {\n lane: string\n at: number\n}\n\nfunction LaneRow({\n lane,\n depth,\n open,\n onToggle,\n stale,\n cell,\n pin,\n onPin,\n}: {\n lane: ActivityLane\n depth: number\n open: boolean\n onToggle?: () => void\n stale: boolean\n cell?: string\n pin: Pin | null\n onPin: (pin: Pin | null) => void\n}) {\n const name = (\n <>\n <span className=\"truncate @max-[300px]/activity:hidden\">{lane.label}</span>\n <span className=\"truncate @min-[301px]/activity:hidden\">{lane.short ?? lane.label}</span>\n </>\n )\n return (\n <>\n {onToggle ? (\n <button\n type=\"button\"\n aria-expanded={open}\n onClick={onToggle}\n className=\"flex min-w-0 items-center gap-1 text-left hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n >\n <span aria-hidden className=\"w-2.5 shrink-0 text-muted-foreground\">\n {open ? \"▾\" : \"▸\"}\n </span>\n {name}\n </button>\n ) : (\n <span\n className={cn(\n \"flex min-w-0 items-center\",\n (lane.off || depth > 0) && \"text-muted-foreground\",\n depth > 0 && \"pl-3.5 text-sm\",\n )}\n >\n {name}\n </span>\n )}\n <HeatLane\n aria-label={lane.label}\n values={lane.off ? lane.cells.map(() => null) : lane.cells}\n marks={lane.marks}\n stale={stale}\n cellLabel={cell ? (i) => `${lane.label} · cell ${i + 1} · ${cell}` : undefined}\n pinned={pin?.lane === lane.id ? pin.at : null}\n onPin={stale ? undefined : (at) => onPin(at == null ? null : { lane: lane.id, at })}\n />\n <span\n className={cn(\n \"truncate text-right font-mono text-sm text-muted-foreground tabular-nums\",\n !stale && lane.rateTone && RATE_TONE[lane.rateTone],\n )}\n >\n {stale ? \"—\" : lane.rate}\n </span>\n </>\n )\n}\n\n/**\n * Which layers a run kept busy, and when: one lane per layer — graph, models,\n * skills, the LLM, third parties, the cache — over a shared axis, brighter\n * where it was busier, its rate at the right, the run's steps banded above.\n *\n * Live, it follows the last seconds; settled, it is the whole run. A layer\n * opens into its parts; a lit cell pins, and the operation behind it is\n * recorded under the lanes. A refusal and a crossing of the boundary are\n * marked in their cell. When the signal stops the lanes are dimmed, not\n * cooled: silence is not calm. Under 300px of its own width it switches to\n * short labels.\n */\nexport function ActivityBlock({ spec, onAction }: BlockProps<\"activity\">) {\n const stale = spec.state === \"stale\"\n const [opened, setOpened] = React.useState<Set<string>>(\n () => new Set(spec.lanes.filter((l) => l.open).map((l) => l.id)),\n )\n const [pin, setPin] = React.useState<Pin | null>(\n spec.pinned ? { lane: spec.pinned.lane, at: spec.pinned.at } : null,\n )\n const toggle = (id: string) =>\n setOpened((s) => {\n const next = new Set(s)\n if (next.has(id)) next.delete(id)\n else next.add(id)\n return next\n })\n const pinCell = (next: Pin | null) => {\n setPin(next)\n if (next) onAction?.(\"pin\", next)\n }\n const record = spec.pinned && pin && spec.pinned.lane === pin.lane && spec.pinned.at === pin.at ? spec.pinned : null\n const total = spec.lanes.length\n const lighted = spec.lanes.filter(lit).length\n\n return (\n <div className=\"@container/activity flex min-w-0 flex-col gap-2\">\n <div className=\"grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)_minmax(2.5rem,auto)] items-center gap-x-2 gap-y-1.5 @max-[300px]/activity:grid-cols-[4rem_minmax(0,1fr)_minmax(1.5rem,auto)]\">\n {spec.bands?.length ? (\n <>\n <span />\n <div className=\"flex min-w-0 gap-px text-xs\">\n {spec.bands.map((b, i) => (\n <span\n key={i}\n style={{ flex: b.span }}\n className={cn(\n \"min-w-0 truncate rounded-[2px] px-1\",\n b.current ? \"bg-info/15 text-foreground\" : \"bg-muted text-muted-foreground\",\n )}\n >\n {b.label}\n </span>\n ))}\n </div>\n <span className=\"text-right text-xs text-muted-foreground\">{spec.state === \"live\" ? \"now\" : \"\"}</span>\n </>\n ) : null}\n {spec.lanes.map((lane) => {\n const open = opened.has(lane.id)\n const kids = lane.children?.length ? lane.children : null\n return (\n <React.Fragment key={lane.id}>\n <LaneRow\n lane={lane}\n depth={0}\n open={open}\n onToggle={kids ? () => toggle(lane.id) : undefined}\n stale={stale}\n cell={spec.cell}\n pin={pin}\n onPin={pinCell}\n />\n {open && kids\n ? kids.map((child) => (\n <LaneRow\n key={child.id}\n lane={child}\n depth={1}\n open={false}\n stale={stale}\n cell={spec.cell}\n pin={pin}\n onPin={pinCell}\n />\n ))\n : null}\n </React.Fragment>\n )\n })}\n {spec.axis?.length ? (\n <>\n <span />\n <div className=\"flex min-w-0 justify-between text-xs text-muted-foreground tabular-nums\">\n {spec.axis.map((a, i) => (\n <span key={i}>{a}</span>\n ))}\n </div>\n <span />\n </>\n ) : null}\n </div>\n\n {record ? (\n <div className=\"flex flex-col gap-1.5 rounded-control border border-border bg-muted/40 p-2\">\n <div className=\"flex min-w-0 items-baseline gap-2\">\n <span className=\"min-w-0 flex-1 truncate font-medium\">{record.title}</span>\n {record.time ? <span className=\"shrink-0 font-mono text-sm text-muted-foreground\">{record.time}</span> : null}\n </div>\n {record.query ? <code className=\"truncate font-mono text-sm\">{record.query}</code> : null}\n {record.rows?.length ? (\n <PropertyList>\n {record.rows.map((r) => (\n <PropertyRow key={r.label} label={r.label}>\n {r.value}\n </PropertyRow>\n ))}\n </PropertyList>\n ) : null}\n {record.note || record.action ? (\n <div className=\"flex min-w-0 items-center gap-2 text-sm text-muted-foreground\">\n <span className=\"min-w-0 flex-1 truncate\">{record.note}</span>\n {record.action ? (\n <Button\n variant=\"link\"\n size=\"xs\"\n className=\"h-auto p-0\"\n onClick={() => onAction?.(\"action\", record.action!.id)}\n >\n {record.action.label}\n </Button>\n ) : null}\n </div>\n ) : null}\n </div>\n ) : null}\n\n {spec.legend ? (\n <div className=\"flex flex-wrap gap-3 text-sm text-muted-foreground\">\n <span className=\"flex items-center gap-1.5\"><i aria-hidden className=\"size-2 rounded-[1px] bg-info\" />touched</span>\n <span className=\"flex items-center gap-1.5\"><i aria-hidden className=\"size-2 rounded-[1px] bg-destructive\" />refused</span>\n <span className=\"flex items-center gap-1.5\"><i aria-hidden className=\"size-2 rounded-[1px] bg-warning\" />left the boundary</span>\n </div>\n ) : null}\n\n {spec.hint ? (\n <p className={cn(\"text-sm text-muted-foreground\", stale && \"text-warning\")}>{strong(spec.hint)}</p>\n ) : null}\n\n {spec.actions?.length ? (\n <div className=\"flex min-w-0 items-center gap-2 border-t border-border pt-1.5 text-sm text-muted-foreground\">\n <span className=\"shrink-0 tabular-nums\">\n {total} layers · {lighted} lit\n </span>\n <ActionRow actions={spec.actions} onAction={(id) => onAction?.(\"action\", id)} />\n </div>\n ) : null}\n </div>\n )\n}\n","import { BarChartV } from \"@invana/charts\"\n\nimport type { BlockProps } from \"../types\"\n\n\n/** Places after the point, so a column of `6.1, 6.0` is not written `6.1, 6`. */\nconst decimals = (v: number) => (String(v).split(\".\")[1] ?? \"\").length\n\n/** A series drawn as the comparison — last quarter behind this one. */\nconst MUTED = \"color-mix(in srgb, var(--color-muted-foreground) 45%, transparent)\"\n\n/**\n * Groups compared as columns. Two or more series sit side by side in each group\n * with a legend, a muted one drawn as the comparison, against a dashed target.\n * One series is drawn muted with the called-out group in primary and its value\n * on the cap. A plan per group is a dashed column each actual stands inside.\n */\nexport function BarsBlock({ spec }: BlockProps<\"bars\">) {\n const single = spec.series.length === 1\n const places = Math.max(0, ...spec.series.flatMap((s) => s.values.map(decimals)))\n // A percent sign travels with the figure; any other unit is named once, in the header.\n const write = (v: number) =>\n v.toLocaleString(\"en-GB\", { minimumFractionDigits: places, maximumFractionDigits: places }) +\n (spec.unit === \"%\" ? \"%\" : \"\")\n const highlight = spec.highlight == null ? -1 : spec.groups.indexOf(spec.highlight)\n const called = single && highlight >= 0\n return (\n <BarChartV\n aria-label={spec.series.map((s) => s.name).join(\", \") + (spec.unit ? `, ${spec.unit}` : \"\")}\n variant=\"comparison\"\n height={80}\n labelMode={called ? \"last\" : \"none\"}\n color={called ? \"var(--color-muted-foreground)\" : \"var(--color-primary)\"}\n highlightColor=\"var(--color-primary)\"\n highlightIndex={called ? highlight : null}\n target={spec.target ? { ...spec.target, color: \"var(--color-warning)\" } : undefined}\n planLabel={spec.plan?.name}\n series={\n single && !spec.plan\n ? undefined\n : spec.series.map((s) => ({\n name: s.name,\n color: s.muted ? MUTED : \"var(--color-primary)\",\n }))\n }\n data={spec.groups.map((label, i) =>\n single\n ? {\n label,\n value: spec.series[0]!.values[i] ?? 0,\n display: write(spec.series[0]!.values[i] ?? 0),\n plan: spec.plan?.values[i],\n }\n : {\n label,\n values: spec.series.map((s) => s.values[i] ?? 0),\n display: spec.series.map((s) => write(s.values[i] ?? 0)),\n },\n )}\n />\n )\n}\n","import * as React from \"react\"\nimport { Button, Eyebrow, cn } from \"@invana/ui\"\n\nexport interface SuggestionChipsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Two to four follow-ups, each a whole prompt — `Compare with Q3 last year`. */\n items?: string[]\n /** Follow-ups under a heading each — `Go deeper`, `Act` — in place of `items`. */\n groups?: { label: React.ReactNode; items: string[] }[]\n /**\n * `wrap` (the default) runs the chips along a line; `stack` puts one per\n * line, full width. A narrow thread stacks them either way.\n */\n layout?: \"wrap\" | \"stack\"\n /** A line above the chips that says what they are — `I can answer instead`. */\n lead?: React.ReactNode\n /** Follow-ups already sent from here. They stay where they were, dimmed and disabled. */\n sent?: string[]\n /** A follow-up was picked; it goes out as the next prompt. */\n onSelect?: (text: string) => void\n}\n\nfunction Chips({\n items,\n layout,\n sent,\n onSelect,\n}: Pick<SuggestionChipsProps, \"layout\" | \"sent\" | \"onSelect\"> & { items: string[] }) {\n const stack = layout === \"stack\"\n return (\n <div\n className={cn(\n \"flex gap-1.5\",\n stack ? \"flex-col\" : \"flex-wrap @max-[22rem]:flex-col\",\n )}\n >\n {items.map((text) => {\n const done = sent?.includes(text)\n return (\n <Button\n key={text}\n type=\"button\"\n size=\"xs\"\n variant=\"outline\"\n disabled={done}\n className={cn(\n // A follow-up is a whole prompt and can outrun the line: it wraps\n // within the thread rather than running past it.\n \"h-auto min-h-control-xs max-w-full items-start whitespace-normal py-0.5 text-left font-normal\",\n stack\n ? \"w-full justify-start\"\n : \"rounded-full @max-[22rem]:w-full @max-[22rem]:justify-start @max-[22rem]:rounded-control\",\n )}\n onClick={() => onSelect?.(text)}\n >\n <span aria-hidden className=\"text-muted-foreground\">\n ↳\n </span>\n {text}\n </Button>\n )\n })}\n </div>\n )\n}\n\n/**\n * What to ask next, under an answer. Each chip is a whole prompt that reuses\n * the current scope, so picking one sends it as it reads — nothing to fill in.\n */\nexport const SuggestionChips = React.forwardRef<HTMLDivElement, SuggestionChipsProps>(\n ({ items, groups, layout, sent, lead, onSelect, className, ...props }, ref) => (\n <div ref={ref} className={cn(\"@container flex flex-col gap-1.5\", className)} {...props}>\n {lead != null ? <p className=\"text-xs text-muted-foreground\">{lead}</p> : null}\n {groups?.length\n ? groups.map((group, i) => (\n <React.Fragment key={i}>\n <Eyebrow>{group.label}</Eyebrow>\n <Chips items={group.items} layout={layout} sent={sent} onSelect={onSelect} />\n </React.Fragment>\n ))\n : items?.length\n ? <Chips items={items} layout={layout} sent={sent} onSelect={onSelect} />\n : null}\n </div>\n ),\n)\nSuggestionChips.displayName = \"SuggestionChips\"\n","import { CannotAnswerCard } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { SuggestionChips } from \"../parts/suggestion-chips\"\n\n/**\n * What the data does not hold, and what would change the answer — then the\n * nearby questions it can answer, each sent as a new prompt. Answered in\n * part, the card says which part is missing, above the answer for the rest.\n */\nexport function CannotBlock({ spec, onAction }: BlockProps<\"cannot\">) {\n return (\n <>\n <CannotAnswerCard\n remedy={spec.remedy}\n label={spec.partial ? \"answered in part\" : undefined}\n tone={spec.partial ? \"info\" : \"default\"}\n >\n {spec.reason}\n </CannotAnswerCard>\n {spec.nearest?.length ? (\n <SuggestionChips\n lead=\"I can answer instead\"\n items={spec.nearest}\n onSelect={(text) => onAction?.(\"prompt\", text)}\n />\n ) : null}\n </>\n )\n}\n","import * as React from \"react\"\nimport { CaveatNote } from \"@invana/ui\"\n\nimport { ChatSessionDisclosure } from \"@invana/ui\"\nimport type { BlockProps, CaveatNoteOptions, CaveatTone } from \"../types\"\n\nconst TONE: Record<CaveatTone, \"warning\" | \"info\" | \"destructive\"> = {\n warning: \"warning\",\n info: \"info\",\n bad: \"destructive\",\n}\n\nfunction Note({\n note,\n onAction,\n}: {\n note: CaveatNoteOptions\n onAction: (id: string) => void\n}) {\n return (\n <CaveatNote\n label={note.label}\n tone={TONE[note.tone ?? \"warning\"]}\n action={note.action?.label}\n onAction={note.action ? () => onAction(note.action!.id) : undefined}\n >\n {note.text}\n </CaveatNote>\n )\n}\n\n/**\n * What was excluded, imputed or assumed, and how far to trust the figure. A\n * caveat with the rows behind it links to them; several can fold behind one\n * line that names their kinds.\n */\nexport function CaveatBlock({ spec, onAction }: BlockProps<\"caveat\">) {\n const [open, setOpen] = React.useState(!spec.folded)\n const act = (id: string) => onAction?.(\"action\", id)\n if (!spec.items) return <Note note={spec} onAction={act} />\n const notes = spec.items.map((note, i) => <Note key={i} note={note} onAction={act} />)\n if (!spec.folded) return <>{notes}</>\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={`${spec.items.length} caveats`}\n meta={open ? undefined : spec.items.map((n) => n.label).join(\" · \")}\n open={open}\n onOpenChange={setOpen}\n >\n <>{notes}</>\n </ChatSessionDisclosure>\n )\n}\n","import type { MetricTone } from \"@invana/ui\"\n\nimport type { Figure, MetricOptions, Tone } from \"./types\"\n\n/**\n * A figure as text. A string arrives already written; a number or a typed\n * value is written here, plainly, until `formatValue` lands in `@invana/ui`.\n */\nexport function figureText(figure: Figure): string {\n if (typeof figure === \"string\") return figure\n if (typeof figure === \"number\") return figure.toLocaleString(\"en-GB\")\n const n = figure.value.toLocaleString(\"en-GB\")\n return figure.unit ? `${n} ${figure.unit}` : n\n}\n\n/** A figure's value, or a muted dash when there is none to give. */\nexport function metricValue(value: MetricOptions[\"value\"]) {\n return value == null ? \"—\" : figureText(value)\n}\n\n/** The tones, as a caption's. `neutral` leaves it muted. */\nexport const CAPTION_TONE: Record<Tone, MetricTone | undefined> = {\n good: \"success\",\n bad: \"error\",\n warn: \"warning\",\n neutral: undefined,\n}\n\n/** The tones, as a `Badge`'s. */\nexport const BADGE_TONE: Record<Tone, \"success\" | \"destructive\" | \"warning\" | \"muted\"> = {\n good: \"success\",\n bad: \"destructive\",\n warn: \"warning\",\n neutral: \"muted\",\n}\n\n/**\n * A metric's gauge as the tile draws it: shares of the scale, and its ends and\n * target written in `unit` — or, with no target, a plain meter.\n */\nexport function gaugeProps(gauge: MetricOptions[\"gauge\"]) {\n if (!gauge) return {}\n const min = gauge.min ?? 0\n const span = gauge.max - min || 1\n const fill = (gauge.value - min) / span\n if (gauge.target == null) return { meter: fill }\n const write = (n: number) => `${n.toLocaleString(\"en-GB\")}${gauge.unit ?? \"\"}`\n return {\n gauge: {\n fill,\n mark: (gauge.target - min) / span,\n labels: [write(min), `target ${write(gauge.target)}`, write(gauge.max)] as [string, string, string],\n },\n }\n}\n","import * as React from \"react\"\nimport { CitationList, CitationRow } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ChatSessionDisclosure } from \"@invana/ui\"\nimport { figureText } from \"../format\"\n\n/**\n * The sources an answer rests on, numbered as its markers cite them, with\n * record counts at the right and what kind of source each is, and how fresh,\n * under it. The row a marker in the prose points at is lit, when the shell tracks it. Folded, one line\n * says how many sources and records; a source with no records is said out loud.\n */\nexport interface CitationsBlockProps extends BlockProps<\"citations\"> {\n /** The source the reader is on, when the shell tracks it. Defaults to the spec's `active`. */\n active?: number\n}\n\nexport function CitationsBlock({ spec, active = spec.active }: CitationsBlockProps) {\n const [open, setOpen] = React.useState(!spec.folded)\n const counts = spec.sources.map((s) => s.count)\n const total = counts.every((c) => typeof c === \"number\")\n ? (counts as number[]).reduce((a, b) => a + b, 0)\n : undefined\n\n const list = (\n <CitationList note={spec.note} noteTone={total === 0 ? \"warning\" : \"muted\"}>\n {spec.sources.map((source, i) => (\n <CitationRow\n key={i}\n marker={i + 1}\n active={active === i + 1}\n detail={source.detail}\n count={source.count == null ? undefined : figureText(source.count)}\n >\n {source.label}\n </CitationRow>\n ))}\n </CitationList>\n )\n if (!spec.folded) return list\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={`${spec.sources.length} sources`}\n meta={total != null ? `${total.toLocaleString(\"en-GB\")} records` : undefined}\n open={open}\n onOpenChange={setOpen}\n >\n {list}\n </ChatSessionDisclosure>\n )\n}\n","import * as React from \"react\"\nimport { cn } from \"@invana/ui\"\n\nimport { ClarifyActions, ClarifyFootnote } from \"@invana/ui\"\n\nexport interface ConfirmCost {\n /** What it measures — `rows scanned`, `time`, `records written`. */\n label: React.ReactNode\n /**\n * The figure, already written — `2.3B`, `about 40 s`, `0`. A string is\n * drawn whole as the figure; pass nodes to mark only part of it.\n */\n value: React.ReactNode\n /** `warning` for the cost that changes something — records it will write. */\n tone?: \"warning\"\n}\n\nexport interface ConfirmCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** What yes does, in one sentence — or a short heading over a `description`. */\n question: React.ReactNode\n /** A muted line under the question; makes the question a heading. */\n description?: React.ReactNode\n /** Set the question as a heading without a description. */\n heading?: boolean\n /** What yes costs, figure by figure, between the question and the buttons. */\n cost?: ConfirmCost[]\n /**\n * `line` writes the cost as a sentence, each figure before its label;\n * `strip` sets the figures in cells, each label above. @default \"line\"\n */\n costAs?: \"line\" | \"strip\"\n /**\n * The strip without its box: only the rules between its cells, and the\n * outer cells flush with the question — for a card whose frame is already\n * the edge.\n */\n seamless?: boolean\n /** Something to weigh before answering, under the cost — a `CaveatNote`. */\n caveat?: React.ReactNode\n /** The line under the buttons — where the default came from. */\n hint?: React.ReactNode\n /** The yes and no buttons. */\n children?: React.ReactNode\n}\n\nconst figure = (value: React.ReactNode, tone?: \"warning\") =>\n typeof value === \"string\" || typeof value === \"number\" ? (\n <b className={cn(\"font-mono font-normal text-foreground\", tone === \"warning\" && \"text-warning\")}>{value}</b>\n ) : (\n value\n )\n\n/**\n * Yes or no, where yes states what it costs: the rows it scans, the time it\n * takes, the records it writes. The cost is stated before the button, not\n * after — as a line of figures under the question, or as a strip of cells\n * when the figures are the point.\n *\n * The body of a confirm ask, inside its `ClarifyCard`.\n */\nexport const ConfirmCard = React.forwardRef<HTMLDivElement, ConfirmCardProps>(\n (\n { question, description, heading, cost, costAs = \"line\", seamless, caveat, hint, className, children, ...props },\n ref,\n ) => (\n <div ref={ref} className={cn(\"flex flex-col gap-2\", className)} {...props}>\n <p className={heading || description ? \"font-semibold\" : undefined}>{question}</p>\n {description ? <p className=\"-mt-1.5 text-sm text-muted-foreground\">{description}</p> : null}\n {cost?.length && costAs === \"strip\" ? (\n <dl\n className={cn(\n \"grid\",\n // Seamless: it reaches out by a cell's padding and clips that off,\n // so the outer cells are flush.\n seamless\n ? \"-mx-2 -my-1 [clip-path:inset(0.25rem_0.5rem)]\"\n : \"overflow-hidden rounded-md border border-border\",\n )}\n style={{ gridTemplateColumns: `repeat(${cost.length}, minmax(0, 1fr))` }}\n >\n {cost.map((c, i) => (\n <div key={i} className=\"flex min-w-0 flex-col border-e border-border/60 px-2 py-1 last:border-e-0\">\n <dt className=\"truncate text-xs text-muted-foreground\">{c.label}</dt>\n <dd className={cn(\"font-mono font-medium tabular-nums\", c.tone === \"warning\" && \"text-warning\")}>\n {c.value}\n </dd>\n </div>\n ))}\n </dl>\n ) : cost?.length ? (\n <p className=\"text-xs text-muted-foreground\">\n {cost.map((c, i) => (\n <React.Fragment key={i}>\n {i > 0 ? \" · \" : null}\n {figure(c.value, c.tone)} {c.label}\n </React.Fragment>\n ))}\n </p>\n ) : null}\n {caveat}\n <ClarifyActions>{children}</ClarifyActions>\n {hint ? <ClarifyFootnote>{hint}</ClarifyFootnote> : null}\n </div>\n ),\n)\nConfirmCard.displayName = \"ConfirmCard\"\n","import * as React from \"react\"\nimport {\n Button,\n Kbd,\n PropertyList,\n PropertyRow,\n QuestionnaireChoiceDescription,\n QuestionnaireChoiceTitle,\n type QuestionnaireChoiceProps,\n type QuestionnaireFigureTone,\n} from \"@invana/ui\"\n\nimport { ClarifyActions, ClarifyFootnote } from \"@invana/ui\"\nimport type { AskText, ChoiceOption, Tone } from \"../types\"\nimport { strong } from \"../prose\"\n\n/*\n * The parts every ask shares, so the six renderers draw one language: the\n * question (plain or a heading with its description), the hint under a\n * control, a choice's lead and figure, and the summary an answered ask\n * settles into.\n */\n\n/** A question is a heading when it says so, or when a description follows it. */\nexport const isHeading = (text: AskText) => Boolean(text.heading || text.description)\n\n/** The question, and the muted line under it when there is one. */\nexport function AskQuestion({ text, aside }: { text: AskText; aside?: React.ReactNode }) {\n const question = <p className={isHeading(text) ? \"font-semibold\" : undefined}>{strong(text.question)}</p>\n return (\n <>\n {aside ? (\n <div className=\"flex items-baseline justify-between gap-2\">\n {question}\n {aside}\n </div>\n ) : (\n question\n )}\n {text.description ? <p className=\"-mt-1.5 text-sm text-muted-foreground\">{text.description}</p> : null}\n </>\n )\n}\n\n/**\n * A hint's markup: `**…**` a figure, in mono at full strength, and `` `…` ``\n * a key. Everything else is the hint's own muted text.\n */\nexport function hintText(text: string): React.ReactNode[] {\n return text\n .split(/(\\*\\*[^*]+\\*\\*|`[^`]+`)/)\n .filter(Boolean)\n .map((part, i) => {\n if (part.startsWith(\"**\") && part.endsWith(\"**\"))\n return (\n <b key={i} className=\"font-mono font-normal text-foreground\">\n {part.slice(2, -2)}\n </b>\n )\n if (part.startsWith(\"`\") && part.endsWith(\"`\")) return <Kbd key={i}>{part.slice(1, -1)}</Kbd>\n return part\n })\n}\n\n/** A small action in the ask's own text — `Select all`, `Edit`. */\nexport function AskLink({ children, onClick }: { children: React.ReactNode; onClick?: () => void }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"shrink-0 whitespace-nowrap font-sans text-xs font-normal text-primary hover:underline focus-visible:underline focus-visible:outline-none\"\n >\n {children}\n </button>\n )\n}\n\n/** The line under a control. */\nexport function AskHint({ children, tone }: { children?: string; tone?: \"warning\" | \"error\" }) {\n if (!children) return null\n return (\n <ClarifyFootnote className={tone === \"warning\" ? \"text-warning\" : tone === \"error\" ? \"text-destructive\" : undefined}>\n {hintText(children)}\n </ClarifyFootnote>\n )\n}\n\nconst FIGURE_TONE: Record<Tone, QuestionnaireFigureTone | undefined> = {\n good: \"success\",\n bad: \"error\",\n warn: \"warning\",\n neutral: undefined,\n}\n\n/** A 16×16 stroked icon from its path data. */\nfunction Icon({ path }: { path: string }) {\n return (\n <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.3} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d={path} />\n </svg>\n )\n}\n\n/** A choice's props and body, from the grammar's option. */\nexport function choiceParts(o: ChoiceOption): {\n props: Pick<QuestionnaireChoiceProps, \"detail\" | \"lead\" | \"figure\">\n body: React.ReactNode\n} {\n return {\n props: {\n detail: o.figure ? undefined : (o.note ?? o.detail),\n lead: o.icon ? <Icon path={o.icon} /> : o.lead,\n figure: o.figure && { value: o.figure.value, unit: o.figure.unit, tone: o.figure.tone && FIGURE_TONE[o.figure.tone] },\n },\n body: (\n <>\n <QuestionnaireChoiceTitle>{o.label}</QuestionnaireChoiceTitle>\n {o.description ? <QuestionnaireChoiceDescription>{o.description}</QuestionnaireChoiceDescription> : null}\n </>\n ),\n }\n}\n\n/** How a picked option reads in a summary: its `summary`, else its label and source. */\nexport function pickText(o: ChoiceOption | undefined, value: unknown): string {\n if (!o) return value == null || value === \"\" ? \"—\" : String(value)\n if (o.summary) return o.summary\n return o.detail ? `${o.label} · ${o.detail}` : o.label\n}\n\n/**\n * Several picks as one line. Labels join with commas — `Stores, Online`; a\n * `summary` may hold a comma of its own — `Semi-arid, 3 sites` — so picks\n * that carry one join with a dot — `Rust ≥ 6 · maturity ≤ 115 d`.\n */\nexport function joinPicks(picked: ChoiceOption[]): string {\n if (!picked.length) return \"—\"\n const summarised = picked.some((o) => o.summary)\n return picked.map((o) => o.summary ?? o.label).join(summarised ? \" · \" : \", \")\n}\n\n/** The answers an ask settled into, as label/value pairs, and the way back into it. */\nexport function AskSummary({\n rows,\n change,\n onChange,\n children,\n}: {\n rows: { label: string; value: React.ReactNode }[]\n /** The words of the button that reopens the ask — `Change answer`. */\n change?: string\n onChange?: () => void\n /** Anything under the pairs — what the answer led to. */\n children?: React.ReactNode\n}) {\n return (\n <>\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {rows.map((r) => (\n <PropertyRow key={r.label} label={r.label} mono>\n {r.value}\n </PropertyRow>\n ))}\n </PropertyList>\n {children}\n {change ? (\n <ClarifyActions>\n <Button size=\"xs\" variant=\"ghost\" onClick={onChange}>\n {change}\n </Button>\n </ClarifyActions>\n ) : null}\n </>\n )\n}\n","import { Button, CaveatNote } from \"@invana/ui\"\n\nimport { ConfirmCard, type ConfirmCost } from \"../parts/confirm-card\"\nimport type { BlockProps, ConfirmOptions } from \"../types\"\nimport { strong } from \"../prose\"\nimport { AskHint, AskSummary, hintText } from \"../parts/ask\"\n\n/** The grammar's cost, as the card's figures. A value with `**…**` bolds only that part. */\nfunction costOf(cost: ConfirmOptions[\"cost\"]): ConfirmCost[] | undefined {\n return cost?.map((c) => ({\n label: c.label,\n value: c.value.includes(\"**\") ? hintText(c.value) : c.value,\n tone: c.tone === \"warn\" || c.tone === \"bad\" ? \"warning\" : undefined,\n }))\n}\n\n/**\n * Yes or no, where the question says what yes will do and the cost — rows\n * scanned, time, records written — is stated before the buttons, as a line or\n * a strip of figures. A caveat to weigh sits under the cost. The default is the\n * primary button; with `align: \"end\"` it takes the card's right edge and the\n * other its left, and a `dismiss` no draws quiet. `hint` says where the\n * default came from.\n *\n * Answered, it settles into the decision, in `settled` words when given, with\n * the hint the API patches in to say what it led to.\n */\nexport function ConfirmAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"confirm\">) {\n const pending = state === \"pending\"\n\n if (!pending) {\n const yes = given === undefined ? (spec.default ?? true) : given === true\n const words = yes ? (spec.settled?.yes ?? spec.yes) : (spec.settled?.no ?? spec.no)\n return (\n <AskSummary rows={[{ label: spec.label ?? \"Decision\", value: words }]}>\n <AskHint>{spec.hint}</AskHint>\n </AskSummary>\n )\n }\n\n const chosen = spec.default ?? true\n const end = spec.align === \"end\"\n const button = (value: boolean) => (\n <Button\n key={String(value)}\n size=\"xs\"\n variant={value === chosen ? \"default\" : value === false && spec.dismiss ? \"ghost\" : \"outline\"}\n className={end && value === chosen ? \"ms-auto\" : undefined}\n onClick={() => onAction?.(\"reply\", value)}\n >\n {value ? spec.yes : spec.no}\n </Button>\n )\n // Together, the default leads; apart, it takes the right edge.\n const order = end ? [!chosen, chosen] : [chosen, !chosen]\n\n return (\n <ConfirmCard\n question={strong(spec.question)}\n description={spec.description}\n heading={spec.heading}\n cost={costOf(spec.cost)}\n costAs={spec.costAs}\n seamless\n caveat={spec.caveat ? <CaveatNote label={spec.caveat.label}>{spec.caveat.text}</CaveatNote> : undefined}\n hint={spec.hint ? hintText(spec.hint) : undefined}\n >\n {order.map(button)}\n </ConfirmCard>\n )\n}\n","import { ArtifactCard, ArtifactTable, Badge, Button } from \"@invana/ui\"\n\nimport type { BlockProps, FileItem } from \"../types\"\nimport { BADGE_TONE } from \"../format\"\n\n/** A page with its corner folded — a file, whatever its type. */\nfunction FileGlyph() {\n return (\n <svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.3\" aria-hidden>\n <path d=\"M4 1.5h5.5L13 5v9.5H4z\" />\n <path d=\"M9.5 1.5V5H13\" />\n </svg>\n )\n}\n\nconst noteOf = (file: FileItem) => file.note ?? file.size\n\n/**\n * The files an answer hands over. Several are a list, each addressed by its\n * digest or offered for download; one file is a card that says what it holds,\n * with its download or its state at the right.\n */\nexport function FilesBlock({ spec, onAction }: BlockProps<\"files\">) {\n const download = (file: FileItem) =>\n onAction?.(\"download\", file.digest ?? file.name)\n\n if (spec.files.length === 1) {\n const file = spec.files[0]!\n return (\n <ArtifactCard\n file={{ name: file.name, size: file.size, digest: file.digest }}\n note={noteOf(file)}\n aside={\n file.status ? (\n <Badge variant=\"soft\" size=\"xs\" tone={BADGE_TONE[file.status.tone ?? \"neutral\"]} className=\"font-normal\">\n {file.status.label}\n </Badge>\n ) : spec.download ? (\n <Button type=\"button\" variant=\"outline\" size=\"xs\" onClick={() => download(file)}>\n Download\n </Button>\n ) : undefined\n }\n />\n )\n }\n\n return (\n <ArtifactTable\n variant=\"list\"\n files={spec.files.map((file) => ({\n name: file.name,\n size: file.size,\n digest: spec.download ? undefined : file.digest,\n icon: spec.download ? <FileGlyph /> : undefined,\n }))}\n onDownload={spec.download ? (_, i) => download(spec.files[i]!) : undefined}\n />\n )\n}\n","import * as React from \"react\"\nimport { useForm } from \"react-hook-form\"\nimport { Button } from \"@invana/ui\"\nimport {\n Form,\n ObjectField,\n type FieldConfig,\n type FieldType,\n type FieldValues,\n} from \"@invana/forms\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport type { BlockProps, FormOptions } from \"../types\"\nimport { AskHint, AskQuestion, AskSummary } from \"../parts/ask\"\n\ntype Spec = FormOptions[\"fields\"][number]\ntype Values = Record<string, unknown>\n\n/**\n * The grammar's field types, as the form generator's. A date is typed text\n * until the kit has a date field: its default is already the label the analyst\n * reads, `1 Nov 2026`. A checkbox is the generator's boolean drawn as a box.\n */\nconst FIELD_TYPE: Record<Spec[\"type\"], FieldType> = {\n number: \"number\",\n text: \"text\",\n date: \"text\",\n select: \"select\",\n textarea: \"textarea\",\n checkbox: \"boolean\",\n radio: \"radio\",\n}\n\nconst blank = (v: unknown) => v == null || (typeof v === \"string\" && v.trim() === \"\")\n\n/**\n * The field's rules: `required` (a checkbox must be ticked) and a number's\n * bounds, each as the message that says which one it broke.\n */\nfunction rules(f: Spec): FieldConfig[\"rules\"] {\n if (!f.required && f.above == null && f.below == null) return undefined\n return {\n validate: (v: unknown) => {\n if (f.required && (f.type === \"checkbox\" ? v !== true : blank(v))) return \"Required\"\n const n = Number(v)\n if (f.above != null && !(n > f.above)) return `Must be above ${f.above}`\n if (f.below != null && !(n < f.below)) return `Must be below ${f.below}`\n return true\n },\n }\n}\n\n/**\n * A select's or radio's choices. A select sent without them still shows its\n * default, as its one choice.\n */\nfunction optionsOf(f: Spec): FieldConfig[\"options\"] {\n if (f.options) return f.options\n if (f.type === \"select\" && f.default != null) {\n return [{ value: String(f.default), label: String(f.default) }]\n }\n return undefined\n}\n\nconst toField = (f: Spec): FieldConfig => ({\n name: f.name,\n type: FIELD_TYPE[f.type],\n control: f.type === \"checkbox\" ? \"checkbox\" : undefined,\n label: f.label,\n unit: f.unit,\n aside: f.aside,\n description: f.hint,\n group: f.group,\n options: optionsOf(f),\n rows: f.rows,\n disabled: f.disabled,\n rules: rules(f),\n placeholder: f.placeholder ?? \"\",\n // A long answer takes the row; so does a list of described choices.\n colSpan: f.type === \"textarea\" || (f.type === \"radio\" && f.options?.some((o) => o.description)) ? 2 : undefined,\n})\n\n/** A field's value before the analyst touches it: a checkbox is off unless it says. */\nconst initial = (f: Spec) => (f.type === \"checkbox\" ? (f.default ?? false) : f.default)\n\n/** A value with its unit, as the summary reads it — `30%`, `17 d`. */\nfunction withUnit(value: unknown, unit?: string): string {\n if (value == null || value === \"\") return \"—\"\n if (!unit) return String(value)\n return /^[A-Za-z]/.test(unit) ? `${value} ${unit}` : `${value}${unit}`\n}\n\n/** A field's answer as the summary reads it: a checkbox `Yes`/`No`, a choice its label. */\nfunction answerOf(f: Spec, value: unknown): string {\n if (f.type === \"checkbox\") return value === true ? \"Yes\" : \"No\"\n const picked = f.options?.find((o) => o.value === value)\n return picked ? picked.label : withUnit(value, f.unit)\n}\n\n/**\n * Several related values answered together, where they only make sense as a\n * set — scenario inputs. The fields render through the form generator: with\n * `labels: \"side\"` in a column on the left, with `\"top\"` over each field, two\n * to a row where the card is wide enough; a field's `group` sets it under a\n * small caps name. A `textarea` and a list of described `radio` choices take\n * the row; a `checkbox` sits beside its label. A number out of its\n * `above`/`below` bounds, or a `required` field left empty, says so under\n * itself and holds the submit back. The submit sends a `reply` keyed by field\n * name.\n *\n * Answered, it settles into its values as label/value pairs; Change inputs\n * reopens the form with them filled in, and sending again is a `change`.\n */\nexport function FormAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"form\">) {\n // The <form>'s element id: unique on the page, whatever the turn ids are.\n const auto = React.useId()\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const current = (given ?? {}) as Values\n const top = spec.labels === \"top\"\n\n const defaults = Object.fromEntries(\n spec.fields.map((f) => [f.name, pending ? initial(f) : current[f.name]]),\n )\n // Untyped past the root: ObjectField takes any form's control.\n const form = useForm<FieldValues>({ defaultValues: { values: defaults }, mode: \"onChange\" })\n\n if (!pending && !editing) {\n return (\n <AskSummary\n rows={spec.fields.map((f) => ({ label: f.label, value: answerOf(f, current[f.name]) }))}\n change={state === \"answered\" ? \"Change inputs\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n // The <form> holds only the fields, so the question, hint and actions stay\n // in the card's own rhythm; the submit reaches it through `form`.\n return (\n <Form {...form}>\n <AskQuestion text={spec} />\n <form\n id={`${auto}-form`}\n onSubmit={form.handleSubmit(({ values }) => {\n onAction?.(editing ? \"change\" : \"reply\", values)\n setEditing(false)\n })}\n >\n <ObjectField\n control={form.control}\n name=\"values\"\n fields={spec.fields.map(toField)}\n labelPosition={top ? \"top\" : \"side\"}\n size=\"xs\"\n columns={top ? 2 : 1}\n fit=\"container\"\n groupAs=\"section\"\n />\n </form>\n <AskHint>{spec.hint}</AskHint>\n <ClarifyActions>\n <Button\n type=\"submit\"\n form={`${auto}-form`}\n size=\"xs\"\n className={top ? \"ms-auto\" : undefined}\n disabled={!form.formState.isValid}\n >\n {spec.submit ?? \"Submit\"}\n </Button>\n </ClarifyActions>\n </Form>\n )\n}\n","import * as React from \"react\"\nimport { Badge, Gantt, type ExpandedKeys, type GanttRow } from \"@invana/ui\"\n\nimport { BADGE_TONE } from \"../format\"\nimport type { BlockProps, GanttSpecBar, GanttSpecRow } from \"../types\"\n\n/** The tasks drawn open at first, by key — every task the spec marks `open`. */\nconst openKeys = (tasks: GanttSpecRow[]): Record<string, boolean> =>\n Object.fromEntries(\n tasks.flatMap((t) => [...(t.open ? [[t.key, true] as const] : []), ...Object.entries(openKeys(t.subtasks ?? []))]),\n )\n\n/** Every task's key, nested ones too. */\nconst allKeys = (tasks: GanttSpecRow[]): string[] => tasks.flatMap((t) => [t.key, ...allKeys(t.subtasks ?? [])])\n\n/** A bar's chip, as the badge the JSON names. */\nconst toBar = ({ chip, ...bar }: GanttSpecBar) => ({\n ...bar,\n chip: chip ? (\n <Badge variant=\"soft\" tone={BADGE_TONE[chip.tone ?? \"neutral\"]}>\n {chip.label}\n </Badge>\n ) : undefined,\n})\n\n/** A plan read in order counts steps, not milliseconds. */\nconst STEP_TICK = (n: number) => `step ${Math.round(n)}`\nconst STEPS = (n: number) => (Math.round(n) === 1 ? \"1 step\" : `${Math.round(n)} steps`)\n\n/** Where the spec's drawing ends — every bar, attempt, gate and the now line. */\nconst lastEnd = (spec: BlockProps<\"gantt\">[\"spec\"]): number => {\n const end = (b: { startMs?: number; durationMs?: number }) => (b.startMs ?? 0) + (b.durationMs ?? 0)\n const ends = (tasks: GanttSpecRow[]): number[] =>\n tasks.flatMap((t) => [\n ...(t.startMs != null ? [end(t)] : []),\n ...(t.attempts ?? []).map(end),\n ...(t.segments ?? []).map(end),\n ...ends(t.subtasks ?? []),\n ])\n return Math.max(spec.nowMs ?? 0, ...ends(spec.tasks), ...(spec.seams ?? []).map(end))\n}\n\n/**\n * A plan's clock in whole steps: one tick per step while that fits, else the\n * most intervals (up to 8) that divide the span evenly, so no two ticks name\n * the same step.\n */\nconst stepTicks = (span: number): number => {\n if (span <= 8) return span\n for (let n = 8; n > 1; n--) if (span % n === 0) return n\n return 1\n}\n\n/**\n * The spec's words as the Gantt's: a task is a row, its `subtasks` the rows it\n * opens into, its `segments` the bars it holds — the open flag left behind.\n */\nconst toRow = ({ open: _open, subtasks, segments, ...task }: GanttSpecRow): GanttRow => ({\n ...task,\n bars: segments?.map(toBar),\n rows: subtasks?.map(toRow),\n})\n\n/**\n * Where a run's time went: one row per task on the run's own clock, a retry's\n * failed attempt to the left of the one that stuck, a task that never ran as an\n * outline. A task that split into others opens into them; one with no timing of\n * its own draws the stretch they cover. Hover a row for what it produced; pick\n * one and it is sent as `select` with the task's key.\n *\n * A row's `segments` are many bars on one row — what a worker slot held, what a\n * layer was reached for — painted by `palette`. A keyed bar is picked on its\n * own and sent as `select` with its key. With `scale: \"seq\"` the clock counts a\n * plan's steps, so the same drawing reads a plan before it runs. The reader opens\n * and closes rows; a spec whose `open` flags change opens and closes them again.\n */\nexport function GanttBlock({ spec, onAction }: BlockProps<\"gantt\">) {\n const [selected, setSelected] = React.useState<string | null>(spec.selected ?? null)\n const [expanded, setExpanded] = React.useState<ExpandedKeys>(() => openKeys(spec.tasks))\n // Two ways the spec opens rows. A task that streams in marked `open` opens, and the rows the\n // reader opened or closed keep their choice. A patch that changes the `open` flags of tasks\n // already drawn (an `Expand all`) wins again, compared by the keys it opens, so a new spec\n // object with the same flags (a selection moved) leaves the reader's rows alone.\n const keys = allKeys(spec.tasks)\n const flagged = openKeys(spec.tasks)\n const openedAmong = (among: string[]) => among.filter((key) => flagged[key]).sort().join(\"\\n\")\n const [seen, setSeen] = React.useState(() => new Set(keys))\n const [lastOpened, setLastOpened] = React.useState(() => openedAmong(keys))\n const fresh = keys.filter((key) => !seen.has(key))\n const reflagged = openedAmong(keys.filter((key) => seen.has(key))) !== lastOpened\n if (fresh.length || reflagged) {\n setSeen(new Set(keys))\n setLastOpened(openedAmong(keys))\n if (reflagged) setExpanded(flagged)\n else {\n const arrived = fresh.filter((key) => flagged[key])\n if (arrived.length)\n setExpanded((e) => (e === true ? e : { ...e, ...Object.fromEntries(arrived.map((k) => [k, true])) }))\n }\n }\n const rows = React.useMemo(() => spec.tasks.map(toRow), [spec.tasks])\n // A plan counts whole steps: its span rounds up to one, and its ticks fall on them.\n const seq = spec.scale === \"seq\"\n const steps = seq ? (spec.spanMs ?? Math.max(Math.ceil(lastEnd(spec)), 1)) : undefined\n const span = steps ?? spec.spanMs\n const ticks = spec.ticks ?? (steps != null ? stepTicks(steps) : undefined)\n const pick = (key: string) => {\n setSelected(key)\n onAction?.(\"select\", key)\n }\n\n return (\n <Gantt\n rows={rows}\n spanMs={span}\n nowMs={spec.nowMs}\n openEnded={spec.openEnded}\n ticks={ticks}\n formatTick={seq ? STEP_TICK : undefined}\n formatDuration={seq ? STEPS : undefined}\n labelWidth={spec.labelWidth}\n durationWidth={spec.durationWidth}\n palette={spec.palette}\n seams={spec.seams}\n density={spec.density}\n expanded={expanded}\n onExpandedChange={setExpanded}\n selectedKey={selected}\n onSelectRow={onAction ? pick : undefined}\n onSelectBar={onAction ? pick : undefined}\n />\n )\n}\n","import { MetricGrid, MetricTile } from \"@invana/ui\"\n\nimport { CAPTION_TONE, gaugeProps, metricValue } from \"../format\"\nimport type { BlockProps } from \"../types\"\n\n/** Three across; four sit two by two rather than three and one; more wrap in threes. */\nconst columnsFor = (n: number) => (n === 4 ? 2 : Math.min(n, 3))\n\n/**\n * A band of figures that belong to one answer, each with its change beneath it\n * and, where a figure has a ceiling or a target, a bar under it.\n */\nexport function GridBlock({ spec }: BlockProps<\"grid\">) {\n return (\n <MetricGrid\n joined\n seamless\n minTileWidth={spec.minTileWidth}\n columns={spec.minTileWidth ? undefined : columnsFor(spec.tiles.length)}\n >\n {spec.tiles.map((tile) => (\n <MetricTile\n key={tile.label}\n variant=\"figure\"\n label={tile.label}\n value={metricValue(tile.value)}\n tone={tile.value == null ? \"muted\" : undefined}\n caption={tile.delta}\n captionTone={tile.tone ? CAPTION_TONE[tile.tone] : undefined}\n flagged={tile.flag}\n {...gaugeProps(tile.gauge)}\n />\n ))}\n </MetricGrid>\n )\n}\n","import * as React from \"react\"\nimport { HeatStrip, type HeatStripRow, type HeatState } from \"@invana/charts\"\n\nimport type { BlockProps, HeatStripRowOptions, Tone } from \"../types\"\n\n/** The grammar's tones, as the status colours a square is drawn in. */\nconst COLOR: Record<Tone, string> = {\n good: \"var(--color-success)\",\n bad: \"var(--color-destructive)\",\n warn: \"var(--color-warning)\",\n neutral: \"var(--color-muted-foreground)\",\n}\n\nconst toRow = ({ id, label, cells, children }: HeatStripRowOptions): HeatStripRow => ({\n key: id,\n label,\n cells,\n children: children?.map(toRow),\n})\n\nconst openKeys = (rows: HeatStripRowOptions[]): Record<string, boolean> =>\n Object.fromEntries(\n rows.flatMap((r) => [...(r.open ? [[r.id, true] as const] : []), ...Object.entries(openKeys(r.children ?? []))]),\n )\n\n/**\n * A run of firings, one square each, in time order — a schedule's day, most\n * green and the one that is not. With `rows`, several strips over one axis, and\n * a row opens into its children, so the red square can be followed down to the\n * job that went red. The legend is always drawn: a square has no label of its own.\n */\nexport function HeatStripBlock({ spec }: BlockProps<\"heatstrip\">) {\n const states = React.useMemo<HeatState[]>(\n () => spec.states.map((s) => ({ key: s.key, label: s.label, hollow: s.hollow, color: COLOR[s.tone ?? \"neutral\"] })),\n [spec.states],\n )\n const rows = React.useMemo(() => spec.rows?.map(toRow), [spec.rows])\n const defaultExpanded = React.useMemo(() => openKeys(spec.rows ?? []), [spec.rows])\n\n return (\n <HeatStrip\n cells={spec.cells}\n rows={rows}\n states={states}\n ticks={spec.ticks}\n defaultExpanded={defaultExpanded}\n />\n )\n}\n","import * as React from \"react\"\nimport { PropertyList, PropertyRow } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport {\n ChatSessionDisclosure,\n ChatSessionDisclosureCode,\n ChatSessionDisclosureSteps,\n} from \"@invana/ui\"\nimport { strong } from \"../prose\"\n\n/**\n * The query, formula or model behind the figure, folded. Closed, the line\n * carries the meta at the right, or the code itself when there is none; open,\n * the code moves into its own block, with what a model rests on under it, or\n * the steps of a method that took several.\n */\nexport function MethodBlock({ spec }: BlockProps<\"method\">) {\n const [open, setOpen] = React.useState(spec.open ?? false)\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={spec.label ?? \"method\"}\n meta={spec.meta ?? (open ? undefined : spec.code?.replace(/\\*\\*/g, \"\"))}\n open={open}\n onOpenChange={setOpen}\n >\n <>\n {spec.code ? <ChatSessionDisclosureCode>{strong(spec.code)}</ChatSessionDisclosureCode> : null}\n {spec.facts?.length ? (\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {spec.facts.map((fact) => (\n <PropertyRow key={fact.label} label={fact.label} mono>\n {fact.value}\n </PropertyRow>\n ))}\n </PropertyList>\n ) : null}\n {spec.steps?.length ? <ChatSessionDisclosureSteps steps={spec.steps} /> : null}\n </>\n </ChatSessionDisclosure>\n )\n}\n","import { Sparkline } from \"@invana/charts\"\nimport { MetricTile } from \"@invana/ui\"\n\nimport { CAPTION_TONE, gaugeProps, metricValue } from \"../format\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * The one figure an answer turns on, with its comparison worded under it — and,\n * when the answer has them, a bar against its target or its recent run beside it.\n */\nexport function MetricBlock({ spec }: BlockProps<\"metric\">) {\n return (\n <MetricTile\n variant=\"hero\"\n label={spec.label}\n value={metricValue(spec.value)}\n tone={spec.value == null ? \"muted\" : undefined}\n caption={spec.delta}\n captionTone={spec.tone ? CAPTION_TONE[spec.tone] : undefined}\n {...gaugeProps(spec.gauge)}\n aside={\n spec.trend?.length ? (\n <Sparkline\n values={spec.trend}\n width={96}\n height={32}\n strokeWidth={1.4}\n endMarker={false}\n color=\"color-mix(in srgb, var(--color-foreground) 70%, transparent)\"\n label={`${spec.label}, recent run`}\n />\n ) : undefined\n }\n />\n )\n}\n","import * as React from \"react\"\nimport {\n Button,\n cn,\n Questionnaire,\n QuestionnaireChoice,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireItem,\n QuestionnaireTitle,\n} from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport { AskHint, AskLink, AskSummary, choiceParts, hintText, isHeading, joinPicks } from \"../parts/ask\"\nimport { strong } from \"../prose\"\n\n/**\n * The submit's words, from the ask's `submit` or else from the question. A\n * prompt that is a phrase — `Adjust for` — is already the verb: `Adjust for 4`.\n * A question — `Who should receive it?` — is not, so it says what is being\n * sent: `Use 2 selected`.\n */\nfunction submitLabel(question: string, count: number, submit?: string) {\n if (submit) return submit.replace(\"{count}\", String(count))\n const q = question.trim()\n return q.endsWith(\"?\") ? `Use ${count} selected` : `${q} ${count}`\n}\n\n/**\n * Several choices from a list the data model holds — filters, or the\n * assumptions an analysis will make, where the one left off says why in its\n * `note`. The defaults arrive ticked; `min` holds the submit back until enough\n * are, and `max` counts toward its limit beside the submit — at the limit the\n * rest stop being offered. Options take the same description, lead and\n * figure a single choice does. Submit sends the ticked values as a `reply`, in\n * the ask's order.\n *\n * Answered, it settles into one label/value pair; Change answer reopens it.\n */\nexport function MultiAsk({ spec, state = \"pending\", value: given, id: idProp, onAction }: BlockProps<\"multi\">) {\n const auto = React.useId()\n const id = idProp ?? auto\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const [picked, setPicked] = React.useState<string[]>(\n pending ? (spec.default ?? []) : ((given as string[] | undefined) ?? []),\n )\n\n if (!pending && !editing) {\n const value = (given as string[] | undefined) ?? spec.default ?? []\n const text = joinPicks(spec.options.filter((o) => value.includes(o.value)))\n return (\n <AskSummary\n rows={[{ label: spec.label ?? \"Answer\", value: text || \"—\" }]}\n change={state === \"answered\" ? \"Change answer\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const full = spec.max != null && picked.length >= spec.max\n const short = spec.min != null && picked.length < spec.min\n const toggle = (v: string) =>\n setPicked((now) => (now.includes(v) ? now.filter((x) => x !== v) : [...now, v]))\n const all = spec.options.filter((o) => !o.disabled).map((o) => o.value)\n\n return (\n <>\n <Questionnaire\n id={`${auto}-form`}\n onSubmit={(e) => {\n e.preventDefault()\n if (short) return\n const value = spec.options.map((o) => o.value).filter((v) => picked.includes(v))\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n }}\n >\n <QuestionnaireItem name={id} multiple>\n <QuestionnaireTitle\n className={cn(\n isHeading(spec) && \"font-semibold\",\n spec.selectAll && \"flex w-full items-baseline justify-between gap-2\",\n )}\n >\n {strong(spec.question)}\n {spec.selectAll ? (\n <AskLink onClick={() => setPicked(spec.max != null ? all.slice(0, spec.max) : all)}>Select all</AskLink>\n ) : null}\n </QuestionnaireTitle>\n {spec.description ? <QuestionnaireDescription>{spec.description}</QuestionnaireDescription> : null}\n <QuestionnaireChoices>\n {spec.options.map((o) => {\n const checked = picked.includes(o.value)\n const { props, body } = choiceParts(o)\n return (\n <QuestionnaireChoice\n key={o.value}\n value={o.value}\n {...props}\n disabled={o.disabled || (full && !checked)}\n checked={checked}\n onChange={() => toggle(o.value)}\n >\n {body}\n </QuestionnaireChoice>\n )\n })}\n </QuestionnaireChoices>\n </QuestionnaireItem>\n </Questionnaire>\n <AskHint>{spec.hint}</AskHint>\n <ClarifyActions>\n {spec.max != null ? (\n full && spec.max < spec.options.length ? (\n <AskHint tone=\"warning\">Limit reached · clear one to swap</AskHint>\n ) : (\n <span className=\"text-xs text-muted-foreground\">{hintText(`**${picked.length}** of ${spec.max}`)}</span>\n )\n ) : null}\n <Button type=\"submit\" form={`${auto}-form`} size=\"xs\" className=\"ms-auto\" disabled={short}>\n {submitLabel(spec.question, picked.length, spec.submit)}\n </Button>\n </ClarifyActions>\n </>\n )\n}\n","import { cn } from \"@invana/ui\"\n\nexport interface PlaceholderProps {\n /** The block's kind. */\n kind: string\n /** The block's spec exactly as it was sent. */\n options: unknown\n className?: string\n}\n\n/**\n * A block with no renderer yet: its kind and the JSON it was sent.\n *\n * Shown rather than skipped, and never an error. A conversation is data that\n * outlives the code reading it, and a silently missing block is worse than a\n * visible one, because the analyst reads an answer they believe is complete.\n * While the kit is being built, the placeholders in a session story are also\n * the work left, in the place it will appear.\n */\nexport function Placeholder({ kind, options, className }: PlaceholderProps) {\n const { kind: _kind, ...rest } = (options ?? {}) as Record<string, unknown>\n const json = JSON.stringify(rest, null, 2)\n return (\n <div\n data-placeholder={kind}\n className={cn(\"flex min-w-0 flex-col gap-1 border border-dashed border-border p-2\", className)}\n >\n <span className=\"text-sm text-muted-foreground\">\n No renderer yet for the block <span className=\"font-mono text-foreground\">{kind}</span>\n </span>\n {json !== \"{}\" ? (\n <pre className=\"max-h-40 overflow-auto font-mono text-sm text-muted-foreground\">{json}</pre>\n ) : null}\n </div>\n )\n}\n","import * as React from \"react\"\nimport {\n Button,\n PropertyList,\n PropertyRow,\n Questionnaire,\n QuestionnaireActions,\n QuestionnaireChoice,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireInput,\n QuestionnaireItem,\n QuestionnaireNext,\n QuestionnairePrevious,\n QuestionnaireProgress,\n QuestionnaireProgressBar,\n QuestionnaireSkip,\n QuestionnaireSubmit,\n QuestionnaireTitle,\n} from \"@invana/ui\"\n\nimport { Placeholder } from \"../placeholder\"\nimport type { BlockProps, MultistepOptions } from \"../types\"\nimport { strong } from \"../prose\"\nimport { AskHint, AskLink, AskSummary, choiceParts, joinPicks } from \"../parts/ask\"\n\ntype Step = MultistepOptions[\"steps\"][number]\ntype Answers = Record<string, unknown>\ntype Status = \"unanswered\" | \"answered\" | \"skipped\"\n\n/** A step's question: always a heading, its description under it. */\nfunction StepTitle({ step }: { step: Step }) {\n if (!(\"question\" in step)) return null\n return (\n <>\n <QuestionnaireTitle className=\"font-semibold\">{strong(step.question ?? \"\")}</QuestionnaireTitle>\n {\"description\" in step && step.description ? (\n <QuestionnaireDescription>{step.description}</QuestionnaireDescription>\n ) : null}\n </>\n )\n}\n\n/** A step's own answer, as the form holds it before it is sent. */\nfunction StepItem({\n step,\n value,\n onStatusChange,\n}: {\n step: Step\n value: unknown\n onStatusChange: (status: Status) => void\n}) {\n const item = { name: step.id, required: step.required, onStatusChange }\n switch (step.kind) {\n case \"single\":\n case \"multi\": {\n const multiple = step.kind === \"multi\"\n const chosen = (v: string) =>\n multiple ? Array.isArray(value) && value.includes(v) : value === v\n return (\n <QuestionnaireItem {...item} multiple={multiple}>\n <StepTitle step={step} />\n <QuestionnaireChoices>\n {step.options.map((o) => {\n const { props, body } = choiceParts(o)\n return (\n <QuestionnaireChoice\n key={o.value}\n value={o.value}\n {...props}\n disabled={o.disabled}\n defaultChecked={chosen(o.value)}\n >\n {body}\n </QuestionnaireChoice>\n )\n })}\n </QuestionnaireChoices>\n </QuestionnaireItem>\n )\n }\n case \"number\":\n case \"short\":\n case \"long\":\n return (\n <QuestionnaireItem {...item}>\n <StepTitle step={step} />\n <QuestionnaireInput\n type={step.kind === \"number\" ? \"number\" : \"text\"}\n unit={step.kind === \"number\" ? step.unit : undefined}\n min={step.kind === \"number\" ? step.min : undefined}\n max={step.kind === \"number\" ? step.max : undefined}\n step={step.kind === \"number\" ? step.step : undefined}\n defaultValue={value == null ? undefined : String(value)}\n aria-label={step.question}\n />\n {\"hint\" in step ? <AskHint>{step.hint}</AskHint> : null}\n </QuestionnaireItem>\n )\n default:\n return (\n <QuestionnaireItem {...item}>\n <Placeholder kind={step.kind} options={step} />\n </QuestionnaireItem>\n )\n }\n}\n\n/** A number as the summary reads it — `2,200 kg/ha`, `55%`. */\nfunction numberText(value: unknown, unit?: string) {\n const n = typeof value === \"number\" ? value : Number(value)\n const text = Number.isFinite(n) ? n.toLocaleString(\"en-GB\") : String(value)\n if (!unit) return text\n return /^[A-Za-z]/.test(unit) ? `${text} ${unit}` : `${text}${unit}`\n}\n\n/** What each step's answer reads as in the review and the settled summary. */\nfunction answerText(step: Step, value: unknown): string {\n if (value == null || value === \"\" || (Array.isArray(value) && !value.length)) return \"—\"\n switch (step.kind) {\n case \"single\":\n case \"quick\": {\n const o = step.options.find((x) => x.value === value)\n return o ? ((\"summary\" in o && o.summary) || o.label) : String(value)\n }\n case \"multi\": {\n const values = Array.isArray(value) ? value : [value]\n return joinPicks(values.map((v) => step.options.find((x) => x.value === v) ?? { value: String(v), label: String(v) }))\n }\n case \"number\":\n return numberText(value, step.unit)\n default:\n return typeof value === \"object\" ? JSON.stringify(value) : String(value)\n }\n}\n\n/** A step's name in a summary: its `label`, else its id — `until` → `Until`. */\nconst labelOf = (step: Step) =>\n (\"label\" in step && step.label) || step.id.charAt(0).toUpperCase() + step.id.slice(1)\n\n/** The form's answers, typed by each step's block. */\nfunction collect(steps: Step[], form: HTMLFormElement): Answers {\n const data = new FormData(form)\n const out: Answers = {}\n for (const step of steps) {\n const all = data.getAll(step.id).map(String).filter(Boolean)\n if (step.kind === \"multi\") out[step.id] = all\n else if (!all.length) continue\n else if (step.kind === \"number\") out[step.id] = Number(all[0])\n else out[step.id] = all[0]\n }\n return out\n}\n\n/**\n * Several related asks sent as one request, one step at a time with its\n * progress. Skip is offered on a step that is not `required` and not the\n * last; a required step holds Next back, saying why, until it is answered.\n * With `review`, the last step leads to the answers laid out once more, each\n * with Edit, before they are sent. The value is keyed by step id.\n *\n * Answered, it settles into the answers as label/value pairs; Change answers\n * reopens the steps with them filled in, and sending again is a `change`,\n * which re-runs from this turn.\n */\nexport function MultistepAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"multistep\">) {\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const steps = spec.steps\n const [item, setItem] = React.useState(steps[0]?.id ?? \"\")\n // A step that arrives with a default is answered before anything is touched.\n const [status, setStatus] = React.useState<Record<string, Status>>(() =>\n Object.fromEntries(\n steps.filter((s) => \"default\" in s && s.default != null).map((s) => [s.id, \"answered\" as Status]),\n ),\n )\n const [review, setReview] = React.useState<Answers | null>(null)\n const formRef = React.useRef<HTMLFormElement>(null)\n const current = (given ?? {}) as Answers\n\n if (!pending && !editing) {\n return (\n <AskSummary\n rows={steps.map((step) => ({ label: labelOf(step), value: answerText(step, current[step.id]) }))}\n change={state === \"answered\" ? \"Change answers\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const send = (value: Answers) => {\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n setReview(null)\n }\n const initial = (step: Step): unknown =>\n editing ? current[step.id] : \"default\" in step ? step.default : undefined\n\n const index = Math.max(0, steps.findIndex((s) => s.id === item))\n const step = steps[index]\n const last = index === steps.length - 1\n const blocked = Boolean(step?.required && status[step.id] !== \"answered\")\n\n return (\n <>\n <Questionnaire\n ref={formRef}\n item={item}\n onItemChange={setItem}\n hidden={review != null}\n onSubmit={(e) => {\n e.preventDefault()\n send(collect(steps, e.currentTarget))\n }}\n >\n <QuestionnaireProgress />\n {steps.map((s) => (\n <StepItem\n key={s.id}\n step={s}\n value={initial(s)}\n onStatusChange={(st) => setStatus((now) => ({ ...now, [s.id]: st }))}\n />\n ))}\n {blocked ? <AskHint tone=\"error\">Pick one to continue · this step is required</AskHint> : null}\n <QuestionnaireActions>\n <QuestionnairePrevious />\n {!last && !step?.required ? <QuestionnaireSkip /> : null}\n <QuestionnaireNext disabled={blocked} />\n {last && spec.review ? (\n <Button\n type=\"button\"\n size=\"xs\"\n className=\"col-start-3 row-start-1 justify-self-end\"\n disabled={blocked}\n onClick={() => formRef.current && setReview(collect(steps, formRef.current))}\n >\n Review\n </Button>\n ) : (\n <QuestionnaireSubmit disabled={blocked} />\n )}\n </QuestionnaireActions>\n </Questionnaire>\n {review ? (\n <>\n <QuestionnaireProgressBar label=\"Review\" value={1} />\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {steps.map((s) => (\n <PropertyRow key={s.id} label={labelOf(s)} mono>\n <span className=\"flex items-baseline gap-2\">\n <span className=\"min-w-0 flex-1\">{answerText(s, review[s.id])}</span>\n <AskLink\n onClick={() => {\n setItem(s.id)\n setReview(null)\n }}\n >\n Edit\n </AskLink>\n </span>\n </PropertyRow>\n ))}\n </PropertyList>\n <QuestionnaireActions>\n <Button type=\"button\" size=\"xs\" variant=\"outline\" className=\"justify-self-start\" onClick={() => setReview(null)}>\n Previous\n </Button>\n <Button type=\"button\" size=\"xs\" className=\"col-start-3 justify-self-end\" onClick={() => send(review)}>\n {`Submit ${steps.length} answers`}\n </Button>\n </QuestionnaireActions>\n </>\n ) : null}\n </>\n )\n}\n","import type * as React from \"react\"\nimport { CitationMarker } from \"@invana/ui\"\n\nimport { prose } from \"../prose\"\nimport type { BlockProps } from \"../types\"\n\nexport interface NarrativeBlockProps extends BlockProps<\"narrative\"> {\n /** The source the reader is on, when the shell tracks it. Defaults to the spec's `active`. */\n active?: number\n /** Pointing at a marker, or away from it. A shell that tracks the source lights its row too. */\n onActiveChange?: (n: number | undefined) => void\n /** Drawn after the text — the conversation's caret while the answer is still being written. */\n trailing?: React.ReactNode\n}\n\n/**\n * The answer in two or three sentences, leading with the number. Markers sit\n * where the text places them (`[n]`), or after it (`cites`); pointing at one\n * lights its source in the citations when the shell tracks it. `trailing` ends\n * the text — the caret, while a conversation is still writing it.\n */\nexport function NarrativeBlock({ spec, active = spec.active, onActiveChange, trailing }: NarrativeBlockProps) {\n const marker = (n: number) => (\n <CitationMarker\n key={`cite-${n}`}\n data-active={active === n || undefined}\n onMouseEnter={() => onActiveChange?.(n)}\n onMouseLeave={() => onActiveChange?.(undefined)}\n >\n {n}\n </CitationMarker>\n )\n return (\n <p>\n {prose(spec.text, marker)}\n {spec.cites?.map(marker)}\n {trailing}\n </p>\n )\n}\n","import {\n MetricGrid,\n MetricTile,\n ProposalCard,\n PropertyList,\n PropertyRow,\n} from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ActionRow } from \"../parts/actions\"\n\n/**\n * Something the answer proposes to write: what it proposes, the draft or what\n * writing it does as figures, what writing it would do in words, and the\n * actions, each sent as its id. Nothing is written until the shell acts on one;\n * once written, a stamp says so. The shell gives it its card and its header.\n */\nexport function ProposalBlock({ spec, onAction }: BlockProps<\"proposal\">) {\n return (\n <ProposalCard\n flush\n title={spec.heading}\n done={spec.done?.label}\n consequence={spec.consequence}\n actions={\n spec.actions.length ? (\n <ActionRow\n actions={spec.actions}\n onAction={(id) => onAction?.(\"action\", id)}\n />\n ) : undefined\n }\n >\n {spec.rows?.length ? (\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {spec.rows.map((row) => (\n <PropertyRow key={row.label} label={row.label} mono>\n {row.value}\n </PropertyRow>\n ))}\n </PropertyList>\n ) : null}\n {spec.figures?.length ? (\n <MetricGrid joined seamless minTileWidth={72}>\n {spec.figures.map((f) => (\n <MetricTile key={f.label} variant=\"figure\" label={f.label} value={f.value} />\n ))}\n </MetricGrid>\n ) : null}\n </ProposalCard>\n )\n}\n","import * as React from \"react\"\nimport { SegmentedControl } from \"@invana/ui\"\n\nimport type { BlockProps, QuickPick } from \"../types\"\nimport { AskHint, AskQuestion, AskSummary } from \"../parts/ask\"\n\ntype Row = QuickPick & { key: string }\n\n/**\n * Two to five short spec in one row — a granularity, a confidence level,\n * an output format — where picking one is the reply. With no `default`\n * nothing is picked, so the reader answers rather than accepts. An option can\n * carry a second line (`±1.4 pp`); `stretch` gives each an equal share of the\n * card. `more` adds rows answered in the same card: the value is then keyed\n * by row, and it is sent once every row has a pick.\n *\n * Answered, each row settles into a label/value pair; Change reopens them.\n */\nexport function QuickAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"quick\">) {\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const keyed = Boolean(spec.more?.length)\n const rows: Row[] = [\n { ...spec, key: spec.label ?? spec.question },\n ...(spec.more ?? []).map((r) => ({ ...r, key: r.id })),\n ]\n\n const settled = (): Record<string, string | undefined> => {\n const value = given\n if (keyed) return (value ?? {}) as Record<string, string>\n return { [rows[0]!.key]: (value as string | undefined) ?? spec.default }\n }\n const [picked, setPicked] = React.useState<Record<string, string | undefined>>(() =>\n pending ? Object.fromEntries(rows.map((r) => [r.key, r.default])) : settled(),\n )\n\n if (!pending && !editing) {\n const value = settled()\n return (\n <AskSummary\n rows={rows.map((r) => ({\n label: r.label ?? r.question,\n value: r.options.find((o) => o.value === value[r.key])?.label ?? value[r.key] ?? \"—\",\n }))}\n change={state === \"answered\" ? (keyed ? \"Change answers\" : \"Change answer\") : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const pick = (key: string, v: string) => {\n const next = { ...picked, [key]: v }\n setPicked(next)\n if (rows.some((r) => next[r.key] == null)) return\n const value = keyed ? (next as Record<string, string>) : v\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n }\n\n return (\n <>\n {rows.map((r, i) => (\n <React.Fragment key={r.key}>\n {i === 0 ? <AskQuestion text={spec} /> : <p className=\"mt-1\">{r.question}</p>}\n <SegmentedControl\n size=\"sm\"\n aria-label={r.question}\n variant=\"solid\"\n stretch={spec.stretch}\n options={r.options}\n defaultValue={picked[r.key] ?? null}\n onValueChange={(v) => pick(r.key, v)}\n />\n <AskHint>{r.hint}</AskHint>\n </React.Fragment>\n ))}\n </>\n )\n}\n","import { BarChartH } from \"@invana/charts\"\n\nimport { figureText } from \"../format\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * Items in the order they matter — drivers, top-N, likely causes — each with\n * its bar, and its value in a column at the right. A negative contribution\n * draws in the destructive colour; the rest, folded into one line, is muted.\n * `diverging` grows the bars both ways from zero.\n */\nexport function RankedBlock({ spec }: BlockProps<\"ranked\">) {\n return (\n <BarChartH\n variant=\"ranked\"\n color=\"var(--color-primary)\"\n diverging={spec.diverging}\n data={spec.items.map((item) => ({\n label: item.label,\n value: item.value,\n display: item.display ?? figureText(item.value),\n muted: item.muted,\n }))}\n />\n )\n}\n","import { Avatar, AvatarFallback, Badge, Eyebrow, PropertyList, PropertyRow } from \"@invana/ui\"\n\nimport { BADGE_TONE } from \"../format\"\nimport type { BlockProps, RecordRow } from \"../types\"\n\nfunction Rows({ rows }: { rows: RecordRow[] }) {\n return (\n <PropertyList labelWidth=\"auto\" variant=\"summary\">\n {rows.map((row) => (\n <PropertyRow key={row.label} label={row.label} mono={row.mono ?? true}>\n {row.value}\n {row.source ? <span className=\"text-xs text-muted-foreground\"> · {row.source}</span> : null}\n </PropertyRow>\n ))}\n </PropertyList>\n )\n}\n\n/**\n * One entity, or the assumptions behind an answer, as label/value pairs — with\n * who it is and its state above them, rows under headings, and where each\n * value came from when that is the point.\n */\nexport function RecordBlock({ spec }: BlockProps<\"record\">) {\n const { header } = spec\n return (\n <div className=\"flex min-w-0 flex-col gap-1.5\">\n {header ? (\n <div className=\"flex items-center gap-2\">\n {header.initials ? (\n <Avatar className=\"size-7 border border-border\">\n <AvatarFallback className=\"text-xs font-semibold text-muted-foreground\">\n {header.initials}\n </AvatarFallback>\n </Avatar>\n ) : null}\n <span className=\"min-w-0 truncate font-semibold\">{header.title}</span>\n {header.status ? (\n <Badge\n variant=\"soft\"\n size=\"xs\"\n tone={BADGE_TONE[header.status.tone ?? \"neutral\"]}\n className=\"ms-auto font-normal\"\n >\n {header.status.label}\n </Badge>\n ) : null}\n </div>\n ) : null}\n {spec.rows?.length ? <Rows rows={spec.rows} /> : null}\n {spec.groups?.map((group, i) => (\n <div key={group.label} className={i > 0 || spec.rows?.length ? \"mt-1 flex flex-col gap-1\" : \"flex flex-col gap-1\"}>\n <Eyebrow>{group.label}</Eyebrow>\n <Rows rows={group.rows} />\n </div>\n ))}\n </div>\n )\n}\n","import { ScopeLine } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * Period, filters, population and freshness, as the query applied them. Each\n * part is edited in place — typed, or picked from its choices — and sent as a\n * `scope` action with `{ part, value }`; a part the shell marks `fixed` — a\n * freshness, say — is a fact about the data and stays as it is. A part carried from an earlier question and changed since,\n * or resting on late data, is marked, and a hint about late data is a warning.\n */\nexport interface ScopeBlockProps extends BlockProps<\"scope\"> {\n /** Parts that are facts, not choices — a freshness the data states. Drawn, never edited. */\n fixed?: number[]\n}\n\nexport function ScopeBlock({ spec, fixed, onAction }: ScopeBlockProps) {\n const stale = spec.parts.some((p) => typeof p === \"object\" && p.mark === \"stale\")\n return (\n <ScopeLine\n parts={spec.parts}\n fixedParts={fixed}\n defaultOpenPart={spec.openPart}\n note={spec.hint}\n noteTone={stale ? \"warning\" : \"muted\"}\n seamless\n onPartChange={(part, value) => onAction?.(\"scope\", { part, value })}\n />\n )\n}\n","import * as React from \"react\"\nimport {\n Button,\n Questionnaire,\n QuestionnaireChoice,\n QuestionnaireChoiceTitle,\n QuestionnaireChoices,\n QuestionnaireDescription,\n QuestionnaireInput,\n QuestionnaireItem,\n QuestionnaireTitle,\n} from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ClarifyActions } from \"@invana/ui\"\nimport { AskHint, AskSummary, choiceParts, isHeading, pickText } from \"../parts/ask\"\nimport { strong } from \"../prose\"\n\n/** The value an “Other…” pick holds until its words are typed. */\nconst OTHER = \"\\u0000other\"\n\n/**\n * One choice from a list the data model holds. Picking an option is the reply,\n * so the default is one keypress away — unless the ask names a `submit`, when\n * the pick waits for that button (and Skip, when `skippable`). An option can\n * carry a description under its label, a lead tag or icon before it, and a\n * figure on the right. With `other`, an “Other…” choice opens a field for the\n * analyst's own words, sent with Use this.\n *\n * Answered, it settles into one label/value pair; Change answer reopens it,\n * and picking again is a `change`.\n */\nexport function SingleAsk({ spec, state = \"pending\", value: given, id: idProp, onAction }: BlockProps<\"single\">) {\n const auto = React.useId()\n const id = idProp ?? auto\n const pending = state === \"pending\"\n const [editing, setEditing] = React.useState(false)\n const [picked, setPicked] = React.useState<string | undefined>(spec.default)\n const settledValue = (given as string | undefined) ?? spec.default\n\n if (!pending && !editing) {\n const option = spec.options.find((o) => o.value === settledValue)\n return (\n <AskSummary\n rows={[{ label: spec.label ?? \"Answer\", value: pickText(option, settledValue) }]}\n change={state === \"answered\" ? \"Change answer\" : undefined}\n onChange={() => setEditing(true)}\n />\n )\n }\n\n const send = (value: string) => {\n onAction?.(editing ? \"change\" : \"reply\", value)\n setEditing(false)\n }\n const pick = (value: string) => {\n setPicked(value)\n if (value !== OTHER && !spec.submit) send(value)\n }\n\n const other = picked === OTHER\n const buttons = spec.submit || spec.skippable || other\n\n return (\n <>\n <Questionnaire\n onSubmit={(e) => {\n e.preventDefault()\n if (other) {\n // The item holds the Other pick and the typed words under one name.\n const text = new FormData(e.currentTarget).getAll(id).map(String).find((v) => v !== OTHER)\n if (text?.trim()) send(text.trim())\n } else if (picked) send(picked)\n }}\n id={`${auto}-form`}\n >\n <QuestionnaireItem name={id}>\n <QuestionnaireTitle className={isHeading(spec) ? \"font-semibold\" : undefined}>\n {strong(spec.question)}\n </QuestionnaireTitle>\n {spec.description ? <QuestionnaireDescription>{spec.description}</QuestionnaireDescription> : null}\n <QuestionnaireChoices>\n {spec.options.map((o) => {\n const { props, body } = choiceParts(o)\n return (\n <QuestionnaireChoice\n key={o.value}\n value={o.value}\n {...props}\n disabled={o.disabled}\n checked={picked === o.value}\n onChange={() => pick(o.value)}\n >\n {body}\n </QuestionnaireChoice>\n )\n })}\n {spec.other ? (\n <QuestionnaireChoice value={OTHER} checked={other} onChange={() => pick(OTHER)}>\n <QuestionnaireChoiceTitle>Other…</QuestionnaireChoiceTitle>\n </QuestionnaireChoice>\n ) : null}\n </QuestionnaireChoices>\n {other ? <QuestionnaireInput aria-label=\"Your answer\" autoFocus /> : null}\n </QuestionnaireItem>\n </Questionnaire>\n <AskHint>{spec.hint}</AskHint>\n {buttons ? (\n <ClarifyActions align=\"end\">\n {spec.skippable && !other ? (\n <Button size=\"xs\" variant=\"ghost\" onClick={() => onAction?.(\"skip\")}>\n Skip\n </Button>\n ) : null}\n <Button type=\"submit\" form={`${auto}-form`} size=\"xs\" disabled={!picked}>\n {other ? \"Use this\" : (spec.submit ?? \"Use this\")}\n </Button>\n </ClarifyActions>\n ) : null}\n </>\n )\n}\n","import { SuggestionChips } from \"../parts/suggestion-chips\"\nimport type { BlockProps } from \"../types\"\n\n/**\n * Follow-ups after an answer, each a whole prompt that reuses the current\n * scope; picking one is the reply, and the API sends it on as the next prompt.\n * They run along a line, stack one per line, or sit under headings.\n *\n * Answered, the one picked stays, dimmed, and the rest can still be sent: each\n * is its own next question. Superseded or expired, none can.\n */\nexport function SuggestionsAsk({ spec, state = \"pending\", value: given, onAction }: BlockProps<\"suggestions\">) {\n const open = state === \"pending\" || state === \"answered\"\n const picked = typeof given === \"string\" ? [given] : []\n const all = spec.groups?.length ? spec.groups.flatMap((g) => g.items) : (spec.items ?? [])\n return (\n <SuggestionChips\n items={spec.items}\n groups={spec.groups}\n layout={spec.layout}\n sent={open ? picked : all}\n onSelect={(text) => onAction?.(\"reply\", text)}\n />\n )\n}\n","import { cn } from \"@invana/ui\"\nimport { DataTable, type ColumnDef } from \"@invana/tables\"\n\nimport { figureText } from \"../format\"\nimport type { BlockProps, Cell } from \"../types\"\n\ntype Row = Record<string, Cell>\n\n/** Wider than this many columns, a table keeps them legible and scrolls sideways. */\nconst FITS = 5\n/** The narrowest a column is drawn once the table scrolls, in px. */\nconst COLUMN_MIN = 66\n\n/** A cell's figure as text — what a row's key is compared and sent as. */\nfunction cellText(cell: Cell): string | undefined {\n if (cell == null) return undefined\n if (typeof cell !== \"object\" || !(\"value\" in cell) || \"type\" in cell) return figureText(cell)\n return figureText(cell.value)\n}\n\n/**\n * One cell. A good or bad change is inked by its tone, and the figure a row\n * turns on is strong; an empty cell is a dash, never blank.\n */\nfunction CellText({ cell }: { cell: Cell }) {\n if (cell == null) return <>—</>\n if (typeof cell !== \"object\" || !(\"value\" in cell) || \"type\" in cell) {\n return <>{figureText(cell)}</>\n }\n return (\n <span\n className={cn(\n cell.tone === \"good\" && \"text-success\",\n cell.tone === \"bad\" && \"text-destructive\",\n cell.strong && \"font-semibold\",\n )}\n >\n {figureText(cell.value)}\n </span>\n )\n}\n\n/**\n * The first rows of a longer table, and how many there are in all. When rows\n * are held back, `Open all` asks for them with the `open` action. The column the\n * rows are ordered by is marked, rows an answer turns on are called out, and a\n * total sits under the rows in bold. With a `rowKey`, picking a row sends\n * `select` with its key, and the `selected` row is drawn picked.\n */\nexport function TableBlock({ spec, onAction, seamless }: BlockProps<\"table\">) {\n const truncated = spec.total != null && spec.total > spec.rows.length\n const highlighted = new Set(spec.highlight?.map((i) => spec.rows[i]))\n const data = spec.totals ? [...spec.rows, spec.totals] : spec.rows\n const columns: ColumnDef<Row>[] = spec.columns.map((c) => {\n const sorted = spec.sort?.key === c.key ? spec.sort.dir : undefined\n return {\n id: c.key,\n header: sorted\n ? () => <span className=\"text-foreground\">{`${c.label} ${sorted === \"asc\" ? \"▴\" : \"▾\"}`}</span>\n : c.label,\n accessorFn: (row) => row[c.key],\n cell: (ctx) => <CellText cell={ctx.getValue() as Cell} />,\n meta: { align: c.align, cellClassName: cn(\"whitespace-nowrap\", c.mono && \"font-mono\") },\n }\n })\n const { rowKey } = spec\n const keyOf = (row: Row) => (rowKey != null && row !== spec.totals ? cellText(row[rowKey]) : undefined)\n const noun = [spec.noun, spec.note].filter(Boolean).join(\" · \") || undefined\n return (\n <DataTable\n columns={columns}\n data={data}\n density=\"compact\"\n // The shell frames a block, so the table draws no box of its own.\n bordered={false}\n seamless={seamless}\n enableSorting={false}\n enableColumnVisibility={false}\n minWidth={spec.columns.length > FITS ? spec.columns.length * COLUMN_MIN : undefined}\n isRowHighlighted={highlighted.size ? (row) => highlighted.has(row) : undefined}\n isTotalRow={spec.totals ? (row) => row === spec.totals : undefined}\n isRowSelected={spec.selected != null ? (row) => keyOf(row) === spec.selected : undefined}\n onRowClick={\n rowKey != null && onAction\n ? (row) => {\n const key = keyOf(row)\n if (key != null) onAction(\"select\", key)\n }\n : undefined\n }\n preview={{\n total: spec.total,\n noun,\n onOpen: truncated && onAction ? () => onAction(\"open\") : undefined,\n }}\n />\n )\n}\n","import * as React from \"react\"\nimport { StatusDot, TimelineEntry, TimelineList, TimelineSection, type StatusDotProps } from \"@invana/ui\"\n\nimport type { BlockProps, TimelineEvent, Tone } from \"../types\"\n\n/** The grammar's tones, as the dot's. An event with none is a plain marker. */\nconst DOT_TONE: Record<Tone, StatusDotProps[\"tone\"]> = {\n good: \"success\",\n bad: \"error\",\n warn: \"warning\",\n neutral: \"muted\",\n}\n\n/** A run of events, each with its section label where a new one starts, and its own events under it. */\nfunction Events({ events }: { events: TimelineEvent[] }) {\n return (\n <>\n {events.map((event, i) => (\n <React.Fragment key={i}>\n {event.section && event.section !== events[i - 1]?.section ? (\n <TimelineSection>{event.section}</TimelineSection>\n ) : null}\n <TimelineEntry\n when={event.when}\n marker={<StatusDot tone={DOT_TONE[event.tone ?? \"neutral\"]} size=\"md\" />}\n highlight={event.highlight ? \"error\" : undefined}\n nested={event.children?.length ? <Events events={event.children} /> : undefined}\n defaultOpen={event.open}\n >\n {event.text}\n {event.detail ? <span className=\"text-xs text-muted-foreground\">{event.detail}</span> : null}\n </TimelineEntry>\n </React.Fragment>\n ))}\n </>\n )\n}\n\n/**\n * A few dated events, in order, each marked by what it did to the figure — with\n * a detail line under an event, and labelled runs of events around the one an\n * answer is about, which is called out. An event that breaks into smaller ones\n * opens into them, so a three-day hold can be read step by step.\n */\nexport function TimelineBlock({ spec }: BlockProps<\"timeline\">) {\n return (\n <TimelineList variant=\"compact\">\n <Events events={spec.events} />\n </TimelineList>\n )\n}\n","import { LineChart } from \"@invana/charts\"\n\nimport { figureText } from \"../format\"\nimport type { BlockProps, Tone } from \"../types\"\n\n/** The tones, as the tokens a ring is drawn in. */\nconst RING_COLOR: Record<Tone, string> = {\n good: \"var(--color-success)\",\n bad: \"var(--color-destructive)\",\n warn: \"var(--color-warning)\",\n neutral: \"var(--color-muted-foreground)\",\n}\n\n/**\n * A measure over time: the line in the foreground, the range it is judged\n * against shaded in primary beneath it, and the periods that stand out ringed\n * in their tone. A reference — an alert level, a budget — is a dashed rule,\n * and every point over it is ringed as a breach; a missing point breaks the\n * line. The first series is the line; any others are drawn behind it to read\n * it against, each named at its right end. A period is named by its label.\n */\nexport function TimeseriesBlock({ spec }: BlockProps<\"timeseries\">) {\n const series = spec.series[0]\n if (!series) return null\n const labels = series.points.map(([at]) => at)\n const values = series.points.map(([, value]) => value)\n const at = (label: string | undefined) => (label == null ? -1 : labels.indexOf(label))\n const forecastFrom = at(spec.forecastFrom)\n // Above the reference: a breach, ringed in the bad tone.\n const breaches = spec.reference\n ? values.flatMap((value, index) => (value != null && value > spec.reference!.value ? [{ index, color: RING_COLOR.bad }] : []))\n : []\n const format = (value: number) => {\n const n = figureText(Math.round(value * 10) / 10)\n return spec.unit ? `${n} ${spec.unit}` : n\n }\n return (\n <LineChart\n aria-label={series.name}\n values={values}\n name={series.name}\n compare={spec.series.slice(1).map((other) => ({\n name: other.name,\n // Aligned on the first series' periods: a period it lacks is a gap.\n values: labels.map((label) => other.points.find(([at]) => at === label)?.[1] ?? null),\n }))}\n labels={labels}\n format={format}\n zero={false}\n color=\"var(--color-foreground)\"\n band={spec.band && { ...spec.band, color: \"var(--color-primary)\" }}\n reference={spec.reference}\n highlights={[...(spec.marks ?? []).map((mark) => ({ index: at(mark.at), color: RING_COLOR[mark.tone ?? \"neutral\"] })), ...breaches]\n .filter((mark) => mark.index >= 0)}\n forecastFrom={forecastFrom >= 0 ? forecastFrom : undefined}\n forecastLabel={spec.forecastLabel}\n />\n )\n}\n","import * as React from \"react\"\nimport { TraceList, TraceStep } from \"@invana/ui\"\nimport type { BlockProps } from \"../types\"\n\nimport { ChatSessionDisclosure } from \"@invana/ui\"\nimport { ActionRow } from \"../parts/actions\"\n\n/**\n * What the answer is doing, step by step, while it runs — and the record of it\n * after, folded to one line. A failed step says why under it, with what can be\n * done about it; a step held on the analyst waits hollow, in the info tone.\n */\nexport function TraceBlock({ spec, onAction }: BlockProps<\"trace\">) {\n const [open, setOpen] = React.useState(!spec.folded)\n const list = (\n <TraceList variant=\"progress\">\n {spec.steps.map((step, i) => (\n <TraceStep\n key={step.id ?? i}\n name={step.label}\n duration={step.detail}\n status={step.state}\n error={step.error}\n />\n ))}\n </TraceList>\n )\n const actions = spec.actions?.length ? (\n <ActionRow actions={spec.actions} onAction={(id) => onAction?.(\"action\", id)} />\n ) : null\n if (!spec.folded) {\n return (\n <>\n {list}\n {actions}\n </>\n )\n }\n return (\n <ChatSessionDisclosure\n variant=\"inline\"\n label={`${spec.steps.length} steps`}\n meta={spec.summary}\n open={open}\n onOpenChange={setOpen}\n >\n {list}\n </ChatSessionDisclosure>\n )\n}\n","import type * as React from \"react\"\n\nimport { ActivityBlock } from \"./blocks/activity\"\nimport { BarsBlock } from \"./blocks/bars\"\nimport { CannotBlock } from \"./blocks/cannot\"\nimport { CaveatBlock } from \"./blocks/caveat\"\nimport { CitationsBlock } from \"./blocks/citations\"\nimport { ConfirmAsk } from \"./blocks/confirm\"\nimport { FilesBlock } from \"./blocks/files\"\nimport { FormAsk } from \"./blocks/form\"\nimport { GanttBlock } from \"./blocks/gantt\"\nimport { GridBlock } from \"./blocks/grid\"\nimport { HeatStripBlock } from \"./blocks/heatstrip\"\nimport { MethodBlock } from \"./blocks/method\"\nimport { MetricBlock } from \"./blocks/metric\"\nimport { MultiAsk } from \"./blocks/multi\"\nimport { MultistepAsk } from \"./blocks/multistep\"\nimport { NarrativeBlock } from \"./blocks/narrative\"\nimport { ProposalBlock } from \"./blocks/proposal\"\nimport { QuickAsk } from \"./blocks/quick\"\nimport { RankedBlock } from \"./blocks/ranked\"\nimport { RecordBlock } from \"./blocks/record\"\nimport { ScopeBlock } from \"./blocks/scope\"\nimport { SingleAsk } from \"./blocks/single\"\nimport { SuggestionsAsk } from \"./blocks/suggestions\"\nimport { TableBlock } from \"./blocks/table\"\nimport { TimelineBlock } from \"./blocks/timeline\"\nimport { TimeseriesBlock } from \"./blocks/timeseries\"\nimport { TraceBlock } from \"./blocks/trace\"\nimport type { BlockKind, BlockProps } from \"./types\"\n\n/** What draws each kind; `null` is a kind with no renderer yet, drawn as a labelled placeholder. */\nexport type BlockRenderers = { [K in BlockKind]: React.ComponentType<BlockProps<K>> | null }\n\n/** Keyed by every kind, so a kind added to the list and not here does not compile. */\nexport const BLOCK_RENDERERS: BlockRenderers = {\n confirm: ConfirmAsk,\n single: SingleAsk,\n multi: MultiAsk,\n quick: QuickAsk,\n period: null,\n number: null,\n short: null,\n long: null,\n entity: null,\n scale: null,\n multistep: MultistepAsk,\n form: FormAsk,\n weights: null,\n approval: null,\n interpretation: null,\n fork: null,\n plan: null,\n modelspec: null,\n hypothesis: null,\n range: null,\n suggestions: SuggestionsAsk,\n narrative: NarrativeBlock,\n metric: MetricBlock,\n grid: GridBlock,\n table: TableBlock,\n attr: null,\n record: RecordBlock,\n ranked: RankedBlock,\n timeseries: TimeseriesBlock,\n bars: BarsBlock,\n waterfall: null,\n matrix: null,\n funnel: null,\n histogram: null,\n timeline: TimelineBlock,\n subgraph: null,\n method: MethodBlock,\n citations: CitationsBlock,\n files: FilesBlock,\n proposal: ProposalBlock,\n cannot: CannotBlock,\n caveat: CaveatBlock,\n scope: ScopeBlock,\n checks: null,\n trace: TraceBlock,\n activity: ActivityBlock,\n gantt: GanttBlock,\n heatstrip: HeatStripBlock,\n test: null,\n coef: null,\n forest: null,\n scatter: null,\n box: null,\n correlation: null,\n control: null,\n pareto: null,\n survival: null,\n tornado: null,\n decomposition: null,\n modeleval: null,\n pivot: null,\n profile: null,\n evidence: null,\n dumbbell: null,\n quantiles: null,\n}\n","/**\n * Where in a spec a patch lands, from its root: a name reads a field of an\n * object; on a list, a name is the item whose `key` (or `id`) it is, and a\n * number is an index. `[\"tasks\", \"plan\", \"subtasks\"]` is the subtasks of the\n * task keyed `plan`. Empty, it is the spec itself.\n */\nexport type PatchPath = (string | number)[]\n\n/**\n * How a block changes while it streams — the same four ways for every kind,\n * so a conversation, a board or a page streams any block alike. The API sends\n * these; {@link applyBlockPatch} returns a new spec and never mutates the old.\n *\n * A merge (`set`, `upsert`) is a JSON merge patch one level deep: a field sent\n * as `null` is removed — the *now* line dropped as a run ends — since JSON\n * cannot send `undefined`.\n */\nexport type BlockPatch =\n /** Merge `fields` into the object at `at` — the clock moving, a run settling. */\n | { op: \"set\"; at?: PatchPath; fields: Record<string, unknown> }\n /** Add `text` to the end of the string at `at` — a narrative's words. */\n | { op: \"append\"; at: PatchPath; text: string }\n /** Add `items` to the end of the list at `at` — a chart's points, a table's rows. */\n | { op: \"push\"; at: PatchPath; items: unknown[] }\n /**\n * Merge `item` into the list item at `at` with the same `key` (or `id`), or\n * add it at the end — a task starting, then settling.\n */\n | { op: \"upsert\"; at: PatchPath; item: Record<string, unknown> }\n\nexport type BlockPatchOp = BlockPatch[\"op\"]\n\nexport class BlockPatchError extends Error {}\n\ntype Obj = Record<string, unknown>\n\nconst isObj = (v: unknown): v is Obj => typeof v === \"object\" && v !== null && !Array.isArray(v)\n\n/** `fields` merged over `target`; a field sent as `null` is removed. */\nfunction merge(target: Obj, fields: Obj): Obj {\n const next = { ...target, ...fields }\n for (const [name, value] of Object.entries(fields)) if (value === null) delete next[name]\n return next\n}\n\n/** An item's identity on a list: its `key`, else its `id`. */\nconst identity = (item: unknown) => (isObj(item) ? (item.key ?? item.id) : undefined)\n\nconst where = (path: PatchPath, depth: number) => JSON.stringify(path.slice(0, depth))\n\n/** The index `segment` names on `list` — by position, or by key. */\nfunction indexOn(list: unknown[], segment: string | number, path: PatchPath, depth: number) {\n const at = typeof segment === \"number\" ? segment : list.findIndex((item) => identity(item) === segment)\n if (at < 0 || at >= list.length) throw new BlockPatchError(`No item ${JSON.stringify(segment)} at ${where(path, depth)}.`)\n return at\n}\n\n/**\n * `node` with the value at `path[depth..]` replaced by `fn(value)`, copying\n * only along the path. A missing field reads as `undefined`, so `fn` can\n * create it — a first `push` makes the list.\n */\nfunction update(node: unknown, path: PatchPath, depth: number, fn: (value: unknown) => unknown): unknown {\n if (depth === path.length) return fn(node)\n const segment = path[depth]\n if (Array.isArray(node)) {\n const at = indexOn(node, segment, path, depth)\n const next = node.slice()\n next[at] = update(node[at], path, depth + 1, fn)\n return next\n }\n if (isObj(node) && typeof segment === \"string\") {\n return { ...node, [segment]: update(node[segment], path, depth + 1, fn) }\n }\n throw new BlockPatchError(`Nothing to read ${JSON.stringify(segment)} from at ${where(path, depth)}.`)\n}\n\nfunction patchValue(value: unknown, patch: BlockPatch): unknown {\n const at = JSON.stringify(patch.at ?? [])\n switch (patch.op) {\n case \"set\":\n if (!isObj(value)) throw new BlockPatchError(`\"set\": ${at} is not an object.`)\n return merge(value, patch.fields)\n case \"append\":\n if (value !== undefined && typeof value !== \"string\") throw new BlockPatchError(`\"append\": ${at} is not text.`)\n return (value ?? \"\") + patch.text\n case \"push\":\n if (value !== undefined && !Array.isArray(value)) throw new BlockPatchError(`\"push\": ${at} is not a list.`)\n return [...((value as unknown[]) ?? []), ...patch.items]\n case \"upsert\": {\n if (value !== undefined && !Array.isArray(value)) throw new BlockPatchError(`\"upsert\": ${at} is not a list.`)\n const id = identity(patch.item)\n if (id === undefined) throw new BlockPatchError(`\"upsert\": the item at ${at} has no key or id.`)\n const list = (value as unknown[]) ?? []\n const found = list.findIndex((item) => identity(item) === id)\n if (found < 0) return [...list, merge({}, patch.item)]\n return list.map((item, i) => (i === found ? merge(item as Obj, patch.item) : item))\n }\n }\n}\n\n/**\n * A block's spec after one patch. Any spec — a block's options, or a block\n * spec with its `kind`, which no patch can change.\n */\nexport function applyBlockPatch<S extends object>(spec: S, patch: BlockPatch): S {\n const next = update(spec, patch.at ?? [], 0, (value) => patchValue(value, patch)) as S\n return \"kind\" in spec ? ({ ...next, kind: (spec as Obj).kind } as S) : next\n}\n\n/** Apply patches in order — a recorded stream, replayed. */\nexport function applyBlockPatches<S extends object>(spec: S, patches: BlockPatch[]): S {\n return patches.reduce<S>(applyBlockPatch, spec)\n}\n","import type { BlockPatch } from \"./patch\"\n\n/**\n * A spec arrives once, then as patches. These are the ways the patches can\n * arrive — one at a time or in batches, from a fetch body, an EventSource, a\n * generator, or a recorded script — read the same way by every shell that\n * streams: a block (`useBlockStream`), a conversation, a board. `P` is the\n * shell's patch; a block's is {@link BlockPatch}.\n */\nexport type PatchChunk<P = BlockPatch> = P | P[]\nexport type PatchSource<P = BlockPatch> = AsyncIterable<PatchChunk<P>> | Iterable<PatchChunk<P>>\n\nconst toArray = <P>(chunk: PatchChunk<P>) => (Array.isArray(chunk) ? chunk : [chunk])\n\n/** Every patch of a source, in the batches they arrived in. */\nexport async function* patchesOf<P = BlockPatch>(source: PatchSource<P>): AsyncGenerator<P[]> {\n for await (const chunk of source as AsyncIterable<PatchChunk<P>>) yield toArray(chunk)\n}\n\n// ── wire adapters ───────────────────────────────────────────────────────────\n\n/**\n * Patches from a newline-delimited JSON body: one patch, or an array of them,\n * per line. Pass the `Response` of a streaming `fetch`, or its body.\n */\nexport async function* fromNdjson<P = BlockPatch>(\n input: Response | ReadableStream<Uint8Array>,\n): AsyncGenerator<PatchChunk<P>> {\n const body = input instanceof Response ? input.body : input\n if (!body) return\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffered = \"\"\n try {\n for (;;) {\n const { value, done } = await reader.read()\n buffered += decoder.decode(value, { stream: !done })\n let newline = buffered.indexOf(\"\\n\")\n while (newline >= 0) {\n const line = buffered.slice(0, newline).trim()\n buffered = buffered.slice(newline + 1)\n if (line) yield JSON.parse(line) as PatchChunk<P>\n newline = buffered.indexOf(\"\\n\")\n }\n if (done) break\n }\n const rest = buffered.trim()\n if (rest) yield JSON.parse(rest) as PatchChunk<P>\n } finally {\n reader.releaseLock()\n }\n}\n\nexport interface EventSourceOptions {\n /** The event whose data is a patch. @default \"message\" */\n event?: string\n /** The event that ends the stream. @default \"done\" */\n done?: string\n /** Close the EventSource when the stream ends. @default true */\n close?: boolean\n}\n\n/** Patches from Server-Sent Events: each event's `data` is a patch, or an array of them. */\nexport async function* fromEventSource<P = BlockPatch>(\n source: EventSource,\n { event = \"message\", done = \"done\", close = true }: EventSourceOptions = {},\n): AsyncGenerator<PatchChunk<P>> {\n const queue: PatchChunk<P>[] = []\n let finished = false\n let failure: unknown\n let wake: (() => void) | undefined\n const notify = () => {\n wake?.()\n wake = undefined\n }\n const onData = (e: MessageEvent) => {\n try {\n queue.push(JSON.parse(e.data as string) as PatchChunk<P>)\n } catch (error) {\n failure = error\n }\n notify()\n }\n const onDone = () => {\n finished = true\n notify()\n }\n const onError = () => {\n // EventSource reconnects on its own while CONNECTING; CLOSED is the end.\n if (source.readyState === EventSource.CLOSED) onDone()\n }\n source.addEventListener(event, onData as EventListener)\n source.addEventListener(done, onDone)\n source.addEventListener(\"error\", onError)\n try {\n for (;;) {\n if (failure) throw failure\n const next = queue.shift()\n if (next) {\n yield next\n continue\n }\n if (finished) return\n await new Promise<void>((resolve) => (wake = resolve))\n }\n } finally {\n source.removeEventListener(event, onData as EventListener)\n source.removeEventListener(done, onDone)\n source.removeEventListener(\"error\", onError)\n if (close) source.close()\n }\n}\n\n// ── recorded scripts ────────────────────────────────────────────────────────\n\n/** A patch and when it lands, in ms from the start of the script. */\nexport interface ScriptStep<P = BlockPatch> {\n at: number\n patch: PatchChunk<P>\n}\n\n/** A recorded stream: plain JSON, replayed by {@link playScript} or step by step with {@link scriptFrames}. */\nexport type PatchScript<P = BlockPatch> = ScriptStep<P>[]\n\nexport interface PlayOptions {\n /** 2 plays twice as fast. @default 1 */\n speed?: number\n signal?: AbortSignal\n}\n\nfunction sleep(ms: number, signal?: AbortSignal) {\n return new Promise<void>((resolve) => {\n if (signal?.aborted || ms <= 0) return resolve()\n const timer = setTimeout(done, ms)\n function done() {\n clearTimeout(timer)\n signal?.removeEventListener(\"abort\", done)\n resolve()\n }\n signal?.addEventListener(\"abort\", done, { once: true })\n })\n}\n\n/**\n * A script's patches, batched by when they land: one batch per moment, in\n * order — what {@link playScript} yields, without the waiting.\n */\nexport function scriptFrames<P>(script: PatchScript<P>): { at: number; patches: P[] }[] {\n const frames: { at: number; patches: P[] }[] = []\n for (const step of [...script].sort((a, b) => a.at - b.at)) {\n const last = frames[frames.length - 1]\n if (last?.at === step.at) last.patches.push(...toArray(step.patch))\n else frames.push({ at: step.at, patches: toArray(step.patch) })\n }\n return frames\n}\n\n/**\n * A script as a stream: each step is yielded when it is due. Steps due at the\n * same moment are yielded together; aborting ends the stream where it stands.\n */\nexport async function* playScript<P>(\n script: PatchScript<P>,\n { speed = 1, signal }: PlayOptions = {},\n): AsyncGenerator<P[]> {\n let clock = 0\n for (const frame of scriptFrames(script)) {\n if (signal?.aborted) return\n await sleep((frame.at - clock) / speed, signal)\n if (signal?.aborted) return\n clock = frame.at\n yield frame.patches\n }\n}\n\n/** Shift every step of a script by `ms` — to chain scripts one after another. */\nexport const offsetScript = <P>(script: PatchScript<P>, ms: number): PatchScript<P> =>\n script.map((s) => ({ ...s, at: s.at + ms }))\n\n/** When a script's last step lands. */\nexport const scriptLength = <P>(script: PatchScript<P>) => script.reduce((m, s) => Math.max(m, s.at), 0)\n","import * as React from \"react\"\n\nimport { applyBlockPatches, type BlockPatch } from \"./patch\"\nimport { patchesOf, type PatchSource } from \"./source\"\n\n/**\n * Patches to apply as they arrive — a streaming fetch (`fromNdjson`), an\n * EventSource (`fromEventSource`), a generator, or a recorded script\n * (`playScript`). Pass a function, `(signal) => source`, to open the source\n * afresh each time the shell mounts — a generator can be read only once. Keep\n * it stable (module scope, `useCallback`): a new one starts a new stream.\n */\nexport type SpecStream<P = BlockPatch> = PatchSource<P> | ((signal: AbortSignal) => PatchSource<P>) | null\n\nexport interface StreamOptions<S, P> {\n /** The stream ended; the spec as it left it. */\n onEnd?: (spec: S) => void\n /** A patch did not apply, or the source failed. The stream stops there. */\n onError?: (error: unknown) => void\n /** What stopping records — the patches that mark what was running as stopped. */\n stopPatches?: (spec: S) => P[]\n}\n\n/**\n * The spec as drawn: the one given, with `stream`'s patches applied by `apply`\n * as they arrive. A new spec starts over from it; `stop()` ends the stream and\n * records how far it got. Every shell that streams — a block, a conversation,\n * a board — reads its stream through this, with its own patch.\n */\nexport function useStreamedSpec<S, P>(\n spec: S,\n stream: SpecStream<P> | undefined,\n apply: (spec: S, patches: P[]) => S,\n { onEnd, onError, stopPatches }: StreamOptions<S, P> = {},\n) {\n const [base, setBase] = React.useState(spec)\n const [live, setLive] = React.useState(spec)\n // A new spec starts over from it, in the same render. With nothing\n // streaming the spec is drawn as given, and nothing is held.\n if (stream && base !== spec) {\n setBase(spec)\n setLive(spec)\n }\n const current = React.useRef(spec)\n const abort = React.useRef<AbortController | null>(null)\n const latest = React.useRef({ apply, onEnd, onError, stopPatches })\n React.useLayoutEffect(() => {\n latest.current = { apply, onEnd, onError, stopPatches }\n current.current = live\n })\n\n const set = React.useCallback((next: S) => {\n current.current = next\n setLive(next)\n }, [])\n\n React.useEffect(() => {\n if (!stream) return\n const controller = new AbortController()\n abort.current = controller\n void (async () => {\n try {\n const source = typeof stream === \"function\" ? stream(controller.signal) : stream\n for await (const batch of patchesOf(source)) {\n if (controller.signal.aborted) return\n set(latest.current.apply(current.current, batch))\n }\n if (!controller.signal.aborted) latest.current.onEnd?.(current.current)\n } catch (error) {\n if (!controller.signal.aborted) latest.current.onError?.(error)\n } finally {\n if (abort.current === controller) abort.current = null\n }\n })()\n return () => controller.abort()\n }, [stream, set])\n\n const stop = React.useCallback(() => {\n if (!abort.current) return\n abort.current.abort()\n abort.current = null\n const { apply, stopPatches } = latest.current\n if (stopPatches) set(apply(current.current, stopPatches(current.current)))\n }, [set])\n\n return { live: stream ? live : spec, stop }\n}\n\n/**\n * One block's spec, streamed: `spec` with `stream`'s {@link BlockPatch}es\n * applied as they arrive. `<Block stream>` reads it; a shell that draws a\n * block directly calls it.\n *\n * ```tsx\n * const { live } = useBlockStream(spec, (signal) => fromNdjson(await fetch(url, { signal })))\n * <GanttBlock spec={live} />\n * ```\n */\nexport function useBlockStream<S extends object>(\n spec: S,\n stream: SpecStream<BlockPatch> | undefined,\n options?: Omit<StreamOptions<S, BlockPatch>, \"stopPatches\">,\n) {\n return useStreamedSpec<S, BlockPatch>(spec, stream, applyBlockPatches, options)\n}\n","import type * as React from \"react\"\n\nimport { Placeholder } from \"./placeholder\"\nimport { BLOCK_RENDERERS } from \"./registry\"\nimport { type BlockPatch, type SpecStream, useBlockStream } from \"./stream\"\nimport type { AskState, BlockKind, BlockProps, BlockSpec } from \"./types\"\n\nexport interface BlockComponentProps {\n spec: BlockSpec\n onAction?: (action: string, value?: unknown) => void\n /** Where a block that returns a value stands. Unset, it is open. */\n state?: AskState\n /** The value given, once answered. */\n value?: unknown\n id?: string\n /**\n * Set into running text: the outer cells of a table sit flush with the words\n * around it. The assistant sets it; a board panel or a page section does not,\n * so its tables keep their padding. Only the table block reads it.\n */\n seamless?: boolean\n /**\n * Patches to `spec` as they arrive — the block draws `spec` with them\n * applied, and a new `spec` starts over from it. See `useBlockStream`.\n */\n stream?: SpecStream<BlockPatch>\n /** The stream ended; the spec as it left it. */\n onStreamEnd?: (spec: BlockSpec) => void\n /** A patch did not apply, or the source failed. The stream stops there. */\n onStreamError?: (error: unknown) => void\n}\n\n/**\n * One block, drawn bare from its spec: no card, no title. The shell around it\n * — an answer card, a question card, a `PanelBox`, a page section — adds the\n * frame. A kind with no renderer yet is a labelled placeholder with its JSON.\n */\nexport function Block({ spec, stream, onStreamEnd, onStreamError, ...props }: BlockComponentProps) {\n const { live } = useBlockStream(spec, stream, { onEnd: onStreamEnd, onError: onStreamError })\n const Renderer = BLOCK_RENDERERS[live.kind] as React.ComponentType<BlockProps<BlockKind>> | null\n if (!Renderer) return <Placeholder kind={live.kind} options={live} />\n return <Renderer spec={live} {...props} />\n}\n","import * as React from \"react\"\nimport { cn, SectionHeader, TypographyH3, TypographyMuted } from \"@invana/ui\"\n\nimport { Block } from \"./block\"\nimport type { BlockSpec } from \"./types\"\n\nexport interface PageSection {\n title?: string\n description?: string\n blocks: BlockSpec[]\n}\n\n/** A page as JSON: a report, or a long answer opened in full. */\nexport interface PageSpec {\n title?: string\n description?: string\n sections: PageSection[]\n}\n\nexport interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, \"children\"> {\n spec: PageSpec\n /**\n * A block's action, with where the block sits and what it carries — `open` on\n * a table in section 1, `select` with the row's key as `value`.\n */\n onAction?: (action: string, at: { section: number; block: number; value?: unknown }) => void\n}\n\n/**\n * Blocks laid out as a document: sections top to bottom, each block bare, no\n * cards and no borders. A section's title is its rule; a page's title is its\n * heading. The same specs a conversation turn or a board panel draws.\n */\nexport const Page = React.forwardRef<HTMLElement, PageProps>(({ spec, onAction, className, ...props }, ref) => (\n <article ref={ref} className={cn(\"flex min-w-0 flex-col gap-6\", className)} {...props}>\n {spec.title || spec.description ? (\n <header className=\"flex flex-col gap-1\">\n {spec.title ? <TypographyH3>{spec.title}</TypographyH3> : null}\n {spec.description ? <TypographyMuted>{spec.description}</TypographyMuted> : null}\n </header>\n ) : null}\n {spec.sections.map((section, s) => (\n <section key={s} className=\"flex min-w-0 flex-col gap-3\">\n {section.title ? <SectionHeader title={section.title} /> : null}\n {section.description ? <TypographyMuted>{section.description}</TypographyMuted> : null}\n {section.blocks.map((block, b) => (\n <Block\n key={b}\n spec={block}\n onAction={\n onAction\n ? (action, value) =>\n onAction(action, value === undefined ? { section: s, block: b } : { section: s, block: b, value })\n : undefined\n }\n />\n ))}\n </section>\n ))}\n </article>\n))\nPage.displayName = \"Page\"\n"]}