LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-ada
createdAtSep 26, 2026, 12:45 PM
updatedAtSep 26, 2026, 2:50 PM
githubUrlhttps://github.com/neomjs/neo/issues/19261
authorneo-opus-ada
commentsCount0
parentIssue10034
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[x] 252 The Observatory renders through Neo.canvas.GraphScene; its app-local WebGL2 machinery retires
closedAtSep 26, 2026, 2:50 PM

Extract a WebGL2 graph-scene renderer into src/canvas as Neo.canvas.GraphScene

Closed v13.2.0/archive-v13-2-0-chunk-23 enhancementaicore
neo-opus-ada
neo-opus-ada commented on Sep 26, 2026, 12:45 PM

Context

  • The operator's goal. On 2026-09-26 @tobiu asked for the 3D graph inside the Fleet Manager, with follow-ups: gravity wells, filter/highlight one peer's items, highlight the Golden Path, and node details on zoom.
  • The first slice. neomjs/neo-agent-institution#230 (merged 2026-09-26 as neomjs/neo-agent-institution#234) ships the Observatory pane: a WebGL2 scene on the canvas worker.
  • The graduated shape. D#19151 H3-a graduated the engine-native renderer (WebGL2 in the canvas worker; witness at 100k nodes / 1M edges, far 118 · mid 120 · near 116 fps). neomjs/neo-agent-institution#230 names this leaf as the epic's engine half: "the engine src/canvas primitive + CANVAS_EXPECTATIONS", once the slice proves the shape.

The Problem

The Observatory's renderer (apps/agentos/canvas/Observatory.mjs) holds two kinds of code in one class.

Generic WebGL2 graph-scene machinery:

  • the point-and-line program (depth-scaled point size, round points, premultiplied output)
  • VAO / index-buffer upload and dispose
  • a yaw / pitch / distance orbit camera, with fit() to the scene's bounding sphere
  • drag orbits, wheel zooms
  • project() and screen-space pick()
  • frames on demand only (idle draws nothing)
  • getStats()

FM specifics: the palette, currency tones, the singleton, and the scene derived from the Golden Path envelope.

Every follow-up the operator listed needs the generic half: H3-e's LOD over the Brain's scene feed, the team lens (colour and highlight by peer), node selection, gravity wells. Kept in the app, each follow-up extends app code the engine cannot test, and the next app that wants a graph copies it.

One engine gap shows in the slice: SharedCanvas forwards no pixel ratio in the size message, so the Observatory assumes dpr: 2 (its own JSDoc says so). Only Sparkline takes a ratio, through its own data.

The Architectural Reality

  • Neo.canvas.Base already carries the seams.
    • contextType / contextAttributes (#19168 / PR #19169)
    • pointer input: onMouseDown / onMouseUp / onWheel / onMouseClick, and mouse.dx/dy
    • updateSize(size) → updateResources
  • The build contract. buildScripts/util/check-consumer-runtime-build.mjs CANVAS_EXPECTATIONS states what a workspace build's canvas worker must reach. Today that is src/canvas/Header.mjs from the package (#19163 / PR #19165) plus an app-space renderer.
  • Consumption needs a pin bump. Institution pins neo.mjs by commit, so the Observatory can extend an engine class only after a pin bump. That is a second, Institution-side leaf.

The Fix

  1. Add src/canvas/GraphScene.mjs. It extends Neo.canvas.Base with contextType: 'webgl2' and holds the generic half:
    • Scene input: typed arrays — positions: Float32Array (xyz), colors: Float32Array (rgb), sizes: Float32Array, edges: Uint32Array (pairs), paths: Uint32Array[] (line strips such as a route).
    • Behavior: the program, upload / dispose, the orbit camera + fit, drag / wheel, pick, frames on demand, getStats.
    • Style inputs: colors and sizes arrive with the scene, so no palette lives in the engine.
  2. Export the math as pure functions (matrix, project, fit, pick), so unit arms cover them without a GL context.
  3. SharedCanvas forwards devicePixelRatio in its size message, and GraphScene reads it. The assumed ratio retires.
  4. CANVAS_EXPECTATIONS gains a row asserting that a workspace build's canvas worker reaches src/canvas/GraphScene.mjs from the package.
  5. Follow-up (not this ticket): an Institution leaf bumps the pin, and AgentOS.canvas.Observatory extends Neo.canvas.GraphScene, keeping only palette, currency and scene derivation.

Contract Ledger

Target surface Source of authority Proposed behavior Fallback Docs Evidence
Neo.canvas.GraphScene remote setScene({positions, colors, sizes, edges, paths}) this ticket, from the Observatory's shape draws the typed-array scene; a call without positions clears the surface an unsupported WebGL2 host leaves the renderer idle (Base behavior) JSDoc AC-1, AC-2
Neo.canvas.GraphScene remote pick({x, y}) same the nearest node index within the pick radius, or -1 — JSDoc AC-2
Neo.canvas.GraphScene remote getStats() same camera, drawing buffer, the scene's counts, what is uploaded to the GPU (null while nothing is), frames, contextLost, restores — JSDoc AC-1, AC-6
SharedCanvas size message devicePixelRatio this ticket carries the host's ratio; renderers size the drawing buffer by it absent → 1 JSDoc AC-3
CANVAS_EXPECTATIONS the consumer-build contract + a GraphScene.mjs row — inline AC-4

Acceptance Criteria

  • AC-1 GraphScene draws a typed-array scene of points, edges and paths on the canvas worker, drawing frames only on a scene, size, theme or camera change. A canvas e2e reads getStats(): frames > 0 after a scene; stable across an idle second.
  • AC-2 Unit arms for the pure math: matrix/project round-trip; fit frames a bounding sphere; pick returns the nearest in-radius index and -1 outside.
  • AC-3 SharedCanvas forwards devicePixelRatio, and a unit arm pins that the drawing buffer is size × ratio.
  • AC-4 The consumer-build check passes with the new CANVAS_EXPECTATIONS row.
  • AC-5 No palette, currency or product vocabulary exists in src/canvas/GraphScene.mjs.
  • AC-6 A lost WebGL context (WEBGL_lose_context) restores and redraws the current scene, and a resize re-sizes the drawing buffer without dropping the scene. A canvas e2e covers both on the engine example examples/component/graphScene. The Workstation placement this AC first named is under Out of Scope.

Sunset of the app-local renderer

apps/agentos/canvas/Observatory.mjs carries its own copy of this machinery until the Institution imports the primitive. Its retirement is the AC of the twin Institution ticket, filed with this one: pin bump → AgentOS.canvas.Observatory extends Neo.canvas.GraphScene → the duplicated program / camera / pick code deleted from the app. This engine ticket does not close until that twin is filed, so the retirement has a named owner.

Out of Scope

  • The Institution migration: its own leaf, after the pin bump.
  • A graph pane in the Workstation, AC-6's first placement. The Workstation is @neo-fable's surface and is under v13.2 stabilization, so a pane waits for her go (asked 2026-09-26, MESSAGE:73c12ed5). The e2e gains an arm there once the pane lands. WEBGL_lose_context is deterministic, so the restore path needs no app load to be witnessed.
  • LOD over the Brain scene feed (H3-e).
  • Force layout / gravity wells.
  • Labels on the GL surface: they stay in the pane's DOM head, as in the Observatory today.

Decision Record impact

aligned-with D#19151 H3-a (the engine-native renderer). No ADR (neomjs/neo-agent-institution#230's classification: Optional).

Related

  • neomjs/neo#10034 (the epic), neomjs/neo#19151 (H3-a/e/g)
  • neomjs/neo-agent-institution#230 / neomjs/neo-agent-institution#234 (the slice this extracts from)
  • #19168 / PR #19169 and #19173 (the engine seams)
  • #19163 / PR #19165 (the canvas worker loads engine renderers from the package)

Verified on dev a9abb6c1dc before filing: SharedCanvas#updateSize sends {height, width, windowId} and no pixel ratio; Neo.canvas.Base carries contextType / contextAttributes, onMouseDown / onMouseUp / onWheel / onMouseClick and mouse.dx/dy; CANVAS_EXPECTATIONS holds the src/canvas/Header.mjs row; only Sparkline reads a ratio, from its own data; the merged Observatory assumes dpr: 2; the Institution pins neo.mjs by commit.

Live latest-open sweep: the latest 20 open issues of this repository at 2026-09-26T10:39:50Z, plus gh search issues --owner neomjs for "GraphScene" and "canvas webgl2 graph renderer primitive" — no equivalent. A2A in-flight sweep (all read states, last 25): Clio's 09:50Z line assigns this leaf to me ("the engine GraphScene leaf is yours"); no competing claim. Memory Core sweep: Clio's 08:10Z session (the Observatory slice) and the D#19151 cycle — no prior decision against an engine primitive. Own-assignment sweep: none covers it. Structure map: N/A (engine src/canvas; the siblings name the placement).

Origin Session ID: 1b945fcf-1142-475f-8007-ac18d51c069a Retrieval Hint: query_raw_memories("engine GraphScene canvas primitive WebGL2 orbit pick devicePixelRatio Observatory extraction")

tobiu referenced in commit 2965d82 - "feat(canvas): Neo.canvas.GraphScene draws a WebGL2 graph scene on the canvas worker (#19261) (#19274) on Sep 26, 2026, 2:50 PM
tobiu closed this issue on Sep 26, 2026, 2:50 PM