Implementation:AIScientists Dev WorldSeed pilot format
| Knowledge Sources | |
|---|---|
| Domains | Frontend, Formatting |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Concrete pure formatting and view-model helpers for pilot presentation sections, graphs, and key deliverables with no React or JSX, provided by the WorldSeed frontend.
Description
The format module provides status/deliverable kind mapping, string normalization, metric extraction, and section caption helpers. `statusClass`/`statusSummary` classify branch statuses. `deliverableIcon`/`kindCode`/`kindLabel`/`inferDeliverableKind` map deliverable kinds to phosphor icons, codes, and labels. `deliverableCardScore` computes a priority score from status, kind, inbound dependencies, and delta. `readableDeliverableName` extracts concise names from verbose branch titles via acronym detection and stop-word filtering. `compactMetric` extracts val_loss/delta/review metrics from text. `scopeParts`/`protocolListClass`/`protocolIndex` format study-context and protocol lists. `graphCaption`/`detailSectionTitle` provide shape-aware section titles.
Usage
Import these helpers from pilot section components, graph components, and key-deliverable cards. All functions are pure — safe for `useMemo` memoization.
Code Reference
Source Location
- Repository: WorldSeed
- File: frontend/src/components/pilot/format.ts
Signature
export function statusClass(status: GraphStatus | PilotBranch['status']): string;
export function deliverableIcon(kind: PilotDeliverableKind): typeof FileText;
export function inferDeliverableKind(branch: Pick<PilotBranch, 'title' | 'versions'>): PilotDeliverableKind;
export function deliverableCardScore(branch: PilotBranch, kind: PilotDeliverableKind, inbound: number): number;
export function readableDeliverableName(branch: Pick<PilotBranch, 'title'>): string;
export function compactMetric(text: string): string;
export function deliverableWhy(branch: PilotBranch, kind: PilotDeliverableKind, inbound: number): string;
export function graphCaption(data: PilotDataset): string;
Import
import { statusClass, deliverableIcon, inferDeliverableKind, readableDeliverableName } from './format';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| branch | PilotBranch | Yes │ Branch with title, status, versions, result | |
| kind | PilotDeliverableKind | Yes │ Deliverable type | |
| inbound | number | Yes (score) │ Number of dependent deliverables |
Outputs
| Name | Type | Description |
|---|---|---|
| statusClass returns | string │ CSS class name (e.g. `pilot-status-chosen`) | |
| inferDeliverableKind returns | PilotDeliverableKind │ Inferred kind from title keywords | |
| readableDeliverableName returns | string │ Concise display name |
Usage Examples
import { inferDeliverableKind, deliverableIcon, deliverableCardScore } from './format';
const kind = inferDeliverableKind({ title: 'Paper 004 · LS+Temp', versions: [] });
// kind = 'paper'
const Icon = deliverableIcon(kind);
const score = deliverableCardScore(branch, kind, 3);
// score = 18 + 3*8 + delta*100