Assessment now reads verdict -> checks -> evidence -> reasoning. AI Reasoning
moved below the PO/GR/contract records it narrates, so it lands as the
conclusion rather than the preamble. Each part is a SubBlock: small-caps title,
optional badge, hairline above, no nested cards. Evidence rows get an aligned
label column and a red wash on the discrepancy row.
Activity gains a run summary (decisions, wall time, tokens, cost, model),
numbered decisions on a connected timeline, and honest confidence: the figure
the model acted on, colour-banded, annotated when the self-check revised it,
plus a chip when reflexion asked to escalate. Plan/reasoning/self-check sit
behind accent rules, knowledge sources render as chips, and the trace
waterfall carries per-step tokens, indents child spans and reddens failures.
Total run time sums only top-level spans; nested ones would double-count.
Ports the data that arrived with the merge into the rebuilt detail view, so
nothing the API returns is left unrendered and there is one visual language.
- SourceDocument: invoice_pdf was write-only — uploaded, OCR'd, then shown
nowhere. Fetched as a Blob (the endpoint forces an attachment) and rendered
inline via an object URL, revoked on unmount
- AuditTrail: the history as a timeline — actor AI-vs-human, resulting state,
per-activity headline and how long each hop waited
- AiActivity: decisions with status/confidence/model, the model's plan,
reasoning and self-check, escalations, and a per-run trace waterfall with
durations, tokens and cost
- adopts lib/matchSummary for both free-text AI fields: it parses entity
labels our inline version dropped ("PO-3001:", "GR:"), treats
PARTIAL/MISSING as warnings and "Payments: NONE" as neutral, and turns
analysis_so_far into evidence rows instead of a paragraph
- drops the five pre-migration components these replace, plus the TONE_PILL /
TONE_DOT class maps they were the only users of — the last hardcoded
slate/zinc palette in the app. CSS 115.8 -> 98.1 kB
STATE_META stays: keying display metadata off state UUIDs beats matching
served names, and folding it into lib/workflow.ts is the next step.
AppShell resolved in favour of the rebuilt shell. The incoming hunk routed
workflow instances to InvoiceDetail, whose components predate the Tailwind v4
token migration and are written in hardcoded slate/zinc with a second dark
palette, so adopting them wholesale would have put two visual languages on
one page.
Their data layer lands intact and unrendered for now: the monitor/audit/file
endpoints in viewService, useInstanceDetail, lib/matchSummary and
lib/workflowMeta. Next step is to port that logic into the rebuilt UI —
source-document viewer, audit trail, AI decision/trace panels and the
structured analysis_so_far evidence are all data we do not surface yet.
Migrates Tailwind v3 -> v4 (CSS-first, theme tokens for brand, workflow
states and charts) and adds 23 shadcn/ui components on Radix.
- lib/workflow.ts is now the single source of truth for state name, colour,
icon and available actions; "Financial Review" is the canonical served
name, with "Finance Review" kept as an alias so those rows stop falling
through to the unstyled fallback and dropping out of every count
- record view: TanStack Table with server-side sort/paginate, company column
with initials avatar, page totals, density and a URL-synced query state
- dashboard: one cached analytics fetch shared by tiles and charts, donut +
aging + vendor spend, click-to-filter
- detail view: rebuilt against the live detailview payload — restores the PO
number and payment terms that the old key heuristics silently dropped,
parses match_summary into a 3-way-match checklist, and separates the
department's and reviewer's own words from AI-generated content
- form modal on Radix Dialog (focus trap, scroll lock, escape handling)
The detail page rendered a flat grid of every field the view returned — 29 for
Invoice Detail, 21 for Finance Review Detail — so a reviewer's actual decision
inputs sat among twenty peers of equal weight, and the most valuable data in the
app wasn't shown at all. InvoiceDetail now orders the page by the decision being
made: identity+status, AI recommendation, 3-way match, clarification exchange,
source document, AI reasoning trail, history, then the original grid collapsed.
AIActivityPanel ports the studio builder's AI Employee -> Logs tab into the app,
narrowed to one instance: decisions with status/confidence/model/reasoning/
reflexion, escalations, and a per-run trace waterfall with durations, tokens and
cost. Same event vocabulary and confidence thresholds as the builder, so a client
never has to be shown the builder to see what the AI did. The endpoints
(/monitor/instances/{id}/log and /trace) are publicly routed and accept the app's
own JWT.
AuditTimeline finally uses getAuditLog, which had been written and never called
from anywhere. It renders the trail as a story — who acted, AI or human, what
state resulted, and how long each hop waited — deduping the extra rows the
trigger's performActivity commit produces (9 raw entries collapse to 4 on
instance 128).
ThreeWayMatchCard surfaces match_summary and analysis_so_far. Both were
effectively invisible: one buried in the field grid, the other explicitly dropped
by DetailViewPanel's SKIP_KEYS for looking like raw JSON. analysis_so_far is
actually the AI's gathered evidence — PO, goods receipt, contract, payment
history and the specific discrepancy — so the recommendation becomes auditable
instead of a wall of prose.
InvoiceDocumentCard makes the uploaded PDF viewable. invoice_pdf appeared in zero
record views and zero detail views, so the department answering a clarification
and the reviewer approving payment could not open the document they were
reasoning about. The /download endpoint forces an attachment, so the bytes are
fetched as a Blob and shown inline via an object URL.
Display metadata keys off state and activity UUIDs rather than the names the API
returns, so nothing depends on matching "Financial Review" as a string.
Verified against live app 169: instance 128 (3 decisions, 3 traces correctly
linked, full match evidence, clarification Q&A) and 161 (OCR submission, PDF
resolves and downloads, AI panels show empty states rather than errors).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The "Create New Invoice" button was configured all along, on the rv_screen
layout rather than the screen layout, and was being dropped twice over:
RecordViewTable fetched the rv_screen but kept only rv_template_uid and
threw away `layout`, and ScreenRenderer matched only the legacy
params.activity_id_init while current studio writes activity_uid_init.
collectStartButtons deep-walks either shape — the button nested under a
node's `config` as screen layouts do, or carrying type/params/job_template
at its own top level as rv_screens do — and accepts activity_uid_init,
activity_id_init, activity_uid and activity_id, newest key first.
RecordViewTable renders any start_state_machine buttons from its rv_screen
in the toolbar alongside the injected toolbarAction; ScreenRenderer routes
through the same helper and now skips buttons with no resolvable activity
instead of rendering a dead control.
Verified against app 169's live rv_screen config: yields exactly one button,
"Create New Invoice" -> Submit Invoice, ignoring the show_detailview_popup
entry.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>