@modernrelay/orbit-core 0.2.0 → 0.13.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,6 +145,14 @@ type DiagnosticCode = 'duplicate-node-id' | 'duplicate-edge-id' | 'dangling-edge
145
145
  | 'accessor-churn'
146
146
  /** Image atlas resolve/decoding failures, cadence-batched (§8). */
147
147
  | 'image-resolve-failed' | 'source-revision-reused'
148
+ /** §5.1 columnar lane: invalid structure (length mismatch, detached
149
+ * buffer, out-of-range dictionary or endpoint index) — the WHOLE snapshot
150
+ * is rejected before derivation; the previous accepted scene stays. */
151
+ | 'invalid-columnar-snapshot'
152
+ /** ADR-006 D5: the worker lane could not boot — columnar acceptance runs
153
+ * on the main lane instead (info under execution:'auto', error under
154
+ * 'worker'). One-shot per instance. */
155
+ | 'worker-unavailable'
148
156
  /** A host config lane was rejected at the boundary (§5.1/§16.3 — e.g. a
149
157
  * groups array whose containment is cyclic or multiply parented); the
150
158
  * previous config stays live. */
@@ -316,6 +324,9 @@ interface SimulationConfig {
316
324
  /**
317
325
  * Barnes-Hut opening angle θ for the many-body approximation: larger is
318
326
  * coarser and faster, smaller is more exact and slower. Default 1.15.
327
+ * @deprecated Ignored on cosmos >= 3.4 (grid-based repulsion replaced
328
+ * Barnes-Hut; the engine emits `engine:repulsion-theta-deprecated` once).
329
+ * Retained for engines with a Barnes-Hut many-body force.
319
330
  */
320
331
  repulsionTheta?: number;
321
332
  /** Attraction toward the scene's centre of mass. Default 0 (OFF). */
@@ -323,8 +334,72 @@ interface SimulationConfig {
323
334
  /** How strongly nodes shy away from the cursor. Default 2. */
324
335
  repulsionFromMouse?: number;
325
336
  }
337
+ type ColumnChange = {
338
+ /** Unchanged revision permits index/cache reuse (assertion, not a hint). */
339
+ revision?: string | number;
340
+ /** Half-open, sorted, disjoint — MUST exhaust every changed row. */
341
+ dirtyRanges?: readonly {
342
+ start: number;
343
+ end: number;
344
+ }[];
345
+ };
346
+ /** Dictionary-encoded strings. `nulls`: one byte per row, nonzero = null. */
347
+ type StringColumn = ColumnChange & {
348
+ kind: 'string';
349
+ dictionary: readonly string[];
350
+ codes: Uint32Array;
351
+ nulls?: Uint8Array;
352
+ };
353
+ type Column = (ColumnChange & {
354
+ kind: 'f64';
355
+ data: Float64Array;
356
+ nulls?: Uint8Array;
357
+ }) | (ColumnChange & {
358
+ kind: 'i32';
359
+ data: Int32Array;
360
+ nulls?: Uint8Array;
361
+ }) | (ColumnChange & {
362
+ kind: 'u32';
363
+ data: Uint32Array;
364
+ nulls?: Uint8Array;
365
+ }) | (ColumnChange & {
366
+ kind: 'bool';
367
+ data: Uint8Array;
368
+ nulls?: Uint8Array;
369
+ }) | StringColumn;
370
+ /** Supported large-data lane: transferable columns and pre-indexed endpoints. */
371
+ interface ColumnarGraphSnapshot<N = Record<string, unknown>, E = Record<string, unknown>> {
372
+ kind: 'columnar';
373
+ datasetKey: string;
374
+ sourceRevision: string | number;
375
+ /** Default 'borrowed'. 'transfer' detaches the supplied ArrayBuffers ONLY
376
+ * after structural validation AND admission succeed (ADR-006 D4); the
377
+ * snapshot object is then single-use. */
378
+ bufferOwnership?: 'borrowed' | 'transfer';
379
+ nodes: {
380
+ ids: StringColumn;
381
+ columns: Readonly<Record<string, Column>>;
382
+ length: number;
383
+ /** Compile-time witness only; never materialized. */
384
+ readonly __attrs?: N;
385
+ };
386
+ edges: {
387
+ ids: StringColumn;
388
+ source: Uint32Array;
389
+ target: Uint32Array;
390
+ endpointRevision?: string | number;
391
+ endpointDirtyRanges?: readonly {
392
+ start: number;
393
+ end: number;
394
+ }[];
395
+ columns: Readonly<Record<string, Column>>;
396
+ length: number;
397
+ readonly __attrs?: E;
398
+ };
399
+ }
400
+ type GraphSnapshotInput<N = Record<string, unknown>, E = Record<string, unknown>> = GraphSnapshot<N, E> | ColumnarGraphSnapshot<N, E>;
326
401
  interface GraphHostUpdate<N = Record<string, unknown>, E = Record<string, unknown>> {
327
- data?: GraphSnapshot<N, E>;
402
+ data?: GraphSnapshotInput<N, E>;
328
403
  nodeColor?: Accessor<GraphNode<N>, string> | Scale<string, N>;
329
404
  nodeSize?: Accessor<GraphNode<N>, number> | Scale<number, N>;
330
405
  linkColor?: Accessor<AcceptedEdge<E>, string>;
@@ -349,6 +424,10 @@ interface GraphHostUpdate<N = Record<string, unknown>, E = Record<string, unknow
349
424
  dataRef?: JsonValue;
350
425
  /** §16.13 runtime toggles — atomic config-only commits, no reprojection. */
351
426
  showLinks?: boolean;
427
+ /** §13 emphasis-ring toggle (default TRUE — the ring predates its name: it
428
+ * has followed hover since v0.1). False clears the engine ring once and
429
+ * suppresses every driver (hover, focusNode, emphasizeNode). */
430
+ emphasisRing?: boolean;
352
431
  layout?: LayoutKind;
353
432
  simulation?: SimulationConfig;
354
433
  /** Controlled selection (uncontrolled when never provided; §6.4 subset). */
@@ -435,6 +514,10 @@ interface GraphTheme {
435
514
  labelFg: string;
436
515
  accent: string;
437
516
  mutedAlpha: number;
517
+ /** §13 emphasis-ring color (pointer hover, `focusNode`, `emphasizeNode`).
518
+ * Distinct from `accent` on purpose: accent is the SELECTION highlight, and
519
+ * an emphasized node must not read as selected. */
520
+ emphasisRing: string;
438
521
  }
439
522
  type ThemeInput = (Partial<GraphTheme> & {
440
523
  base?: 'light' | 'dark';
@@ -909,7 +992,84 @@ interface GraphListenerControl {
909
992
  interface NodeEventPayload<N = Record<string, unknown>> {
910
993
  node: GraphNode<N>;
911
994
  }
995
+ /** §13 engine buffer channels. Canonical home (engine/index.ts re-exports —
996
+ * the engine seam imports from types, never the reverse). */
997
+ type EngineBufferChannel = 'pointPosition' | 'link' | 'pointColor' | 'pointSize' | 'linkColor' | 'linkWidth';
998
+ /** §17 performance snapshot — NEVER carries raw attrs or ids (§17). */
999
+ interface GraphPerfSnapshot {
1000
+ at: number;
1001
+ nodeCount: number;
1002
+ edgeCount: number;
1003
+ visibleNodeCount: number;
1004
+ visibleEdgeCount: number;
1005
+ /** Estimated bytes of CPU-side typed storage the instance holds (scene
1006
+ * buffers, base color caches, crossfilter columns, metric columns, mask
1007
+ * lanes). An estimate, not an audit — documented components only. */
1008
+ estimatedCpuBytes: number;
1009
+ /** Estimated bytes of engine-side channel storage (positions + the four
1010
+ * style channels at current scene sizes). Absent pre-scene. */
1011
+ estimatedGpuBytes?: number;
1012
+ queueDepth: number;
1013
+ modelRevision: number;
1014
+ scopeRevision: number;
1015
+ renderRevision: number;
1016
+ /** null while detached; may lag in mount/recovery. */
1017
+ appliedRenderRevision: number | null;
1018
+ lastCommitMs?: {
1019
+ kind: 'model' | 'scope' | 'config' | 'mask' | 'recovery';
1020
+ validate: number;
1021
+ derive: number;
1022
+ project: number;
1023
+ upload: number;
1024
+ firstDraw?: number;
1025
+ };
1026
+ activeDegradations: readonly DegradeStep[];
1027
+ execution: 'main' | 'worker';
1028
+ rangeUpdates: readonly EngineBufferChannel[];
1029
+ /** §17 pressure-sampler mirror (S13-T07): EWMA of per-window mean frame
1030
+ * deltas, dropped-frame count, and idle wakeups since the last sample —
1031
+ * 0 idle wakeups is the healthy reading under the ADR-005 gated clock. */
1032
+ pressure: {
1033
+ frameEwmaMs: number;
1034
+ droppedFrames: number;
1035
+ idleWakeups: number;
1036
+ };
1037
+ }
1038
+ /** §17/§6.1 `limits` — construction-time thresholds for the ladder (D7:
1039
+ * read once; a runtime change warns and is ignored). */
1040
+ interface ScaleLimits {
1041
+ /** Default 100_000. */
1042
+ domLabelNodes: number;
1043
+ /** Default 250_000. */
1044
+ pickingLinks: number;
1045
+ /** Default 500_000. */
1046
+ histogramBatchNodes: number;
1047
+ /** Per-step engage/disengage band as a fraction. Default 0.10. */
1048
+ hysteresis: number;
1049
+ /** Minimum time a step holds its state. Default 1_000. */
1050
+ minimumDwellMs: number;
1051
+ /** Resource steps in engagement order. `uniform-link-style` participates
1052
+ * ONLY when explicitly listed — it can erase data-encoded styling, so
1053
+ * omission means resource admission rejects instead (§17). */
1054
+ resourceDegradationOrder: readonly ResourceDegradeStep[];
1055
+ }
1056
+ type ResourceDegradeStep = 'disable-transitions' | 'defer-images' | 'uniform-link-style';
1057
+ type DegradeStep = 'cap-dom-labels' | 'defer-link-picking' | 'batch-histograms' | ResourceDegradeStep;
1058
+ interface DegradeEvent {
1059
+ step: DegradeStep;
1060
+ engaged: boolean;
1061
+ reason: 'count' | 'resource-estimate' | 'frame-pressure' | 'input-pressure';
1062
+ visible: {
1063
+ nodes: number;
1064
+ edges: number;
1065
+ };
1066
+ }
912
1067
  interface GraphEventMap<N = Record<string, unknown>, E = Record<string, unknown>> {
1068
+ /** §17 throttled telemetry sample — never per frame (S13-T07). */
1069
+ perfSample: GraphPerfSnapshot;
1070
+ /** §17 ladder step engagement/disengagement (S13-T08). Notification
1071
+ * pattern, not §6.4-controlled. */
1072
+ degrade: DegradeEvent;
913
1073
  nodeClick: NodeEventPayload<N> & {
914
1074
  metaKey?: boolean;
915
1075
  };
@@ -1014,13 +1174,13 @@ type GraphEventName = keyof GraphEventMap;
1014
1174
  * same contract headlessly.
1015
1175
  *
1016
1176
  * v0.1 subset decisions:
1017
- * - Buffer updates are full-channel replaces (`rangeUpdates` reserved).
1177
+ * - Buffer updates are full-channel replaces, or RANGED patches for the
1178
+ * channels an engine declares in `capabilities.rangeUpdates` (S13-T04).
1018
1179
  * - One visibly atomic update per EngineCommit (§13): the adapter applies all
1019
1180
  * channels/config of a commit before the next drawn frame.
1020
1181
  * - Position readback (`getPositions`) is per-event only, never per-tick (§7.1/§17).
1021
1182
  */
1022
1183
 
1023
- type EngineBufferChannel = 'pointPosition' | 'link' | 'pointColor' | 'pointSize' | 'linkColor' | 'linkWidth';
1024
1184
  interface EngineCapabilities {
1025
1185
  /** Native edge hover/click picking. */
1026
1186
  linkPicking: boolean;
@@ -1038,6 +1198,15 @@ interface EngineCapabilities {
1038
1198
  * strength/centers (S12). Engines without it degrade loudly — membership,
1039
1199
  * labels, and centroids still work (R-13-39). */
1040
1200
  clusterForce?: boolean;
1201
+ /** §17 frame-loop idle behavior: 'stops' = zero rAF at rest (quiescent,
1202
+ * the stop-at-rest target); 'free-running' = the engine burns rAF while
1203
+ * idle — a documented degradation, not a violation. Absent reads as
1204
+ * 'free-running' (conservative). */
1205
+ idleFrames?: 'stops' | 'free-running';
1206
+ /** §13/§17 onFrame phase: true = exact post-draw; false/absent = an
1207
+ * activity clock (overlays may lag one sample — ADR-002). This field
1208
+ * makes the previously prose-only declaration real. */
1209
+ postDrawFrames?: boolean;
1041
1210
  }
1042
1211
  interface EngineConfigUpdate {
1043
1212
  /** §16.3 stage-4 cluster force (capability `clusterForce`; inert
@@ -1059,6 +1228,14 @@ interface EngineConfigUpdate {
1059
1228
  /** Engine-relevant §8 theme tokens beyond background. */
1060
1229
  defaultPointColor?: string;
1061
1230
  defaultLinkColor?: string;
1231
+ /** §13 emphasis-ring color (cosmos: `focusedPointRingColor`). No capability
1232
+ * gate: `setFocusedIndex` is a required engine member, so every engine has
1233
+ * the mechanism — one that ignores the COLOR degrades to its own default. */
1234
+ emphasisRingColor?: string;
1235
+ /** §17 disable-transitions ladder step (S13-T09): 0 = atomic jumps;
1236
+ * null = restore the engine's own default duration. Engines without
1237
+ * transitions ignore it. */
1238
+ transitionDurationMs?: number | null;
1062
1239
  }
1063
1240
  /**
1064
1241
  * One atomic engine update. `revision` is the desired-render revision the
@@ -1067,6 +1244,11 @@ interface EngineConfigUpdate {
1067
1244
  * when `structure` is present it replaces point/link structure and MUST be
1068
1245
  * applied together with any buffers in the same commit.
1069
1246
  */
1247
+ /** One contiguous ranged write: `data` lands at element offset `start`. */
1248
+ interface BufferPatch {
1249
+ start: number;
1250
+ data: Float32Array;
1251
+ }
1070
1252
  interface EngineCommit {
1071
1253
  revision: number;
1072
1254
  structure?: {
@@ -1086,6 +1268,21 @@ interface EngineCommit {
1086
1268
  /** linkCount floats (px). */
1087
1269
  linkWidth: Float32Array;
1088
1270
  }>;
1271
+ /**
1272
+ * S13-T04 ranged channel updates — ONLY for channels the engine declared
1273
+ * in `capabilities.rangeUpdates`, and only AFTER that channel has been
1274
+ * seeded by at least one full-buffer commit. A channel appears in
1275
+ * `buffers` OR here in one commit, never both. `start` is in ELEMENT
1276
+ * units of the channel's layout (RGBA floats for color channels). Patch
1277
+ * `data` views are valid only during `commit()` — same lifetime contract
1278
+ * as full buffers.
1279
+ */
1280
+ bufferPatches?: Partial<{
1281
+ pointColor: readonly BufferPatch[];
1282
+ pointSize: readonly BufferPatch[];
1283
+ linkColor: readonly BufferPatch[];
1284
+ linkWidth: readonly BufferPatch[];
1285
+ }>;
1089
1286
  config?: EngineConfigUpdate;
1090
1287
  /** §8 image-atlas resource updates (capability pointImages); applied
1091
1288
  * atomically with the same commit's buffers. */
@@ -1195,4 +1392,4 @@ interface GraphEngine {
1195
1392
  /** Engine factory the host passes in; called once per instance mount. */
1196
1393
  type EngineFactory = () => GraphEngine;
1197
1394
 
1198
- export { type BrushState as $, type AcceptedGraph as A, type BeginIngestOptions as B, type SearchActivation as C, type CrossfilterSession as D, type EngineFactory as E, type Scale as F, type GraphSnapshot as G, type MetricName as H, type IngestSession as I, type JsonValue as J, type Revisions as K, type LabelPlacement as L, type MetaEdge as M, type NodeId as N, type AccessibilityConfig as O, type PathService as P, type ThemeInput as Q, type ResolvedGroup as R, type SceneFold as S, type TimelinePlayback as T, type LabelConfig as U, type ViewportState as V, type IngestBatch as W, type RevisionDimension as X, type FilterSpec as Y, type FilterExpr as Z, type DimensionSpec as _, type GraphDiagnostic as a, type DimensionSummary as a0, type DomainPolicy as a1, type EngineBufferChannel as a2, type GraphEngine as a3, type EngineCommit as a4, type EngineCapabilities as a5, type MetricColumn as a6, type AppendReceipt as a7, type CategoryBin as a8, type ClusterSpec as a9, type FitViewOptions as aA, type EngineDiagnostic as aB, type EngineConfigUpdate as aC, type EngineContextEvent as aD, DIAGNOSTIC_SAMPLE_CAP as aa, type DiagnosticCode as ab, type DiagnosticSeverity as ac, type DimensionKind as ad, type ErrorPhase as ae, type ExpansionBatch as af, type ExpansionResponse as ag, type FilterMode as ah, type FilterValue as ai, type GraphEdge as aj, type GraphError as ak, type GraphOperationError as al, type HistogramBin as am, type IngestCommitReceipt as an, type IngestSessionState as ao, type InstanceStatus as ap, type LayoutKind as aq, type NodeEventPayload as ar, OrbitOperationError as as, type ResourceAdmissionReport as at, type SearchUnavailableReason as au, type SimulationConfig as av, graphErrorToError as aw, isFatalGraphError as ax, resourceLimitFatal as ay, type EngineHostEvents as az, type GraphNode as b, type AcceptedEdge as c, type GroupSpec as d, type GroupBySpec as e, type SceneGroups as f, type RenderScene as g, type SceneLinkRef as h, type ScenePointRef as i, type Accessor as j, type RevisionAwareService as k, type RequestContext as l, type SearchResult as m, type SelectionState as n, type SubgraphSpec as o, type ExpansionService as p, type GraphTheme as q, type GraphStoreState as r, type GraphHostUpdate as s, type GraphEventName as t, type GraphEventMap as u, type GraphListenerControl as v, type EdgeId as w, type ResolvedCluster as x, type PathOptions as y, type PathResult as z };
1395
+ export { type AccessibilityConfig as $, type AcceptedGraph as A, type BeginIngestOptions as B, type GraphEventMap as C, type GraphListenerControl as D, type EngineCapabilities as E, type FitViewOptions as F, type GraphEngine as G, type EdgeId as H, type IngestSession as I, type JsonValue as J, type GraphPerfSnapshot as K, type LabelPlacement as L, type MetaEdge as M, type NodeId as N, type ResolvedCluster as O, type PathService as P, type PathOptions as Q, type ResolvedGroup as R, type SceneFold as S, type PathResult as T, type SearchActivation as U, type ViewportState as V, type CrossfilterSession as W, type TimelinePlayback as X, type Scale as Y, type MetricName as Z, type Revisions as _, type EngineCommit as a, type ThemeInput as a0, type LabelConfig as a1, type IngestBatch as a2, type RevisionDimension as a3, type FilterSpec as a4, type FilterExpr as a5, type DimensionSpec as a6, type BrushState as a7, type DimensionSummary as a8, type DomainPolicy as a9, type InstanceStatus as aA, type LayoutKind as aB, type NodeEventPayload as aC, OrbitOperationError as aD, type ResourceAdmissionReport as aE, type ResourceDegradeStep as aF, type SearchUnavailableReason as aG, type SimulationConfig as aH, type StringColumn as aI, graphErrorToError as aJ, isFatalGraphError as aK, resourceLimitFatal as aL, type BufferPatch as aM, type EngineConfigUpdate as aN, type EngineContextEvent as aO, type EngineBufferChannel as aa, type MetricColumn as ab, type ColumnarGraphSnapshot as ac, type GraphSnapshotInput as ad, type AppendReceipt as ae, type CategoryBin as af, type ClusterSpec as ag, type Column as ah, type ColumnChange as ai, DIAGNOSTIC_SAMPLE_CAP as aj, type DegradeEvent as ak, type DegradeStep as al, type DiagnosticCode as am, type DiagnosticSeverity as an, type DimensionKind as ao, type ErrorPhase as ap, type ExpansionBatch as aq, type ExpansionResponse as ar, type FilterMode as as, type FilterValue as at, type GraphEdge as au, type GraphError as av, type GraphOperationError as aw, type HistogramBin as ax, type IngestCommitReceipt as ay, type IngestSessionState as az, type EngineHostEvents as b, type EngineDiagnostic as c, type GraphDiagnostic as d, type GraphNode as e, type GraphSnapshot as f, type AcceptedEdge as g, type GroupSpec as h, type GroupBySpec as i, type SceneGroups as j, type RenderScene as k, type SceneLinkRef as l, type ScenePointRef as m, type Accessor as n, type RevisionAwareService as o, type RequestContext as p, type SearchResult as q, type SelectionState as r, type SubgraphSpec as s, type EngineFactory as t, type ExpansionService as u, type ScaleLimits as v, type GraphTheme as w, type GraphStoreState as x, type GraphHostUpdate as y, type GraphEventName as z };