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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: publish custom atlas frame counts (#3223)
[._.]/ Adam Eivy3c25893602a6
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex ab90e5046d..86fc0d9a5f 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -48,6 +48,7 @@## Fixed+- **[issue-3223] Published sprite atlases now expose frame counts uniformly for custom animation tracks.** A consuming game can read a user-authored track's declared frame-count field from both the atlas manifest and its layout sidecar, just as it already could for walk, scanner, and ambient tracks; tracks with no known count remain omitted.- **Sprite correction notes are no longer ignored on regenerate.** Typing a correction on a sprite re-roll ("hip bag should be on the other leg") and hitting Regenerate produced a render essentially identical to the one you'd just rejected. The note was being sent — it was losing an argument inside the prompt. Every regenerate prompt spends several sentences pinning the render to the attached reference ("keep accessories on the same anatomical side", "treat the turnaround panels as the source of truth"), and the correction was one trailing sentence asking to change exactly that, phrased as an edit to the *attached* image rather than a fix in the image being produced — so the model sided with the bulk of the prompt. Corrections now frame the render up front, before any preservation rule is read, and close it with an explicit override. Verified on the reported case: the note that had left the sprite unchanged now moves the bag on both samples. A blank note still produces a byte-identical blind regenerate on every surface (turnaround, main, the 7 directional anchors, walk, and every animation track including user-defined ones).- **Sprite reference reopen warnings now name the animations you actually have, instead of assuming a "scanner".** Reopening a locked main reference asked "Reopen the main reference and its south walk/scanner?" — but `scanner` stopped being a built-in some releases ago and is now just a seeded row you can retune or delete like any other animation type. So the warning was wrong in both directions: if you'd deleted the scanner it named an animation you don't have, and if you'd authored your own directional animation it never mentioned the approvals it was about to drop. The main-reference and turnaround warnings now list this character's own directional animation types by name (non-directional ones aren't affected by a reference reopen, so they're correctly left out), falling back to the plain word "animations" when there are none to name. Two toasts were under-reporting the same way: unlocking a single directional anchor only mentioned the walk it reopened, and unlocking the turnaround counted only reopened walks — both now cover every animation type the reopen actually dropped.- **The Chief of Staff 3D avatar no longer sometimes renders as an empty glowing ring.** The Cyber Muse and Mini-Character avatars share one loaded 3D model with the CyberCity player avatar, and letting the 3D engine free that model's data when one avatar left the screen left the next one pointing at freed data — so it drew nothing, leaving just the halo ring behind it (which looked like a lone SVG circle). This happened intermittently after switching avatar styles, changing tabs, or visiting CyberCity. Each avatar now keeps the shared model intact when it unmounts, so it reloads cleanly every time.diff --git a/server/services/sprites/atlas.js b/server/services/sprites/atlas.jsindex 54182ba8da..ee232cbdfb 100644--- a/server/services/sprites/atlas.js+++ b/server/services/sprites/atlas.js@@ -893,8 +893,13 @@ export async function compileAtlasInTail(recordId, {// walk row at the authored speed over the right number of columns.walkFrameCount: validated.walkFrameCount,walkFps: validated.walkFps,- ...(validated.scannerSet ? { scannerFrameCount: validated.scannerFrameCount } : {}),- ...(validated.ambientSet ? { ambientFrameCount: validated.ambientFrameCount } : {}),+ // Match every compiled track to the convenience field its registry row+ // declares. The duplicate walk assignment preserves the existing field+ // position, while seeded scanner/ambient rows keep their wire names.+ ...Object.fromEntries(Object.values(animationTracks).flatMap((definition) => {+ const frameCount = validated.tracks[definition.id]?.frameCount;+ return Number.isInteger(frameCount) ? [[definition.contractFrameCountField, frameCount]] : [];+ })),},directions: rows.map((row) => ({direction: row.direction,diff --git a/server/services/sprites/atlas.test.js b/server/services/sprites/atlas.test.jsindex d9d272e23b..06ed8f683e 100644--- a/server/services/sprites/atlas.test.js+++ b/server/services/sprites/atlas.test.js@@ -433,6 +433,7 @@ describe('compileAtlas', () => {'idle', ...WALK_PHASES, 'jetpack-00', 'jetpack-01', 'jetpack-02',]);expect(manifest.geometry.tracks.jetpack).toEqual({ start: 9, count: 3, rows: 8 });+ expect(manifest.geometry.jetpackFrameCount).toBe(3);expect(manifest.trackSets.jetpack.setSha256).toMatch(/^[0-9a-f]{64}$/);for (const row of manifest.directions) {expect(row.cells.filter((cell) => cell.column.startsWith('jetpack-'))).toHaveLength(3);diff --git a/server/services/sprites/atlasLayout.js b/server/services/sprites/atlasLayout.jsindex 76efb27776..b6071819f2 100644--- a/server/services/sprites/atlasLayout.js+++ b/server/services/sprites/atlasLayout.js@@ -88,7 +88,7 @@ export function layoutSidecarPath(atlasDestPath) {*/export function buildAtlasLayout({characterId, geometry, atlasSha256, version, atlasDestPath,-}) {+}, animationTracks = getEffectiveAnimationTracks()) {const columns = geometry?.columns;if (!Array.isArray(columns) || !columns.length) {throw new Error('Compiled atlas geometry has no column list');@@ -121,8 +121,14 @@ export function buildAtlasLayout({// through `undefined` to re-trigger a default.tracks: deriveTracks(columns, walkFrameCount, geometry.tracks ?? null, rows ?? ATLAS_DEFAULT_ROWS),walkFrameCount,- ...(Number.isInteger(geometry.scannerFrameCount) ? { scannerFrameCount: geometry.scannerFrameCount } : {}),- ...(Number.isInteger(geometry.ambientFrameCount) ? { ambientFrameCount: geometry.ambientFrameCount } : {}),+ // Every track publishes the same top-level convenience field its runtime+ // contract declares. Re-emitting walkFrameCount here leaves its existing+ // key position/null compatibility untouched; seeded scanner/ambient rows+ // likewise retain their historical names and order.+ ...Object.fromEntries(Object.values(animationTracks).flatMap((definition) => {+ const value = geometry[definition.contractFrameCountField];+ return Number.isInteger(value) ? [[definition.contractFrameCountField, value]] : [];+ })),previewFps: Number.isFinite(geometry.walkFps) ? geometry.walkFps : null,previewFpsNote: PREVIEW_FPS_NOTE,};diff --git a/server/services/sprites/atlasLayout.test.js b/server/services/sprites/atlasLayout.test.jsindex f8e24b9f85..9432549c66 100644--- a/server/services/sprites/atlasLayout.test.js+++ b/server/services/sprites/atlasLayout.test.js@@ -5,7 +5,7 @@import { describe, it, expect } from 'vitest';import {- buildAtlasLayout, layoutSidecarPath, runtimeContractMismatch, ATLAS_LAYOUT_SCHEMA_VERSION,+ buildAtlasLayout, layoutSidecarPath, runtimeContractMismatch, ATLAS_LAYOUT_SCHEMA_VERSION, PREVIEW_FPS_NOTE,} from './atlasLayout.js';import { walkPhaseLabels } from './walkBounds.js';// The span math moved to atlasGrid.js (#3016) and is unit-tested there. This@@ -122,6 +122,78 @@ describe('buildAtlasLayout', () => {expect(layout.walkFrameCount).toBe(12);});+ it('publishes every registry track frame count through its declared contract field', () => {+ const animationTracks = {+ walk: ANIMATION_TRACKS.walk,+ jetpack: {+ id: 'jetpack',+ label: 'Jetpack burst',+ contractFrameCountField: 'jetpackFrameCount',+ },+ unknown: {+ id: 'unknown',+ label: 'Unknown action',+ contractFrameCountField: 'unknownFrameCount',+ },+ };+ const layout = buildAtlasLayout({+ characterId: 'example-character',+ geometry: geometryFor(8, {+ columns: ['idle', ...walkPhaseLabels(8), 'jetpack-00', 'jetpack-01', 'jetpack-02'],+ tracks: {+ idle: span(0, 1),+ walk: span(1, 8),+ jetpack: span(9, 3),+ },+ jetpackFrameCount: 3,+ }),+ atlasSha256: 'abc123',+ version: 8,+ atlasDestPath: 'assets/sprites/hero/hero-atlas.png',+ }, animationTracks);++ expect(layout.jetpackFrameCount).toBe(3);+ expect(layout).not.toHaveProperty('unknownFrameCount');+ });++ it('keeps seeded scanner and ambient sidecars byte-identical', () => {+ const geometry = geometryFor(8, {+ scannerFrameCount: 4,+ ambientFrameCount: 3,+ });+ const input = {+ characterId: 'example-character',+ geometry,+ atlasSha256: 'abc123',+ version: 4,+ atlasDestPath: 'assets/sprites/hero/hero-atlas.png',+ };+ const legacy = {+ schemaVersion: ATLAS_LAYOUT_SCHEMA_VERSION,+ kind: 'portos-sprite-atlas-layout',+ characterId: input.characterId,+ atlasFile: 'hero-atlas.png',+ atlasVersion: input.version,+ sourceAtlasSha256: input.atlasSha256,+ cellSize: geometry.cellSize,+ rows: geometry.rows,+ rowOrder: [...geometry.directionOrder],+ columns: [...geometry.columns],+ columnCount: geometry.columns.length,+ tracks: {+ idle: span(0, 1),+ walk: span(1, 8),+ },+ walkFrameCount: geometry.walkFrameCount,+ scannerFrameCount: geometry.scannerFrameCount,+ ambientFrameCount: geometry.ambientFrameCount,+ previewFps: geometry.walkFps,+ previewFpsNote: PREVIEW_FPS_NOTE,+ };++ expect(JSON.stringify(buildAtlasLayout(input))).toBe(JSON.stringify(legacy));+ });+it('refuses a persisted descriptor that contradicts its own column list', () => {// A sidecar whose spans disagree with its columns would silently point a// consumer at the wrong pixels — the exact failure #2982 exists to prevent.