Introducing a new way to review your PRs.

Read the announcement

zipstack / unstract

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

View on GitHub

28 documents · Updated Nov 23, 2026

docs / frontend-v1-foundation

Frontend v1 interface foundation

The v1 frontend is an isolated TypeScript foundation for a new browser interface that grows beside the existing application. It defines its own visual language, shared controls, chart and document utilities, query and service seams, session boundary, plugin boundary, and migration rules while selected pages move from v0 to v1. See Frontend application for the current application runtime and Frontend UI architecture for the existing feature and route model.

Foundation role

The foundation gives future v1 pages a small, controlled environment inside the current frontend. It makes v1 work predictable while v0 remains the fallback for routes that are not live in v1.

Isolated product boundary

The v1 area is a parallel product surface, not a partial rewrite of the current source tree. Its public entry is the only allowed v0-to-v1 import. That entry exposes the version switch and small routing and session helpers. The v1 application tree loads only when a live v1 page renders. This keeps migration work explicit and prevents a new page from silently depending on v0 components, stores, helpers, CSS, or shims (frontend/…/index.ts• L1-24, frontend/…/VersionSwitch.tsx• L22-30, frontend/…/README.md• L15-23).

The boundary is also a choice of language and ownership. V1 uses strict TypeScript and its own import aliases. V0 can continue to run while v1 builds a separate set of pages and shared controls (frontend/…/README.md• L9-23, frontend/…/README.md• L215-235).

References: frontend/…/index.ts• L1-24 frontend/…/VersionSwitch.tsx• L22-30 frontend/…/README.md• L9-23 frontend/…/README.md• L215-235

Foundation layers

The v1 layout separates product work by responsibility. Pages consume the shell and shared UI parts. Patterns combine those parts into larger flows. Hooks and stores provide shared state. Services provide typed access to remote data. Pure helpers keep policy out of the view layer (frontend/…/README.md• L215-235).

The application seam sits above these layers. The route registry decides which page version owns a URL. V1App supplies the v1 providers, one query cache, one session gate per page, one plugin provider, one notification host, and the v1 routes. The page map lazy-loads each declared page. The public foundation also exposes a plugin registry that can add optional slot content and routes for a build distribution (frontend/…/V1App.tsx• L11-57, frontend/…/pages.ts• L1-21, frontend/…/index.ts• L44-87).

References: frontend/…/README.md• L215-235 frontend/…/V1App.tsx• L11-57 frontend/…/pages.ts• L1-21 frontend/…/index.ts• L44-87

Theme and token model

The theme system gives the v1 interface a stable visual contract across light, dark, and Unstract-branded presentation. Theme choice is user state. Tokens provide the values that controls, pages, code views, diffs, and charts use.

Theme modes

V1 supports three rendered modes: light, dark, and unstract. A system preference follows the operating system and resolves to light or dark. The preference uses a v1-specific browser key, so it does not read or overwrite v0 theme state (frontend/…/theme.ts• L1-21, frontend/…/theme.ts• L11-20).

The theme provider hydrates the saved preference before the interface paints. It watches the operating system when the user selects system and places the resolved mode on each v1 root. Portal content receives the same mode, so dialogs, menus, and toasts do not drift from the page that opened them (frontend/…/ThemeProvider.tsx• L13-49, frontend/…/portal.ts• L13-40).

References: frontend/…/theme.ts• L1-21 frontend/…/theme.ts• L32-69 frontend/…/theme.ts• L28-85 frontend/…/ThemeProvider.tsx• L13-49 frontend/…/portal.ts• L13-40

Design tokens

Design tokens are named values for color, spacing, radius, type, elevation, focus, font, syntax, diff, and chart presentation. Each theme-aware token has a value for all three modes. Shared values are declared once. This keeps a control's visual meaning stable when its palette changes (frontend/…/tokens.json• L1-21, frontend/…/tokens.json• L286-431).

The token source produces CSS variables and a readable token table. Generated CSS scopes each mode to .v1[data-theme] and sets the browser color-scheme, so native controls follow the selected mode. Code, diff, and chart views use dedicated token families instead of local colors. Changes belong in tokens.json and must flow through the generator rather than being hand-written in the generated CSS (frontend/…/tokens.ts• L5-15, frontend/…/tokens.css• L1-5, frontend/…/tokens.test.ts• L119-130).

References: frontend/…/tokens.json• L1-21 frontend/…/tokens.json• L286-431 frontend/…/tokens.ts• L5-15 frontend/…/tokens.css• L1-5 frontend/…/tokens.test.ts• L119-130

Shared UI constraints

The shared UI contract keeps v1 visually isolated and makes its controls safe to place beside v0. The rules favor token-backed utilities and shared behavior over page-specific CSS or direct reuse of the old component system.

Scoped styling contract

Every v1 utility uses the ui: prefix and every v1 selector stays under .v1. This prevents v1 utilities from picking up v0's theme and prevents v1 CSS from changing the rest of the document. V1 does not use antd, component style files, raw colors, raw pixel values, !important, or CSS media queries for color mode (frontend/…/README.md• L27-76, frontend/…/index.css• L1-29).

The styling policy leaves visual decisions in the token scale. Runtime geometry may pass only CSS custom properties that a token-backed utility reads. Focus uses one shared ring utility. Mono text is reserved for model output, JSON, and token counts (frontend/…/README.md• L46-76, frontend/…/index.css• L31-151).

References: frontend/…/README.md• L27-76 frontend/…/index.css• L1-29 frontend/…/index.css• L31-151 frontend/…/check-v1-styles.mjs• L3-29

Shared interaction seams

V1 centralizes class merging, ref forwarding, and overlay placement so shared controls keep the same token and theme rules. cn resolves competing v1 utility classes. mergeRefs lets a component keep its own DOM ref while forwarding the caller's ref. getPortalContainer creates one v1-owned body child for overlays and keeps that child in the active theme (frontend/…/merge-refs.ts• L16-39, frontend/…/portal.ts• L3-40).

Zustand stores hold cross-view state. Hooks hold reusable behavior. Pure helpers hold rules that do not need a component. The theme and old-version stores can be created independently for isolated trees and tests (frontend/…/theme.ts• L23-32, frontend/…/theme.ts• L60-85, frontend/…/oldVersion.ts• L66-86).

References: frontend/…/merge-refs.ts• L16-39 frontend/…/portal.ts• L3-40 frontend/…/theme.ts• L23-32 frontend/…/theme.ts• L60-85 frontend/…/oldVersion.ts• L66-86

The button surface gives v1 one shared language for actions, icon-only actions, inline navigation, shortcut hints, and joined controls. Pages import these controls from one public index rather than styling their own buttons (frontend/…/README.md• L1-12, frontend/…/index.ts• L1-6).

Buttons use four fixed heights and shared variants. A loading button keeps focus while it ignores activation. An icon-only button must have an accessible name. Links mark external navigation and can pass their classes to a router link. Button groups preserve one group name and one joined shape (frontend/…/README.md• L14-70, frontend/…/Button.tsx• L39-77, frontend/…/IconButton.tsx• L29-45, frontend/…/Link.tsx• L26-65).

References: frontend/…/README.md• L1-12 frontend/…/README.md• L14-70 frontend/…/index.ts• L1-6 frontend/…/Button.tsx• L39-77 frontend/…/IconButton.tsx• L29-45 frontend/…/Link.tsx• L26-65 frontend/…/ButtonGroup.tsx• L4-21

Form controls

The form layer gives text controls one accessible contract. A Field supplies the label, control id, helper text, error text, and shared disabled or read-only state. Input, Textarea, PromptTextarea, SearchField, and SecretField use that context while keeping their own behavior (frontend/…/Field.tsx• L8-25, frontend/…/field-context.ts• L48-73, frontend/…/index.ts• L1-28).

Label and HelperText also expose shared text styles for controls that manage their own layout. Each Field represents one control. A control's own invalid, disabled, and read-only values override the enclosing field. Search fields clear on Escape before an overlay closes. Prompt fields submit on Enter and preserve Shift+Enter for a line break. Secret fields keep reveal and copy actions available without exposing the value by default (frontend/…/HelperText.tsx• L4-19, frontend/…/Label.tsx• L5-19, frontend/…/FieldFrame.tsx• L5-37, frontend/…/SearchField.tsx• L63-71, frontend/…/PromptTextarea.tsx• L110-127, frontend/…/SecretField.tsx• L55-60).

References: frontend/…/Field.tsx• L8-25 frontend/…/field-context.ts• L48-73 frontend/…/FieldFrame.tsx• L5-37 frontend/…/HelperText.tsx• L4-19 frontend/…/Label.tsx• L5-19 frontend/…/index.ts• L1-28 frontend/…/SearchField.tsx• L63-71 frontend/…/PromptTextarea.tsx• L110-127 frontend/…/SecretField.tsx• L55-60

The navigation layer gives v1 pages shared patterns for moving between views, revealing content, tracking setup stages, and moving through long lists. It includes tabs, breadcrumbs, accordions, collapsible regions, checklists, steppers, and pagination through one public navigation index (frontend/…/index.ts• L1-48).

These controls preserve the meaning of the user's position as well as its visual state. Tabs support bar and segmented presentations with keyboard movement. Breadcrumbs mark the current page. Accordions and collapsible regions expose their open state. Checklists and steppers share four states: done, in progress, not started, and failed. Pagination reports the current range, clamps pages after a count change, and keeps page-size changes aligned with the first visible row (frontend/…/Tabs.tsx• L10-27, frontend/…/Breadcrumb.tsx• L8-14, frontend/…/stepState.tsx• L5-25, frontend/…/Pagination.tsx• L33-55).

The navigation gallery covers each public variant and state. Markup snapshots and accessibility scans protect the shared contract, while behavior tests cover keyboard movement, disclosure, step selection, and page changes (frontend/…/navigation.gallery.tsx• L26-31, frontend/…/markup.test.tsx• L15-43, frontend/…/navigation.test.tsx• L47-102).

References: frontend/…/index.ts• L1-48 frontend/…/Tabs.tsx• L10-27 frontend/…/Breadcrumb.tsx• L8-14 frontend/…/stepState.tsx• L5-25 frontend/…/Pagination.tsx• L33-55 frontend/…/navigation.gallery.tsx• L26-31 frontend/…/markup.test.tsx• L15-43 frontend/…/navigation.test.tsx• L47-102

The menu layer is the one v1 surface for actions opened from a button, a table row, a right-click target, or a keyboard shortcut. It covers dropdown menus, row action menus, context menus, searchable menus, and the command palette through one public index (frontend/…/README.md• L1-18, frontend/…/index.ts• L1-72).

Menus use one row model for labels, icons, descriptions, shortcuts, loading state, disabled state, and destructive actions. Searchable menus filter local rows or accept server results. The command palette provides the shared ⌘K or Ctrl+K entry point and returns focus to the opener. Row menus can expose the same actions through a kebab and a right-click shortcut, while selection controls remain the correct surface for choosing a form value (frontend/…/README.md• L20-29, frontend/…/README.md• L77-151, frontend/…/RowActionMenu.tsx• L19-23).

Every menu overlay uses the v1 portal and keeps keyboard navigation, focus return, viewport collision handling, and accessible status rows consistent. Destructive actions are separated at the end of an action list. Menu triggers are wrappers over the shared v1 button system, so callers use the same action and naming contract across menus and pages (frontend/…/DropdownMenu.tsx• L37-65, frontend/…/ContextMenu.tsx• L34-56, frontend/…/CommandPalette.tsx• L67-132, frontend/…/MenuTrigger.tsx• L21-73).

References: frontend/…/README.md• L1-18 frontend/…/README.md• L20-29 frontend/…/README.md• L77-151 frontend/…/index.ts• L1-72 frontend/…/RowActionMenu.tsx• L19-23 frontend/…/DropdownMenu.tsx• L37-65 frontend/…/ContextMenu.tsx• L34-56 frontend/…/CommandPalette.tsx• L67-132 frontend/…/MenuTrigger.tsx• L21-73

Toggle controls

The toggle layer gives v1 one shared way to present binary settings, mixed selection, one-of-many choices, and bounded numeric values. Checkbox, Switch, RadioGroup with Radio, and Slider are imported from one public index (frontend/…/README.md• L1-21, frontend/…/index.ts• L1-14).

Each toggle owns its name and description rather than borrowing a Field label. This keeps labels and descriptions attached to the focusable control. The mixed checkbox is controlled, radio groups move with arrow keys, and sliders name every thumb and expose formatted values when needed. Shared sizes, focus treatment, disabled behavior, and forced-colors support keep these controls aligned across pages (frontend/…/README.md• L23-82, frontend/…/Checkbox.tsx• L20-63, frontend/…/RadioGroup.tsx• L35-95, frontend/…/Slider.tsx• L35-42).

References: frontend/…/README.md• L1-21 frontend/…/README.md• L23-82 frontend/…/index.ts• L1-14 frontend/…/Checkbox.tsx• L20-63 frontend/…/RadioGroup.tsx• L35-95 frontend/…/Slider.tsx• L35-42

Chart components

The chart layer gives pages one way to present trends, comparisons, stacks, and small KPI histories. LineChart, AreaChart, BarChart, StackedBarChart, and Sparkline share data, series, formatting, loading, empty, and accessibility behavior. Pages should use this layer instead of importing the chart library directly (frontend/…/README.md• L1-10, frontend/…/index.ts• L1-24).

Charts use semantic tones for meaningful series and a five-step token ramp for ordered stack segments. They expose a summary and a hidden data table beside the plot. Axis charts support legends and row-based markers. A chart has no error state; a failed request uses the page's inline alert so an error is not shown as an empty result (frontend/…/README.md• L121-142, frontend/…/README.md• L159-198, frontend/…/ChartFrame.tsx• L37-41).

Loading uses a skeleton and keeps the chart footprint stable when the series are known. Empty data uses a fixed-height message or caller-provided empty content. Interactive plots support keyboard movement and announce the active point, while a static sparkline remains outside the tab order (frontend/…/ChartFrame.tsx• L68-129, frontend/…/README.md• L171-201).

References: frontend/…/README.md• L1-10 frontend/…/README.md• L121-142 frontend/…/README.md• L159-201 frontend/…/ChartFrame.tsx• L37-41 frontend/…/CartesianChart.tsx• L56-121

Feedback and shell controls

Feedback has one v1 notification path. Product code calls notify() or its toast helpers from frontend/…/notify.ts. The Toaster renders the display side inside the v1 root. This lets services report an event without importing a UI component (frontend/…/README.md• L78-97, frontend/…/notify.ts• L11-99, frontend/…/V1App.tsx• L31-55).

The shell provides account and organization context for pages. The account menu exposes profile, help, sign-out, and an optional billing slot. The organization switcher loads the user's organizations when opened, supports search and confirmation, then reloads the app in the same section of the new organization when possible (frontend/…/AccountMenu.tsx• L40-109, frontend/…/OrganizationSwitcher.tsx• L262-440).

References: frontend/…/README.md• L78-97 frontend/…/notify.ts• L11-99 frontend/…/V1App.tsx• L31-55 frontend/…/AccountMenu.tsx• L40-109 frontend/…/OrganizationSwitcher.tsx• L262-440

Code and structured data utilities

The code utility set is the single v1 surface for showing and editing code, JSON, diffs, Markdown, and copyable text. It gives pages a shared visual and accessibility contract while keeping syntax and diff colors in the v1 token system (frontend/…/index.ts• L1-37, frontend/…/README.md• L1-28).

Code presentation

CodeBlock presents read-only code with optional language highlighting, line numbers, wrapping, actions, and copy support. InlineCode presents short code, IDs, and counts without allowing each page to choose its own mono style. The highlighter converts supported languages into v1 token kinds, so v0's global Prism styles cannot reach these views (frontend/…/CodeBlock.tsx• L7-39, frontend/…/InlineCode.tsx• L1-47, frontend/…/highlight.ts• L18-28, frontend/…/tokens.ts• L1-18).

References: frontend/…/README.md• L20-52 frontend/…/CodeBlock.tsx• L41-105 frontend/…/InlineCode.tsx• L1-47 frontend/…/highlight.ts• L43-53 frontend/…/tokens.ts• L1-18

Structured data presentation

JsonView shows JSON as an expandable tree or raw text over one shared line model. It keeps source spelling for JSON text, supports keyboard navigation, and limits work for long views. DiffView compares two texts in split or unified form and reports a safe fallback when the comparison exceeds its limits (frontend/…/JsonView.tsx• L42-81, frontend/…/DiffView.tsx• L15-49, frontend/…/diff.ts• L55-77).

The JSON and diff helpers are public through the code index. Pages can format JSON or request change counts without creating a second tree, printer, or comparison path (frontend/…/index.ts• L6-18).

References: frontend/…/JsonView.tsx• L192-207 frontend/…/JsonView.tsx• L488-621 frontend/…/DiffView.tsx• L170-230 frontend/…/json-lines.ts• L8-20 frontend/…/diff.ts• L64-77 frontend/…/index.ts• L6-18

Markdown and editor behavior

Markdown renders model output and API descriptions with safe link and HTML rules. Fenced code uses CodeBlock, so Markdown does not create a separate code renderer. CodeEditor provides an editable or read-only Monaco surface behind a lazy load and follows the v1 theme. CopyButton reports copied, failed, or unavailable results through inline feedback and the v1 notification path (frontend/…/Markdown.tsx• L206-251, frontend/…/CodeEditor.tsx• L22-47, frontend/…/CopyButton.tsx• L46-51).

References: frontend/…/Markdown.tsx• L206-251 frontend/…/CodeEditor.tsx• L22-47 frontend/…/CopyButton.tsx• L46-51 frontend/…/clipboard.ts• L1-19

PDF document utilities

The document layer gives future views one safe, repeatable way to open and show PDFs, images, and extracted text. It turns source loading, page geometry, highlights, zoom, keyboard input, and render failures into viewer-facing behavior that pages can reuse.

Document loading

PDF.js is loaded only when a page first needs it, with one bundled worker shared by v0 and v1. The loader supports request credentials and headers for URL sources and protects caller-owned byte data during transfer (frontend/…/types.ts• L3-11, frontend/…/pdfjs.ts• L1-9, frontend/…/pdfjs.ts• L26-66).

Opening a document also reads page sizes in page order. Reads run in bounded parallel work. A damaged page can inherit a nearby readable size without blocking the rest of the document. A load can be destroyed when its owner leaves or changes source, which prevents stale work from updating a later view (frontend/…/pdfjs.ts• L100-145, frontend/…/pdfjs.ts• L208-257).

References: frontend/…/types.ts• L3-23 frontend/…/pdfjs.ts• L1-9 frontend/…/pdfjs.ts• L26-66 frontend/…/pdfjs.ts• L100-145 frontend/…/pdfjs.ts• L208-257

Viewer state

usePdfDocument turns the opening process into states that a viewer can render without knowing PDF.js details. A source is reopened only when its URL, request options, or byte identity changes. A retry starts a new attempt. A password submission continues the current attempt without downloading the document again (frontend/…/usePdfDocument.ts• L11-45, frontend/…/usePdfDocument.ts• L47-140).

The viewer status pattern gives each non-ready state a clear user action. It can wait, explain that no document exists, report an unsupported or failed file, or ask for a password. Error classification removes sensitive URL details from user-facing messages (frontend/…/ViewerStatus.tsx• L5-20, frontend/…/ViewerStatus.tsx• L25-115, frontend/…/pdfjs.ts• L148-180).

This diagram shows how a document source moves through the shared PDF boundary before a page renders it.

flowchart LR
    Source[URL or in-memory bytes] --> Open[PDF opening]
    Open --> Password[Password prompt]
    Password --> Open
    Open --> Sizes[Page sizes]
    Sizes --> Ready[Ready viewer state]
    Open --> Failure[Unsupported or failed state]
    Failure --> Retry[Retry]
    Retry --> Open

References: frontend/…/usePdfDocument.ts• L11-45 frontend/…/usePdfDocument.ts• L47-140 frontend/…/ViewerStatus.tsx• L5-20 frontend/…/ViewerStatus.tsx• L25-115 frontend/…/pdfjs.ts• L148-180

Document viewer

DocumentViewer is the shared pattern for a PDF, image, or text source. It gives each source the right display mode while keeping common actions such as page or highlight jumps, zooming, paging, and retrying in one interface (frontend/…/DocumentViewer.tsx• L40-67, frontend/…/DocumentViewer.tsx• L119-124).

PDFs keep their full page layout so page and highlight jumps remain stable. Only pages near the visible area hold canvases. Images use the same page sizing and highlight model as PDFs. Text stays as numbered lines while preserving search, copy, and line-level highlights (frontend/…/PdfPageList.tsx• L152-157, frontend/…/PdfPage.tsx• L44-49, frontend/…/ImageView.tsx• L43-44, frontend/…/TextView.tsx• L96-100, frontend/…/TextView.tsx• L174-207).

References: frontend/…/DocumentViewer.tsx• L40-67 frontend/…/DocumentViewer.tsx• L119-124 frontend/…/PdfPageList.tsx• L152-157 frontend/…/PdfPage.tsx• L44-49 frontend/…/ImageView.tsx• L43-44 frontend/…/TextView.tsx• L96-100

Highlight model

The highlight model gives PDF, image, and extracted-text producers one shared way to mark content. Page highlights use normalized page fractions. Text highlights use line numbers. The normalizers discard invalid or unplaceable input instead of drawing it at a false location (frontend/…/highlights.ts• L1-24, frontend/…/highlights.ts• L27-66, frontend/…/highlights.ts• L211-336).

The viewer renders highlights as visible marks or accessible buttons. Active highlights use a separate tone and can be brought into view. Confidence can mark a word as low confidence. Line highlights keep the treatment used by the source product (frontend/…/HighlightLayer.tsx• L4-17, frontend/…/HighlightLayer.tsx• L85-107, frontend/…/TextView.tsx• L15-35).

References: frontend/…/highlights.ts• L1-24 frontend/…/highlights.ts• L27-66 frontend/…/highlights.ts• L211-336 frontend/…/HighlightLayer.tsx• L4-17 frontend/…/HighlightLayer.tsx• L85-107 frontend/…/TextView.tsx• L15-35

Render window

The render window limits expensive PDF canvas work to visible pages and a small area around them. The page list keeps every page's layout box, so the scrollbar and jump targets stay correct while canvases are created only where the reader is near them (frontend/…/usePageWindow.ts• L41-47, frontend/…/windowing.ts• L24-50).

Canvas quality follows screen density but stays within a memory-safe limit. The viewer watches element size and device pixel ratio so fit modes and page renders adapt when the browser or display changes (frontend/…/useElementSize.ts• L8-13, frontend/…/useDevicePixelRatio.ts• L7-12, frontend/…/windowing.ts• L53-81).

References: frontend/…/usePageWindow.ts• L41-47 frontend/…/usePageWindow.ts• L90-107 frontend/…/windowing.ts• L7-21 frontend/…/windowing.ts• L24-73 frontend/…/useElementSize.ts• L8-45 frontend/…/useDevicePixelRatio.ts• L7-27

Query and service seams

The v1 data layer gives pages one boundary for server state, browser requests, session-aware actions, and user-visible errors. Pages describe typed queries and mutations. The shared query client and service helpers then apply the same cache, retry, request, and error rules across product flows.

Query state

Server state goes through TanStack Query with typed functions in frontend/src/v1/services/. V1App mounts one query client that stays in place across v1 pages. Reads retry transient failures up to two times. Mutations do not retry. Offline requests fail promptly, while reads refresh when the connection returns (frontend/…/query.ts• L12-68, frontend/…/V1App.tsx• L27-44, frontend/…/README.md• L85-103).

QueryView turns a read into a common page state: a skeleton while loading, an inline alert with Retry after an initial failure, and data after success. An expired session keeps the loading view while the session boundary leaves the page. A failed refresh keeps existing data on screen and is reported through the shared notification path. Paged queries keep the prior page only when the organization and filters still match (frontend/…/QueryView.tsx• L7-61, frontend/…/page.ts• L22-45).

This diagram shows how a v1 page moves server state through the shared query and service boundary.

flowchart LR
    Page[Page query] --> Client[Shared QueryClient]
    Client --> Service[Typed service]
    Service --> HTTP[Shared HTTP client]
    HTTP --> API[Backend]
    API --> Client
    Client --> View[QueryView: skeleton, alert, or data]
    Client --> Notice[Shared error report]

References: frontend/…/query.ts• L12-68 frontend/…/V1App.tsx• L27-44 frontend/…/QueryView.tsx• L7-61 frontend/…/page.ts• L22-45 frontend/…/README.md• L85-103

HTTP and error services

The shared client is frontend/…/http.ts. It sends browser credentials, adds a request id to every request, and adds the CSRF cookie to same-origin writes. It converts failures into the v1 ApiError contract and triggers one session-expiry action for concurrent unauthenticated responses (frontend/…/http.ts• L9-27, frontend/…/http.ts• L60-105).

Services expose typed resource functions and query options. Organization-scoped keys include the organization, so one organization's data cannot occupy another organization's cache entry. The page helper keeps the previous page only for the same list and filter. Forms map known field errors to controls and keep all other errors for one form-level alert (frontend/…/README.md• L18-55, frontend/…/page.ts• L22-45, frontend/…/errors.ts• L233-266).

The error reporter gives each failure one user-facing path. Mutations normally show a toast. A caller that displays its own error can ask for logging only. Initial read failures belong in QueryView, refresh failures use a toast while stale data remains visible, cancellations are silent, and session expiry is logged while the app leaves the page (frontend/…/report.ts• L18-49, frontend/…/README.md• L85-103).

References: frontend/…/http.ts• L9-27 frontend/…/http.ts• L60-105 frontend/…/errors.ts• L46-65 frontend/…/errors.ts• L233-266 frontend/…/page.ts• L22-45 frontend/…/report.ts• L18-49 frontend/…/README.md• L18-55 frontend/…/README.md• L85-103

Organization and session services

Organization services list the organizations visible to the user, select the current organization, and create a login URL when the identity provider must perform the switch. They give known backend refusals meaning: an ended session and removed access are distinct from an unknown request failure (frontend/…/organizations.ts• L5-19, frontend/…/organizations.ts• L39-99).

Pure helpers turn organization data into role labels, member summaries, initials, and a safe landing path. Switching keeps the current section when it is valid at the new organization and drops record-specific path parts. The switcher loads on open, confirms the change, and reloads so old organization state does not remain in the browser (frontend/…/organizations.ts• L1-15, frontend/…/organizations.ts• L23-37, frontend/…/organizations.ts• L67-105, frontend/…/OrganizationSwitcher.tsx• L262-440).

Sign-out validates the backend's redirect before leaving. It resets analytics and clears session data while keeping only UI preferences. Other tabs receive a short-lived sign-out message and clear their own session state (frontend/…/session.ts• L203-254, frontend/…/browserStorage.ts• L48-63, frontend/…/browserStorage.ts• L88-160).

References: frontend/…/organizations.ts• L5-19 frontend/…/organizations.ts• L39-99 frontend/…/organizations.ts• L1-15 frontend/…/organizations.ts• L23-37 frontend/…/organizations.ts• L67-105 frontend/…/OrganizationSwitcher.tsx• L262-440 frontend/…/session.ts• L203-254 frontend/…/browserStorage.ts• L48-63 frontend/…/browserStorage.ts• L88-160

Session, permission, and telemetry helpers

The v1 session model turns the backend session into a small context for pages. It carries the signed-in user and current organization. Permission helpers then decide which actions to offer while the backend remains the final authority (frontend/…/session.tsx• L7-55, frontend/…/permissions.ts• L1-5).

Organization capabilities are read through an organization-scoped query. The UI removes actions that the user cannot take instead of showing them as disabled. Analytics tags events with the interface version and identifies users only under the allowed SaaS host and privacy rules. Analytics failures are logged and do not block the page (frontend/…/capabilities.ts• L6-36, frontend/…/permissions.ts• L58-86, frontend/…/analytics.ts• L10-64).

References: frontend/…/session.tsx• L7-55 frontend/…/permissions.ts• L1-5 frontend/…/capabilities.ts• L6-36 frontend/…/permissions.ts• L58-86 frontend/…/analytics.ts• L10-64

Session and route guards

The v1 session boundary loads the shared browser session once per page load and decides whether a page may render. It keeps v1 aligned with v0's sign-in, organization, and logout destinations while giving v1 pages their own session context.

Session loading

RouteGate loads the session, applies the current organization before page queries run, identifies the user for analytics, and provides the session to signed-in pages. A load can find a guest, a signed-in user, a missing organization choice, an ended session, removed organization access, or no organization. The gate redirects or shows a clear state instead of rendering the page against incomplete session data (frontend/…/RouteGate.tsx• L49-73, frontend/…/session.ts• L35-55, frontend/…/session.ts• L179-201).

The session uses the same browser cookies as v0, so changing versions does not ask the user to sign in again. A signed-in session stores both the organization id for service calls and the organization URL name for route checks. Guest pages receive no session context (frontend/…/session.tsx• L21-55, frontend/…/RouteGate.tsx• L126-147).

References: frontend/…/RouteGate.tsx• L49-73 frontend/…/RouteGate.tsx• L126-147 frontend/…/session.ts• L35-55 frontend/…/session.ts• L179-201 frontend/…/session.tsx• L21-55

Access decisions

Each route registry entry declares one access class: guest, authenticated, admin, or platform-admin. The guard sends guests to v0 sign-in, sends signed-in users away from guest pages, checks an organization URL against the current organization, and shows NoPermission when an organization admin check fails (frontend/…/types.ts• L24-35, frontend/…/guard.ts• L17-53, frontend/…/NoPermission.tsx• L4-25).

Cloud plugin gates wrap signed-in pages. Entitlement gates can decide whether a page is available. Platform-admin gates decide the platform-admin class. A gate that fails to load keeps the page closed and shows its own retry state, so an optional capability cannot fail open (frontend/…/RouteGate.tsx• L86-123, frontend/…/types.ts• L30-41, frontend/…/RouteGate.test.tsx• L271-326).

References: frontend/…/types.ts• L24-35 frontend/…/guard.ts• L17-53 frontend/…/NoPermission.tsx• L4-25 frontend/…/RouteGate.tsx• L86-123 frontend/…/types.ts• L30-41 frontend/…/RouteGate.test.tsx• L271-326

Plugin boundary

The plugin boundary lets cloud and on-premise builds add v1 product capabilities without making the public foundation depend on those capabilities. The public repository has no plugin manifest. A distribution overlay can add plugin folders beside frontend/…/index.ts at build time (frontend/…/index.ts• L1-7, frontend/src/v1/plugins/.gitkeep).

Plugin registry

The registry selects manifests for the current distribution and exposes optional slot fillers and route entries. The OSS build offers no plugins. Cloud and on-premise builds can offer only plugins that declare the matching distribution. Plugin routes are checked against the v1 page routes so an extension cannot claim an existing URL (frontend/…/types.ts• L9-27, frontend/…/types.ts• L30-66, frontend/…/index.ts• L24-62).

The registry rejects duplicate plugin ids, duplicate slot ownership, overlapping routes, invalid route patterns, unknown slots, invalid distributions, and non-function loaders. These checks also run for distributions other than the current one, so a dormant build does not hide a conflict (frontend/…/registry.ts• L61-105, frontend/…/registry.ts• L109-181).

Route gates are part of the same contract as visual slots. Entitlement and platform-admin fillers can wrap pages, while normal fillers can add optional product or shell content. Plugin routes are exposed for the v1 router boundary, but the current v1 application tree does not yet add them to its route list (frontend/…/index.ts• L64-87).

References: frontend/…/index.ts• L1-7 frontend/…/index.ts• L24-62 frontend/…/types.ts• L9-27 frontend/…/types.ts• L30-66 frontend/…/registry.ts• L61-105 frontend/…/registry.ts• L109-181 frontend/…/index.ts• L64-87

Plugin slots

Slot renders a plugin filler when one is registered and otherwise shows the host's fallback. Each slot has its own loading boundary and error boundary. A failed filler cannot remove other slot content. Failed loads are reported once and retried after a delay. Render failures are reported when they occur (frontend/…/Slot.tsx• L66-84, frontend/…/Slot.tsx• L86-159).

The public slot context is ready for the v1 shell, pages, and route gates. The current shell can declare optional content such as account billing. Route gates use a failed state rather than a fallback that would reveal a protected page. The distribution-specific registry chooses whether a failure also raises a notification (frontend/…/index.tsx• L1-45, frontend/…/index.ts• L64-82).

References: frontend/…/Slot.tsx• L66-84 frontend/…/Slot.tsx• L86-159 frontend/…/index.tsx• L1-45 frontend/…/index.ts• L64-82

Version switch and route registry

The version switch lets v0 and v1 own different URLs during the migration. A registry entry describes a page's v1 routes, replaced v0 routes, mappings in both directions, supported distributions, access class, and whether the page may honor the old-version preference (frontend/…/types.ts• L19-73).

Route ownership

Pages are declared in PAGES when their v1 routes exist and become live only when their keys enter REGISTERED_PAGES. The live registry filters entries by build distribution. Development builds may add demo pages or preview declared pages through unstract.v1.preview. Release builds ignore that override (frontend/…/entries.ts• L11-50, frontend/…/live.ts• L17-77).

When the current URL matches no live entry, v0 renders it. A live v1 URL renders the matching v1 page. A replaced v0 URL redirects to its mapped v1 route. A same URL can be taken over directly by v1. Route parameters are encoded during mapping so reserved characters stay inside their intended segment (frontend/…/resolve.ts• L41-85, frontend/…/resolve.ts• L88-120).

Every entry must map each route to the other version and must not overlap another page's patterns. Development checks fail on missing mappings, invalid patterns, duplicate keys, unsupported toggle pages, or ambiguous ownership (frontend/…/validate.ts• L43-61, frontend/…/validate.ts• L87-167).

References: frontend/…/types.ts• L19-73 frontend/…/entries.ts• L11-50 frontend/…/live.ts• L17-77 frontend/…/resolve.ts• L41-120 frontend/…/validate.ts• L43-61 frontend/…/validate.ts• L87-167

V1 application tree

The v1 application is a separate route tree with its own query client, theme provider, plugin provider, session gate, suspense boundary, and notification host. The page component is lazy-loaded from the page map. The tree does not sit inside the v0 layout or v0 guards (frontend/…/V1App.tsx• L11-57, frontend/…/pages.ts• L1-21).

The switch lazy-loads this tree only for a resolved v1 page. It keeps a v1 failure from unmounting the v0 application. A stale dynamic chunk triggers one guarded reload. A repeat or different failure shows a local reload fallback. Page errors stay inside the page boundary, separate from a plugin gate error (frontend/…/VersionSwitch.tsx• L7-22, frontend/…/VersionSwitch.tsx• L33-45, frontend/…/V1ErrorBoundary.tsx• L14-55, frontend/…/RouteGate.tsx• L76-83).

References: frontend/…/V1App.tsx• L11-57 frontend/…/pages.ts• L1-21 frontend/…/VersionSwitch.tsx• L7-22 frontend/…/VersionSwitch.tsx• L33-45 frontend/…/V1ErrorBoundary.tsx• L14-55 frontend/…/RouteGate.tsx• L76-83

Validation and test seams

The v1 test boundary lets shared controls and pages run without the v0 test environment. It supplies the v1 query, router, theme, session, and portal seams. It also makes network and accessibility contracts fail close to the code that breaks them.

Test harness

renderV1 gives each test a fresh query client, memory route, theme, session, organization context, and v1 portal. Tests register typed MSW handlers for every request. Unmatched HTTP and WebSocket calls fail the test, so a page cannot silently add an untested backend dependency (frontend/…/README.md• L44-81, frontend/…/providers.tsx• L31-77, frontend/…/render.tsx• L23-109, frontend/…/session.ts• L1-87).

Component galleries capture public markup and run accessibility checks for each entry. This gives shared controls a visible contract in addition to behavior tests. The v1 suite runs separately from v0 and has its own coverage threshold (frontend/…/README.md• L8-29, frontend/…/README.md• L148-168, frontend/…/gallery.ts• L6-37).

References: frontend/…/README.md• L44-81 frontend/…/providers.tsx• L31-77 frontend/…/render.tsx• L23-109 frontend/…/session.ts• L1-87 frontend/…/README.md• L8-29 frontend/…/README.md• L148-168 frontend/…/gallery.ts• L6-37

Migration boundaries

The foundation supports an incremental migration instead of a shared-code migration. V0 keeps its current application model. The registry and version switch move only selected pages into a clean v1 tree.

V0 and v1 coexistence

V0 and v1 can share the browser document without sharing visual scope. V1 mounts under a .v1 root, uses a separate theme key, and sends overlays to a v1 portal. The v1 root supplies its own base text, border, background, and font values without resetting v0's document (frontend/…/ThemeProvider.tsx• L44-49, frontend/…/base.css• L1-29, frontend/…/index.css• L1-8).

The import boundary is one-way and narrow. V0 may import only @v1. V1 code imports only its own @v1 paths and permitted packages. This prevents migration pressure from becoming hidden coupling between old and new pages (frontend/…/README.md• L15-23, frontend/…/check-v1.mjs• L834-935).

References: frontend/…/ThemeProvider.tsx• L44-49 frontend/…/base.css• L1-29 frontend/…/index.css• L1-8 frontend/…/README.md• L15-23 frontend/…/check-v1.mjs• L834-935

Old-version preference

The old-version preference is a v1-owned browser choice for toggle pages, currently Human Review and its demo stand-in. It is stored per user under unstract.v1.oldVersion.<userId>. unstract.v1.lastUser lets a reload resolve a choice before the session loads (frontend/…/oldVersion.ts• L6-17, frontend/…/validate.ts• L4-7).

The switch learns the signed-in user from whichever session loads: v0's session on v0 routes or v1's session on v1 routes. Until a session loads, a last-user marker can name the previous browser user and apply that user's stored choice. Once the switch learns a different user, it waits for that user's store state rather than redirecting with the previous choice. With no known user, setOldVersion returns false and changes nothing (frontend/…/VersionSwitch.tsx• L48-64, frontend/…/VersionSwitch.test.tsx• L204-241, frontend/…/README.md• L199-211).

Sign-out removes the last-user marker and session data but keeps the per-user old-version choices. Other tabs are told to clear their session state, while the theme and other approved UI preferences remain. This prevents a later session from inheriting transient user data without discarding deliberate interface choices (frontend/…/browserStorage.ts• L48-63, frontend/…/browserStorage.ts• L88-160).

This diagram shows the route decision during coexistence.

flowchart LR
    URL[Browser URL] --> Registry[Live route registry]
    Registry -->|unregistered| V0[v0 route]
    Registry -->|v1 route| V1[v1 page tree]
    Registry -->|replaced v0 route| Redirect[Mapped redirect]
    Redirect --> V1
    Registry -->|toggle page with old-version choice| Old[v0 page]

References: frontend/…/oldVersion.ts• L6-17 frontend/…/validate.ts• L4-7 frontend/…/VersionSwitch.tsx• L48-64 frontend/…/VersionSwitch.test.tsx• L204-241 frontend/…/browserStorage.ts• L48-63 frontend/…/browserStorage.ts• L88-160 frontend/…/resolve.ts• L88-120

Foundation guardrails

The v1 checks turn the migration boundary into a build contract. Type checks enforce the v1 file and folder model. Import checks reject escape paths, forbidden cross-layer imports, antd usage, PropTypes, and direct v0 access. Style checks enforce the prefix, scope, token, and focus rules (frontend/package.json• L81-84, frontend/…/check-v1.mjs• L1-39, frontend/…/check-v1-styles.mjs• L3-29).

The unit and boundary tests protect both behavior and separation. They cover theme and portal state, PDF lifecycle behavior, code and structured-data behavior, charts, forms, menus, toggles, navigation controls, query and service contracts, session guards, plugin distribution rules, route mappings, version switching, and v0-to-v1 boundary fixtures (frontend/package.json• L81-84, frontend/…/menu.test.tsx• L1-20, frontend/…/markup.test.tsx• L1-20, frontend/…/RouteGate.test.tsx• L132-350, frontend/…/services.test.ts• L62-334, frontend/…/plugin-distribution.test.ts• L1-108, frontend/…/boundary.fixtures.mjs• L1-20).

References: frontend/package.json• L81-84 frontend/…/check-v1.mjs• L1-39 frontend/…/check-v1-styles.mjs• L3-29 frontend/…/menu.test.tsx• L1-20 frontend/…/markup.test.tsx• L1-20 frontend/…/RouteGate.test.tsx• L132-350 frontend/…/services.test.ts• L62-334 frontend/…/plugin-distribution.test.ts• L1-108 frontend/…/boundary.fixtures.mjs• L1-20

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the @v1 public entry as the only v0-to-v1 path until the version switch is ready.
  • Keep each registry entry's v1 routes, replaced v0 routes, both mapping tables, declared component, distribution list, access class, and registration key in sync.
  • Keep route patterns non-overlapping across pages and plugins. Preserve parameter names when changing either mapping direction.
  • Keep live-page and plugin filtering aligned across REGISTERED_PAGES, preview settings, VITE_V1_DEV_ROUTES, and VITE_DISTRIBUTION.
  • Keep the old-version preference, last-user key, signed-in user sync, logout cleanup, and toggle-page allowlist aligned.
  • Keep lazy page loading and chunk-reload recovery inside the v1 boundary so a failed v1 chunk does not remove the v0 fallback.
  • Keep data-theme, the v1 storage key, token mode blocks, and the portal container on the same theme contract.
  • Regenerate styles/tokens.css from styles/tokens.json after token changes. Keep chart, code, and diff token names aligned with their consumers.
  • Keep the ui: prefix and .v1 selector scope aligned with Tailwind setup and the style checker.
  • Keep each Field tied to one control and preserve the label, description, invalid state, and overlay Escape contract.
  • Keep each toggle named through its own label or ARIA name. Do not place a toggle or radio group inside Field.
  • Keep button sizes, loading focus behavior, icon-button names, and router-link styling aligned with the shared button surface.
  • Keep menu actions, destructive grouping, trigger ref behavior, search filtering, and portal focus return aligned across menu variants.
  • Keep navigation roles, current-state announcements, keyboard movement, and the public navigation index aligned across all control variants.
  • Keep pagination range text, page clamping, page-size transitions, and the parent page callback aligned when list data changes.
  • Keep chart series semantics, chart ramp order, empty and loading states, and accessible text alternatives aligned with the shared chart contract.
  • Keep query keys organization-scoped. Preserve the distinction between initial read errors, refresh errors, mutation errors, cancellations, and select failures.
  • Keep the HTTP CSRF and request-id policy and service error meanings aligned with backend status codes.
  • Keep session loading, organization id and URL name, route access classes, and cloud gate fallbacks aligned.
  • Keep organization switch paths at section level. Do not carry record-specific paths into a different organization.
  • Keep plugin slot ownership, route ownership, distribution declarations, and the OSS route list aligned. Cloud additions must stay behind the distribution overlay.
  • Keep code, JSON, diff, Markdown, editor, and copy behavior behind @v1/components/ui/code; do not add a second renderer or direct syntax color path.
  • Keep PDF source identity, load destruction, password continuation, error classification, page numbering, and scroll targets aligned across the document utilities.
  • Keep the render window, page layout boxes, device pixel ratio, and canvas size limits aligned when changing PDF rendering behavior.
  • Mount one v1 Toaster when a page or service needs visible notifications. Without it, notify() logs and does not retain the event.

Important failure modes

TriggerConsequenceGuard
V0 imports a v1 internal pathThe migration boundary becomes hidden coupling and v1 cannot change safelyAllow only the @v1 public entry.
A registry entry is registered without a page component or complete mappingsA URL can fail to render or redirect to an invalid screenRun registry validation and keep PAGES, REGISTERED_PAGES, and the page map aligned.
Two page or plugin route patterns overlapThe wrong owner can render or a redirect can loopUse the route and plugin pattern checks.
A toggle page resolves before the signed-in user is knownThe browser can show the wrong version or another user's choiceKeep unknown-user URLs on v0 and sync the store with the session user.
A stale v1 chunk fails after a deployThe v1 page can remain blank or reload foreverReload once within the guarded window, then show the local fallback.
A v1 selector leaves .v1 or a utility loses the ui: prefixV1 can use v0 styles or change a v0 pageRun the v1 import and style checks.
Generated token CSS is staleA visual change is missing at runtime or differs from the source tableRun bun run tokens:v1 and keep generation in the change.
A theme mode reaches the page but not its portalA dialog, menu, or toast uses the wrong paletteApply the mode to every v1 root and portal.
A chart request failure is rendered as an empty chartUsers may read a system error as a valid no-data resultRender the page InlineAlert instead of a chart error state.
A form places two controls in one FieldLabels and descriptions can point to the wrong controlGive each control its own Field.
A toggle is put inside Field or has no accessible nameAssistive technology cannot identify the control or groupUse the toggle's own label or ARIA name and keep it outside Field.
A loading button is replaced with a disabled buttonFocus moves away and a trigger can lose its busy stateUse the shared loading button behavior.
Escape closes a menu before a non-empty SearchField clearsUsers lose the search context and cannot refine it in placeUse isEscapeClearTarget in the overlay Escape handler.
A menu trigger does not forward its ref and propsRadix cannot open the menu or return focus correctlyUse the shared trigger or an element that supports asChild.
A navigation control loses its semantic current state or keyboard contractUsers can lose their place or fail to operate the control without a pointerKeep the shared navigation primitives and accessibility tests in sync.
Pagination renders a page beyond a reduced result countThe footer and loaded rows can describe different pagesClamp the page and notify the parent once for non-empty totals.
A query key omits the organization or filterData from another organization or filter can remain on screenBuild resource keys from the organization and typed parameters.
A mutating v1 service omits the CSRF cookie headerThe backend rejects the actionUse the shared services/http client.
A service bypasses ApiError or reports a failure twicePages lose stable error meaning or users see duplicate noticesUse typed services, reportApiError(), and the shared query client.
A session load renders a page before organization state is appliedThe first query can use no organization or stale organization dataLet RouteGate apply the session before it renders the page.
A route access class is bypassed or a gate fails openA guest or unauthorized user can see protected contentKeep every page behind RouteGate and make gate failures closed.
An organization list returns an invalid body or a known refusalThe switcher can show false choices or hide a session problemValidate the response shape and preserve session-ended and access-removed meanings.
A plugin fills a slot twice or claims an OSS routeThe build can offer ambiguous product behaviorBuild the registry for every distribution and compare plugin routes with OSS routes.
A plugin filler fails to load or renderOne optional area disappears, but repeated retries can harm the pageUse the per-slot boundary, fallback, error report, and retry delay.
A PDF source changes while its old load is activeA late result can replace the current documentDestroy the old opening and ignore non-live results.
A highlight uses page data that does not match the documentThe mark is dropped or appears on the wrong page or positionNormalize against the document page sizes and shared numbering rules.
A visible PDF page creates an unsafe canvasThe canvas can fail to paint or consume too much memoryUse the render window and bounded canvas pixel ratio.
A page or service calls notify() before a toaster mountsThe user sees no notice and the event is not queuedMount the v1 Toaster inside the v1 root.

Key files

FileWhy to read it
frontend/…/README.mdDefines the v1 purpose, folder contract, style rules, form, menu, toggle, chart, data, feedback, route switch, session, plugin boundary, and validation commands.
frontend/…/index.tsShows the narrow public entry exposed to v0.
frontend/…/VersionSwitch.tsxShows URL ownership, lazy v1 loading, old-version selection, analytics version tagging, and failure recovery.
frontend/…/V1App.tsxShows the separate v1 provider, query, plugin, session gate, notification, and route tree.
frontend/…/V1ErrorBoundary.tsxShows how v1 failures stay local and how stale chunks recover.
frontend/…/RouteGate.tsxShows session loading, organization setup, route access, cloud gates, and page isolation.
frontend/…/guard.tsDefines the pure guest, member, admin, organization, and platform-admin decisions.
frontend/…/query.tsDefines the shared query retry, cache, offline, and error-reporting policy.
frontend/…/QueryView.tsxDefines the shared read state shown by pages.
frontend/…/entries.tsShows page declaration, go-live registration, and development demo entries.
frontend/…/resolve.tsDefines URL matching, redirect, and version selection behavior.
frontend/…/validate.tsDefines the checks that prevent ambiguous or incomplete route entries.
frontend/…/ThemeProvider.tsxShows how v1 roots receive theme state and shared styles.
frontend/…/tokens.jsonDefines the source token families for visual, syntax, diff, and chart presentation.
frontend/…/index.cssShows token-backed utilities, theme variants, and focus behavior.
frontend/…/portal.tsShows the v1-owned overlay container and theme propagation.
frontend/…/notify.tsDefines the notification contract used by pages and services.
frontend/…/README.mdDefines the shared action, link, icon-button, shortcut, and group contract.
frontend/…/Field.tsxShows the label, description, error, and one-control form contract.
frontend/…/index.tsShows the public form surface and shared label and helper text exports.
frontend/…/index.tsDefines the public navigation component surface and shared types.
frontend/…/README.mdDefines chart variants, series colors, states, markers, and accessibility behavior.
frontend/…/README.mdDefines the public code, JSON, diff, Markdown, editor, copy, and inline-code contract.
frontend/…/README.mdDefines menu types, action rows, search, command palette, focus, and trigger rules.
frontend/…/index.tsDefines the public menu component surface.
frontend/…/README.mdDefines toggle roles, names, states, sizes, and accessibility behavior.
frontend/…/index.tsDefines the public checkbox, switch, radio, and slider surface.
frontend/…/pdfjs.tsDefines the safe PDF loading, page-size, password, and cleanup boundary.
frontend/…/usePdfDocument.tsConverts PDF loading into the state contract used by viewers.
frontend/…/DocumentViewer.tsxCoordinates the shared PDF, image, and text viewing experience.
frontend/…/README.mdDefines typed service, query key, paging, error, and form contracts.
frontend/…/http.tsDefines the shared credential, request-id, CSRF, and session-expiry policy for v1 services.
frontend/…/errors.tsDefines the stable API error and form-error contract.
frontend/…/capabilities.tsDefines organization-scoped capability reads for permission-aware UI.
frontend/…/page.tsDefines organization-safe paging and previous-page behavior.
frontend/…/organizations.tsDefines organization list, switch, login, and backend refusal contracts.
frontend/…/session.tsDefines session loading, sign-out validation, analytics reset, storage cleanup, and navigation.
frontend/…/session.tsxDefines the session context available to signed-in pages.
frontend/…/permissions.tsDefines the UI permission helpers and backend capability rules.
frontend/…/analytics.tsDefines v1 version tagging, identity rules, and analytics failure behavior.
frontend/…/browserStorage.tsDefines session cleanup and cross-tab sign-out behavior.
frontend/…/OrganizationSwitcher.tsxShows organization loading, search, confirmation, failure handling, and navigation.
frontend/…/AccountMenu.tsxShows account actions and the optional billing plugin slot.
frontend/…/types.tsDefines supported distributions, route gates, slots, and plugin manifests.
frontend/…/registry.tsDefines plugin selection and conflict checks.
frontend/…/Slot.tsxDefines fallback, lazy loading, error isolation, and retry behavior for slots.
frontend/…/index.tsConnects build manifests, distribution selection, route checks, slots, and plugin error notices.
frontend/…/README.mdExplains isolated rendering, provider seams, typed network fixtures, and accessibility checks.
frontend/…/providers.tsxDefines the provider chain used by the application tests.
frontend/…/render.tsxDefines the shared render and hook harness used by v1 tests.
frontend/…/session.tsDefines typed session and organization network fixtures.
frontend/…/check-v1.mjsEnforces file, import, folder, and v0-to-v1 boundaries.
frontend/…/check-v1-styles.mjsEnforces v1 styling scope and token use.