Skip to main content

ProductShell and Semantic Product Regions

This page defines the shared product workspace Shell for Workspace, Knowledge Base, and Marketplace. ProductShell is the only shared Shell interface. Each product resolves its routes, authorization, active feature, and content through an Adapter before passing semantic regions to the Shell. The Shell understands semantic regions, geometry, interaction state, and layout preferences; it does not understand product names or feature rules.

Interface​

frontend/src/shared/components/shell/ProductShell.tsx accepts these ProductShell props:

Interface fieldResponsibility
topBarGlobal navigation content; optional
headerProduct page header; optional
bodyOne of the regions or state Shell body shapes
preferencesLayout preference Adapter with identity, load, and save
displayMain-content expanded or Companion fullscreen state; optional

body.kind = 'regions' requires main and may provide navigation, navigator, and companion. body.kind = 'state' provides one complete product state for loading, denied, or error content. The state remains inside ProductShell; a product Adapter does not bypass the Shell with an early return.

Semantic regions​

RegionInterface responsibilityOptionalContent owner
navigationProduct-level navigation and primary feature selectionYesProduct Adapter
navigatorFile tree, list, settings category, or operation entry for the active featureYesProduct Adapter
mainPrimary content, detail, editor, or workbenchNoProduct Adapter
companionChat, Terminal, or another supporting workspaceYesProduct Adapter

Each column region provides content, behavior, and presentation:

  • content receives collapsed state and produces region content.
  • behavior declares collapsible, resizable, defaultWidth, minWidth, and maxWidth.
  • presentation provides the accessible label, responsive policy, and header slots. Column background is not part of the product Adapter interface.

A Companion additionally declares side and bottom size policies, side | bottom placement, a standard | compact rail, collapsed content, collapse/expand/resize labels, and a reveal request id. The product supplies content and capability; the Shell executes placement, sizing, collapse, resize, and main-content coordination.

Shell implementation​

The ProductShell implementation owns all shared geometry and interaction:

  • It composes the body from the actual topBar, optional header, navigation, navigator, main, and companion regions.
  • It clamps widths and heights from region behavior and preserves a usable minimum main-content width and height.
  • It manages column and Companion resize, collapse, responsive hiding, overflow, scrolling, focus cursor state, and fullscreen.
  • It exposes stable test surfaces through data-shell-region, data-shell-body, and data-shell-state.
  • navigation, navigator, main, side/bottom companion, state bodies, and Shell-owned header/content containers all use bg-background. Borders, geometry, and content hierarchy distinguish columns; product Adapters cannot select a column background.
  • main-expanded renders only the main content; companion-fullscreen renders only the Companion, with Escape handled by the display Adapter.
  • Main and content containers use min-w-0, min-h-0, and local overflow boundaries so content cannot move horizontal scrolling to the document.

The Shell does not accept a product name, route, capability, resource role, API response, or feature-specific condition. Decisions requiring those facts belong in the product Adapter or product surface model.

Column sizing and spatial concession​

The production Shell presets for Workspace, Knowledge Base, and Marketplace share the same expanded-column sizing baseline:

Semantic regionExpanded minimum widthExpanded default width
navigation240px240px
navigator270px270px

Collapsed navigation and navigator regions each use an independent 64px rail. A collapsed rail is not part of the expanded column's minimum width. Each preset still declares its maximum widths, collapse, resize, and responsive policy through its existing behavior contract.

The Workspace side Companion has a minimum width of 408px, while main has a minimum usable width of 320px. When a side Companion cannot fit alongside the minimum supported geometry for navigation, navigator, and main, ProductShell temporarily renders it as a 48px compact rail. The Shell restores the Companion's pre-concession expanded state when horizontal space becomes available again; this responsive collapse is not persisted as a layout preference. The bottom Companion is not affected by this concession. The minimum supported viewport remains 1024x768; viewports below that boundary do not introduce automatic collapse rules for navigation or navigator.

Layout preferences​

ProductShellPreferencesAdapter is the external seam for Shell preferences:

interface ProductShellPreferencesAdapter {
identity: string;
load(): ProductShellPreferences | null;
save(preferences: ProductShellPreferences): void;
}

The Shell uses identity for the active scope, loads the initial value, and saves layout changes with debounce. ProductShellPreferences stores collapsed, width, height, and placement for navigation, navigator, and companion; every loaded value is clamped by region behavior.

When Workspace loads layout preferences, saved navigation and navigator widths that remain within the current region behavior are preserved. Values below the production minimum are clamped by the Shell to 240px and 270px, respectively.

The product Adapter owns identity and persistence policy:

  • Workspace uses Workspace runtime identity and the Workspace layout storage contract.
  • Knowledge Base and Marketplace do not mount a preferences Adapter, so they use Shell defaults without persisting layout state.

Product Adapters​

Workspace​

frontend/src/features/workspace/layout/WorkspaceShellAdapter.tsx first resolves product state through resolveWorkspaceShellSurface() and then creates a ProductShellBody:

  • navigation is the Workspace sidebar.
  • navigator exists according to the active feature, sub-view, Reader capability, Terminal page, and main-expanded state.
  • main is Workspace feature content.
  • companion mounts when Runtime exists and Chat or Terminal capability is available. Terminal supports side or bottom placement, and Chat supports fullscreen.
  • Workspace Provider, Version Control Provider, Realtime Provider, and File Workbench orchestration remain in the Workspace Adapter or its product owners; they do not enter the Shell.

WorkspaceShellSurfaceModel is a pure decision interface containing the active agent tool, navigator presence, main-expanded state, active Companion tab, Companion placement, and fullscreen result. It does not render DOM or execute API mutations.

Knowledge Base​

frontend/src/features/knowledge-base/components/KnowledgeBaseShellAdapter.tsx maps the Knowledge Base surface to ProductShellBody:

  • List and detail content may provide navigation, navigator, and main.
  • Loading, permission-denied, and error content uses body.kind = 'state' and can still provide a product header.
  • Knowledge Base provides no Companion, so the Shell creates no empty Companion region.
  • Knowledge Base route, query, permission, and API mapping for Files, Version Control, sharing, Workspace attachment, and settings remain in the Knowledge Base owner.

Marketplace​

frontend/src/features/marketplace/components/MarketplaceShellAdapter.tsx maps catalog, detail, editor, and settings surfaces to the same ProductShellBody interface. Marketplace provides no Companion.

The current Marketplace Settings region contract is:

RegionContent
navigationSettings categories; the active Version Control item expands the changes and history submenu
navigatorComplete general settings, SSH key, and activity content, or the Version Control branch, sync, file-changes, or history list
mainVersion Control Diff or Commit detail; other settings do not create an empty third region

The Version Control submenu is represented by section=versionControl&submenu=changes|history; missing submenu selects changes. Marketplace owns the route parser, query, selection, and authorization; the Shell only renders the resolved result.

Content and state contract​

A product Adapter must resolve route, resource role, platform operation, and Runtime availability before selecting regions or state:

  • Unresolved data is not passed to the Shell for inference.
  • state content fills the available main area and manages scrolling within its own boundary.
  • An absent region creates no placeholder, empty column, or reserved space.
  • Product capability models decide whether read-only controls are visible or disabled; the Shell does not authorize operations.
  • i18n labels, ARIA labels, error messages, and operation copy come from product or shared locale contracts and are not hard-coded in the Shell.

Module ownership and forbidden dependencies​

ModuleMay depend onMust not own
shared/components/shellNeutral region types, the unified Shell surface, layout preferences, UI primitives, and i18n accessorsProduct routes, feature names, resource roles, API queries, or product capabilities
Workspace AdapterWorkspace Provider, surface model, Workspace content, and Workspace preferencesA second column geometry system or product-owned resize handle
Knowledge Base AdapterKnowledge Base route, permission, and content contractsA Companion or another Shell implementation
Marketplace AdapterMarketplace surface, settings route/query, and content contractsA nested Shell, second mode rail, or product-owned column sizing

Cross-product imports still use each feature's root public.ts. The Shell is not a transport for feature-domain data. Only genuinely neutral Shell types, preferences, and presentation contracts belong in shared.

Source index​

ResponsibilityCurrent owner
Shared Shell interface and implementationfrontend/src/shared/components/shell/ProductShell.tsx, productShellTypes.ts
Shared preference normalizationfrontend/src/shared/components/shell/productShellPreferences.ts
Workspace surface decisionfrontend/src/features/workspace/layout/workspaceShellSurfaceModel.ts
Workspace Adapterfrontend/src/features/workspace/layout/WorkspaceShellAdapter.tsx
Knowledge Base Adapterfrontend/src/features/knowledge-base/components/KnowledgeBaseShellAdapter.tsx
Marketplace Adapterfrontend/src/features/marketplace/components/MarketplaceShellAdapter.tsx
Cross-product visual/interaction fixturefrontend/e2e/fixtures/product-shell.tsx, frontend/e2e/product-shell.spec.ts
Architecture boundary testfrontend/src/architecture/frontendArchitecture.test.ts

Verification contract​

The Shell test surface verifies both interface behavior and product Adapters:

  • Shared unit tests cover the unified background surface, region behavior, clamping, preferences, resize, collapse, placement, and fullscreen.
  • Workspace, Knowledge Base, and Marketplace tests cover surface models, state bodies, region presence, and capability mapping.
  • The Product Shell E2E fixture verifies region ownership, viewport boundaries, document overflow, dialog/menu boundaries, and shared product interaction.
  • The frontend architecture test verifies that shared does not depend on features, features use public entries, and ProductShell is the cross-product Shell seam.
  • All frontend tests, typecheck, lint, build, and E2E verification run in the project test container.