Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(wiki): every page but the pivot keeps moving, and the map turns half again as fast

Haraldbf9f19b13aad
diff --git a/jarvis/ui/web/frontend/src/components/wiki/WikiGraph3D.tsx b/jarvis/ui/web/frontend/src/components/wiki/WikiGraph3D.tsx
index c52b4abd52..baba778ecc 100644
--- a/jarvis/ui/web/frontend/src/components/wiki/WikiGraph3D.tsx
+++ b/jarvis/ui/web/frontend/src/components/wiki/WikiGraph3D.tsx
@@ -40,7 +40,12 @@ import {
type RenderEdge,
type RenderNode,
} from "@/lib/wikiGraph";
-import { CENTRING_STRENGTH, createCentringForce } from "@/lib/graphForces";
+import {
+ CENTRING_STRENGTH,
+ createCentringForce,
+ createLivelinessForce,
+ type LivelyNode,
+} from "@/lib/graphForces";
import type { Vec3 } from "@/lib/graphCamera";
import { useGraphOrbit, type GraphCameraApi } from "@/hooks/useGraphOrbit";
@@ -183,6 +188,14 @@ export function WikiGraph3D({
useEffect(() => {
forcesConfiguredRef.current = false;
}, [graphData]);
+ const pivotSlugRef = useRef(pivotSlug);
+ pivotSlugRef.current = pivotSlug;
+ const reducedMotion = useMemo(
+ () =>
+ typeof window.matchMedia === "function" &&
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches,
+ [],
+ );
/**
* A third axis does not spread a dense graph on its own — the FORCES have to
@@ -220,8 +233,22 @@ export function WikiGraph3D({
// out of everyone's reach, and `zoomToFit` — which frames every node —
// renders the entire vault as a marble in an empty room.
anyRef.d3Force?.("centreGravity", createCentringForce(CENTRING_STRENGTH));
+ // Every page but the pivot keeps moving on its own — a bob and a small
+ // loop, each with its own rhythm — so the map is not a rigid body turning
+ // (maintainer, 2026-08-18). The pivot is read through a ref at tick time,
+ // so a change of pivot pins the new page without rebuilding the forces.
+ // Left out under prefers-reduced-motion, same as the ambient turn.
+ if (!reducedMotion) {
+ anyRef.d3Force?.(
+ "liveliness",
+ createLivelinessForce({
+ now: () => performance.now(),
+ isPinned: (node: LivelyNode) => node.id === pivotSlugRef.current,
+ }),
+ );
+ }
forcesConfiguredRef.current = true;
- }, []);
+ }, [reducedMotion]);
// Framing and the slow drift are one piece of state, so one hook owns both
// (see hooks/useGraphOrbit.ts). It re-frames whenever this counter changes:
@@ -257,7 +284,10 @@ export function WikiGraph3D({
useEffect(() => {
if (graphData.nodes.length === 0) return;
reframe();
- const timers = [900, 2600, 5000, 8000].map((delay) =>
+ // The last one stands in for the engine-stop re-frame there used to be:
+ // the layout now ticks for good (the pages keep moving), so "settled" is
+ // a matter of time, and by then alpha has long since gone cold.
+ const timers = [900, 2600, 5000, 8000, 12_000].map((delay) =>
window.setTimeout(reframe, delay),
);
return () => timers.forEach(window.clearTimeout);
@@ -408,7 +438,13 @@ export function WikiGraph3D({
// and this app ships in three languages. The switch's own tooltip says
// how to steer instead.
showNavInfo={false}
- cooldownTicks={200}
+ // The engine never stops: the renderer only pushes node and link
+ // positions to the scene while it ticks, and the liveliness force
+ // needs that every frame. The layout itself still cools (alpha decays
+ // as before, and its forces fade with it) — only the life stays on.
+ // Under reduced motion the engine cools down and stops as it used to.
+ cooldownTicks={reducedMotion ? 200 : Infinity}
+ cooldownTime={reducedMotion ? 15_000 : Infinity}
d3VelocityDecay={0.6}
d3AlphaDecay={0.04}
warmupTicks={40}
diff --git a/jarvis/ui/web/frontend/src/hooks/useGraphOrbit.ts b/jarvis/ui/web/frontend/src/hooks/useGraphOrbit.ts
index a0089f9204..25d8b02e7d 100644
--- a/jarvis/ui/web/frontend/src/hooks/useGraphOrbit.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useGraphOrbit.ts
@@ -47,8 +47,11 @@ export interface GraphCameraApi {
camera: () => { position: Vec3; fov?: number; aspect?: number };
}
-/** One full revolution. Long enough to read while it happens. */
-const REVOLUTION_MS = 96_000;
+/**
+ * One full revolution. Half again as fast as the first cut (96 s → 64 s,
+ * maintainer 2026-08-18) — still slow enough to read a label while it moves.
+ */
+const REVOLUTION_MS = 64_000;
/**
* Resting height above the network's own plane, radians.
diff --git a/jarvis/ui/web/frontend/src/lib/graphForces.test.ts b/jarvis/ui/web/frontend/src/lib/graphForces.test.ts
new file mode 100644
index 0000000000..e601a8237f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/lib/graphForces.test.ts
@@ -0,0 +1,83 @@
+/**
+ * The liveliness force: every page but the pivot moves on its own, and the
+ * motion is a bounded, periodic offset on top of the layout — never a drift.
+ */
+import { describe, expect, it } from "vitest";
+
+import {
+ LIVELINESS_AMPLITUDE,
+ LIVELINESS_SWAY,
+ createLivelinessForce,
+ rhythmSeed,
+ type LivelyNode,
+} from "@/lib/graphForces";
+
+function scene(): LivelyNode[] {
+ return [
+ { id: "me", x: 0, y: 0, z: 0 },
+ { id: "projects/nova", x: 80, y: 5, z: -20 },
+ { id: "people/alex", x: -60, y: -10, z: 40 },
+ ];
+}
+
+function run(nodes: LivelyNode[], times: number[]): void {
+ let t = 0;
+ const force = createLivelinessForce({ now: () => t, isPinned: (n) => n.id === "me" });
+ force.initialize(nodes);
+ for (const time of times) {
+ t = time;
+ force(0); // alpha is ignored on purpose
+ }
+}
+
+describe("createLivelinessForce", () => {
+ it("never moves the pivot", () => {
+ const nodes = scene();
+ run(nodes, [0, 300, 900, 1500, 4000, 9000]);
+ expect(nodes[0]).toMatchObject({ x: 0, y: 0, z: 0 });
+ });
+
+ it("moves every other page, each with its own rhythm", () => {
+ const nodes = scene();
+ run(nodes, [0, 700]);
+ const a = nodes[1];
+ const b = nodes[2];
+ expect(a.y).not.toBe(5);
+ expect(b.y).not.toBe(-10);
+ // Different pages, different phase: they are not in step.
+ expect(a.y! - 5).not.toBeCloseTo(b.y! + 10, 3);
+ });
+
+ it("stays a bounded offset on top of the layout — no drift over time", () => {
+ const nodes = scene();
+ const times = Array.from({ length: 400 }, (_, i) => i * 37);
+ run(nodes, times);
+ for (const node of nodes.slice(1)) {
+ const base = node.id === "projects/nova" ? { x: 80, y: 5, z: -20 } : { x: -60, y: -10, z: 40 };
+ expect(Math.abs(node.y! - base.y)).toBeLessThanOrEqual(LIVELINESS_AMPLITUDE + 1e-9);
+ expect(Math.abs(node.x! - base.x)).toBeLessThanOrEqual(LIVELINESS_SWAY + 1e-9);
+ expect(Math.abs(node.z! - base.z)).toBeLessThanOrEqual(LIVELINESS_SWAY + 1e-9);
+ }
+ });
+
+ it("composes with a layout that keeps moving the node underneath", () => {
+ const nodes = scene();
+ let t = 0;
+ const force = createLivelinessForce({ now: () => t, isPinned: () => false });
+ force.initialize(nodes);
+ force(1);
+ // The layout shoves the node 100 units over between ticks…
+ nodes[1].x = (nodes[1].x ?? 0) + 100;
+ t = 500;
+ force(1);
+ // …and the force keeps only its own small offset on top of the new place.
+ expect(Math.abs(nodes[1].x! - 180)).toBeLessThanOrEqual(LIVELINESS_SWAY + 1e-9);
+ });
+
+ it("gives a page the same rhythm every time", () => {
+ expect(rhythmSeed("projects/nova")).toBe(rhythmSeed("projects/nova"));
+ expect(rhythmSeed("projects/nova")).not.toBe(rhythmSeed("people/alex"));
+ expect(rhythmSeed(undefined)).toBeGreaterThanOrEqual(0);
+ expect(rhythmSeed(undefined)).toBeLessThanOrEqual(1);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/lib/graphForces.ts b/jarvis/ui/web/frontend/src/lib/graphForces.ts
index 10125a568b..512245f5c3 100644
--- a/jarvis/ui/web/frontend/src/lib/graphForces.ts
+++ b/jarvis/ui/web/frontend/src/lib/graphForces.ts
@@ -76,3 +76,108 @@ export function createCentringForce(strength: number): CentringForce {
* connected core keeps the spread the repulsion gave it.
*/
export const CENTRING_STRENGTH = 0.04;
+
+// ----------------------------------------------------------------------
+// Liveliness — every page but the pivot keeps moving on its own
+// ----------------------------------------------------------------------
+
+/**
+ * A node the liveliness force can move: the simulation's position, an id to
+ * derive a stable rhythm from, and the private slot where the force keeps
+ * the offset it has currently applied.
+ */
+export interface LivelyNode extends SimNode {
+ id?: string | number;
+ /** The displacement currently applied, so the next tick can replace it. */
+ __lively?: { x: number; y: number; z: number };
+}
+
+export interface LivelinessForce {
+ (alpha: number): void;
+ initialize: (nodes: LivelyNode[]) => void;
+}
+
+export interface LivelinessOptions {
+ /** Milliseconds; injected so the motion is testable without a clock. */
+ now: () => number;
+ /** True for the node that must not move — the pivot the map turns around. */
+ isPinned: (node: LivelyNode) => boolean;
+ /** Peak vertical displacement, graph units. */
+ amplitude?: number;
+ /** Radius of the small horizontal loop each node adds to its bob. */
+ sway?: number;
+ /** Shortest and longest full bob, milliseconds — each node gets its own. */
+ periodMs?: [number, number];
+}
+
+/** Bob height, in graph units. Link distance is 85, a node radius 3–8. */
+export const LIVELINESS_AMPLITUDE = 9;
+/** Radius of the sideways loop. */
+export const LIVELINESS_SWAY = 3;
+/** One full bob takes between these — brisk, and never the same for two pages. */
+export const LIVELINESS_PERIOD_MS: [number, number] = [2_600, 4_600];
+
+/** A small, stable hash of a node id — the same page always gets the same rhythm. */
+export function rhythmSeed(id: string | number | undefined): number {
+ const text = String(id ?? "");
+ let h = 2166136261;
+ for (let i = 0; i < text.length; i++) {
+ h ^= text.charCodeAt(i);
+ h = Math.imul(h, 16777619);
+ }
+ return (h >>> 0) / 4294967295; // 0..1
+}
+
+/**
+ * The motion, on top of whatever the layout does.
+ *
+ * The maintainer's ask (2026-08-18): the pages must not turn as one rigid
+ * body around the pivot — every page but the pivot should move on its own,
+ * up and down, quickly enough not to be boring. So each node gets a bob in
+ * `y` and a small loop in `x`/`z`, with a period and a phase of its own,
+ * derived from its id so a page keeps its rhythm across re-renders and two
+ * neighbours never move in step.
+ *
+ * It is applied as a DELTA: the force remembers the offset it applied last
+ * tick and swaps it for this tick's, so it composes with the layout at any
+ * alpha — while the pages are still flying apart after new data, and once
+ * they have settled and alpha has gone to zero (this force ignores alpha on
+ * purpose; the layout's forces fade out, the life must not). The pivot is
+ * left exactly where the layout puts it, so the point the map turns around
+ * stays a point.
+ */
+export function createLivelinessForce(options: LivelinessOptions): LivelinessForce {
+ const amplitude = options.amplitude ?? LIVELINESS_AMPLITUDE;
+ const sway = options.sway ?? LIVELINESS_SWAY;
+ const [minPeriod, maxPeriod] = options.periodMs ?? LIVELINESS_PERIOD_MS;
+ let nodes: LivelyNode[] = [];
+
+ const force = ((_alpha: number): void => {
+ const t = options.now();
+ for (const node of nodes) {
+ const previous = node.__lively ?? { x: 0, y: 0, z: 0 };
+ let next = { x: 0, y: 0, z: 0 };
+ if (!options.isPinned(node)) {
+ const seed = rhythmSeed(node.id);
+ const period = minPeriod + (maxPeriod - minPeriod) * seed;
+ const phase = seed * Math.PI * 2;
+ const angle = (t / period) * Math.PI * 2 + phase;
+ next = {
+ x: Math.cos(angle * 0.5) * sway,
+ y: Math.sin(angle) * amplitude,
+ z: Math.sin(angle * 0.5) * sway,
+ };
+ }
+ node.x = (node.x ?? 0) + (next.x - previous.x);
+ node.y = (node.y ?? 0) + (next.y - previous.y);
+ node.z = (node.z ?? 0) + (next.z - previous.z);
+ node.__lively = next;
+ }
+ }) as LivelinessForce;
+
+ force.initialize = (next: LivelyNode[]): void => {
+ nodes = next ?? [];
+ };
+
+ return force;
+}