Implementation:AIScientists Dev WorldSeed pilot graph model
| Knowledge Sources | |
|---|---|
| Domains | Frontend, Data_Modeling |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Concrete pure graph data-model layer that transforms a PilotDataset into a GraphModel with shape-aware compaction (wide/deep/tree/mixed), provided by the WorldSeed frontend.
Description
The model module provides `buildGraphModel` (full, no compaction) and `compactGraphModel` (shape-aware compaction). For `wide` shapes, it switches to `scroll`/`dense-scroll` mode based on branch count thresholds. For `deep` shapes, `compactSequence` keeps first/last plus key items (chosen, parked, diff, final, accepted) up to a limit. For `mixed` shapes, it compacts each lane's versions independently. For `tree` shapes, `compactTree` recursively limits depth and children per node, inserting collapsed placeholder nodes with descendant counts. `isKeySequenceItem`/`keyPriority` rank versions by status and label content.
Usage
Import `buildGraphModel`/`compactGraphModel` from graph layout components to determine which branches and versions to render. The model's `mode` and `hidden` counts drive collapse UI.
Code Reference
Source Location
- Repository: WorldSeed
- File: frontend/src/components/pilot/graph/model.ts
Signature
export function buildGraphModel(data: PilotDataset): GraphModel;
export function compactGraphModel(data: PilotDataset): GraphModel;
Import
import { buildGraphModel, compactGraphModel } from './model';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| data | PilotDataset | Yes │ Full pilot dataset with branches and branchMap shape |
Outputs
| Name | Type | Description |
|---|---|---|
| returns | GraphModel │ Compacted model with visibleBranches, visibleVersions, mode, hidden counts |
Usage Examples
import { compactGraphModel } from './model';
const model = compactGraphModel(pilotData);
// model.shape = 'tree'
// model.mode = 'collapsed'
// model.hidden.descendants = 12
// model.visibleBranches = [/* compacted nodes + collapsed placeholders */]