Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-813]): color each beam by its own tier so afterglow keeps its hue

[._.]/ Adam Eivyadea9ea2fcfc
diff --git a/client/src/utils/cityAiCore.js b/client/src/utils/cityAiCore.js
index 2056a54a73..5c1e525bbb 100644
--- a/client/src/utils/cityAiCore.js
+++ b/client/src/utils/cityAiCore.js
@@ -227,7 +227,7 @@ export function computeAiCore(ops, lastStartTs = 0, now = Date.now()) {
// positions — Map<appId, { x, z }> of building world positions (CityScene's layout)
// apps — app records (for workspacePath → app resolution)
// apexY — world Y of the spire apex (beams originate here)
-// color — the core's active-tier color
+// color — fallback color when an op has no tier (e.g. the core's active-tier color)
// now — injected for determinism
//
// Returns up to AI_CORE.maxBeams descriptors. Pure.
@@ -250,6 +250,9 @@ export function computeAiCoreBeams(ops, positions, apps = [], apexY = AI_CORE.ap
const appId = resolveOpAppId(op, apps);
const pos = getPos(appId);
const thickness = beamThickness(op.tokensPerSec);
+ // Color by the op's own tier so a `done` afterglow beam keeps its tier color even when
+ // the core has gone idle (no in-flight op left to set the core color).
+ const beamColor = op.tier ? tierColor(op.tier) : color;
if (pos && Number.isFinite(pos.x) && Number.isFinite(pos.z)) {
// Apex-local target: building roof-ish height so the beam arcs down to the building.
return {
@@ -259,7 +262,7 @@ export function computeAiCoreBeams(ops, positions, apps = [], apexY = AI_CORE.ap
// Vector from the apex (group origin) to the building, in apex-local space.
target: [pos.x, -apexY + 4, pos.z],
thickness,
- color,
+ color: beamColor,
};
}
return {
@@ -268,7 +271,7 @@ export function computeAiCoreBeams(ops, positions, apps = [], apexY = AI_CORE.ap
angle: (i / total) * Math.PI * 2,
length: AI_CORE.radialLength,
thickness,
- color,
+ color: beamColor,
};
});
}
diff --git a/client/src/utils/cityAiCore.test.js b/client/src/utils/cityAiCore.test.js
index a28989a9c9..751621e57a 100644
--- a/client/src/utils/cityAiCore.test.js
+++ b/client/src/utils/cityAiCore.test.js
@@ -9,6 +9,7 @@ import {
beamThickness,
computeAiCoreBeams,
pruneAiOps,
+ tierColor,
} from './cityAiCore';
const NOW = 1_000_000;
@@ -318,6 +319,19 @@ describe('computeAiCoreBeams', () => {
expect(beams).toHaveLength(0);
});
+ it('colors each beam by its own tier, falling back to the passed color when tier is absent', () => {
+ const ops = {
+ a: { id: 'a', appId: 'app-1', tier: 'heavy', ts: NOW },
+ b: { id: 'b', tier: 'light', ts: NOW }, // radial
+ c: { id: 'c', ts: NOW }, // no tier → fallback color
+ };
+ const beams = computeAiCoreBeams(ops, positions, apps, AI_CORE.apexY, '#fallback', NOW);
+ const byKey = Object.fromEntries(beams.map(b => [b.key, b]));
+ expect(byKey.a.color).toBe(tierColor('heavy'));
+ expect(byKey.b.color).toBe(tierColor('light'));
+ expect(byKey.c.color).toBe('#fallback');
+ });
+
it('draws a done afterglow op with its measured thickness, then drops it after afterglowMs', () => {
const ops = { a: { id: 'a', appId: 'app-1', done: true, tokensPerSec: 200, ts: NOW } };
const within = computeAiCoreBeams(ops, positions, apps, AI_CORE.apexY, '#fff', NOW + AI_CORE.afterglowMs - 1);