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
address review (claude): defer visibility to the per-panel rules, hedge the diagonals, point diagonals at real panels
[._.]/ Adam Eivy2c6ee15f0bf2
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 8d9b36145c..54a4a21216 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -25,7 +25,7 @@## Sprite Manager-- **[issue-3004] Turnaround sheets stop mirroring the front view, so a front-worn bag no longer ends up on the character's back** — the back panel of a generated turnaround sheet was often just the front figure flipped left-to-right, which meant anything mounted on the *front* of the body (a hip bag worn at the front, a chest pack, a belt buckle) reappeared on the character's back in the rear view, and the same mistake carried into any single rotated view derived from the sheet. The old instruction only pinned accessories to the same anatomical *side* — a rule a mirrored figure satisfies perfectly, because the bug is on the front/back axis, not left/right. Every sprite prompt now states that the panels are one character physically *rotated* about a vertical axis and that no panel may be a flip or copy of another, and each facing carries its own rule for what that angle hides: a rear view hides front-mounted gear (keeping only what genuinely wraps around, like a strap crossing the back) and shows no face or front closures; a front view hides backpacks and back-slung weapons; each profile hides whatever sits on the far side of the torso. The front/back panels also now say where a right-hip item lands on screen once the character turns, so "same side" can't be satisfied by leaving it in the same pixels. The walk-video step is told not to invent gear the anchor hides mid-loop.+- **[issue-3004] Turnaround sheets stop mirroring the front view, so a front-worn bag no longer ends up on the character's back** — the back panel of a generated turnaround sheet was often just the front figure flipped left-to-right, which meant anything mounted on the *front* of the body (a hip bag worn at the front, a chest pack, a belt buckle) reappeared on the character's back in the rear view, and the same mistake carried into any single rotated view derived from the sheet. The old instruction only pinned accessories to the same anatomical *side* — a rule a mirrored figure satisfies perfectly, because the bug is on the front/back axis, not left/right. The sheet prompt now states that the panels are one character physically *rotated* about a vertical axis and that no panel may be a flip or copy of another, each derived view is told it is a rotation rather than a mirrored copy, and every facing carries its own rule for what that angle hides: a rear view hides front-mounted gear (keeping only what genuinely wraps around, like a strap crossing the back) and shows no face or front closures; a front view hides backpacks and back-slung weapons; each profile hides whatever sits on the far side of the torso — hedged for the diagonal views, where a 45-degree turn only partly hides things, so gear doesn't pop in and out as the sprite rotates. The diagonal views are also now told to interpolate between the two sheet panels they sit between, instead of being pointed at a panel the four-panel sheet doesn't have. The front/back panels also now say where a right-hip item lands on screen once the character turns, so "same side" can't be satisfied by leaving it in the same pixels. The walk-video step is told not to invent gear the anchor hides mid-loop.- **[issue-2993] Imported characters can finally be re-derived — smoother walks, and an atlas you can compile here** — a character brought over from a source art pipeline was frozen the moment it arrived: Unlock, Reopen and Compile all refused it outright, so an imported 8-frame walk could never be brought up to 12 and its atlas could only ever be re-published, never rebuilt. That refusal was written when the import genuinely left nothing behind to work from — but the importer now copies each direction's source clip, so it had become a lie. Those actions are now gated on whether the clip is actually there: a direction with its clip on disk reopens and reprocesses at any frame count and speed, with no new render and no new spend, and the buttons appear instead of being hidden. A direction with no clip is still refused, but now says so plainly and tells you to re-import the character. Compiling is likewise per-direction: the atlas names the directions still packaged by the source pipeline instead of refusing the whole set, so an imported character becomes compilable one direction at a time as you re-derive them — and approving a direction whose packaged frames were never imported is now caught up front, rather than surfacing much later as an unexplained compile error.- **[issue-2996] A character you'd started but not locked now begins at the turnaround sheet too** — when turnaround sheets landed, characters already in progress kept the old flow: they'd still ask for a main reference first, and only pick up sheets afterward. Now a character that hasn't frozen anything yet simply starts at step 1 like a new one — nothing of yours is lost, because nothing was locked. Characters that *have* frozen a main reference are untouched: their locked artwork stays exactly as it is, and they still backfill a sheet from it. Uploading a design image is now accepted only on the turnaround step, since that's the render it actually seeds — the main reference and every anchor are drawn from the sheet, so attaching a separate image to them has nowhere to go and is rejected with a clear message.- **[issue-2982] Publishing an atlas your game can't read now stops instead of silently breaking it** — the atlas PNG used to be the *entire* export: nothing described how many walk frames were in it, so a game with an 8-frame walk baked in as a constant would happily accept a 12-frame publish and then draw the wrong frames from the wrong columns forever, with no crash and no log. Two things fix that. A publish target can now declare the grid it was built against (`runtimeContract`: walk frame count, cell size, column count), and a publish whose compiled atlas disagrees is refused with a message naming both numbers — "Atlas has 14 columns (12 walk frames) but Example App expects 10 (8 walk frames)" — plus the two ways to resolve it. And every publish now writes a small `….layout.json` file beside the atlas describing the grid PortOS actually produced: cell size, ordered column names, per-track column spans (so a future multi-frame scanner or ambient action is additive, not a rewrite), row order, and the atlas checksum — so the game can resolve columns by name and verify what it loaded instead of trusting a constant. Targets with no declared contract publish exactly as before. Also documented: playback **fps in PortOS is preview-only**. It ships in the sidecar labeled as authoring metadata, because the consuming game drives its walk from movement distance and has no frame-rate concept at all — a 6 fps preview and a 24 fps preview export byte-identical atlases. See `docs/features/sprite-export-contract.md`.diff --git a/server/services/sprites/prompts.js b/server/services/sprites/prompts.jsindex 9baa7480b0..91daa1f8d3 100644--- a/server/services/sprites/prompts.js+++ b/server/services/sprites/prompts.js@@ -84,31 +84,47 @@ const FRONT_FACING = new Set(['south', 'south-east', 'south-west']);// south is on your right); facing west it is the left side.const RIGHT_SIDE_TO_VIEWER = new Set(['east', 'south-east', 'north-east']);const LEFT_SIDE_TO_VIEWER = new Set(['west', 'south-west', 'north-west']);+// The four 45-degree facings. Occlusion at 45 degrees is partial, not absolute —+// a front hip bag on the near side still peeks past the hip in a three-quarter+// rear view. Telling the model to erase it outright there makes gear pop in and+// out as the sprite rotates through the 8 anchors, so these facings get hedged+// wording while the cardinals keep the absolute form.+const THREE_QUARTER = new Set(['south-east', 'north-east', 'north-west', 'south-west']);/**- * One sentence describing what a given facing occludes — the concrete rule that- * stops the model from mirroring the front view. Exported so the sheet prompt,- * the derive-anchor prompt, and the tests all read from one vocabulary.+ * One or two sentences describing what a given facing occludes — the concrete+ * rule that stops the model from mirroring the front view. Exported so the sheet+ * prompt, the derive-anchor prompt, and the tests all read from one vocabulary.*/export function viewGeometryClause(direction) {+ const partial = THREE_QUARTER.has(direction);const parts = [];if (REAR_FACING.has(direction)) {+ const hidden = partial+ ? 'almost entirely hidden by the body — at most a sliver shows past the near hip, along '+ + 'with the parts that genuinely wrap around, such as a strap crossing the back or the '+ + 'rear of a waist belt'+ : 'hidden by the body and must not be drawn — only the parts that genuinely wrap around, '+ + 'such as a strap crossing the back or the rear of a waist belt, stay visible';parts.push(- `This angle is behind the character: ${FRONT_GEAR} is hidden by the body and must not be `- + 'drawn — only the parts that genuinely wrap around, such as a strap crossing the back or '- + 'the rear of a waist belt, stay visible. Draw the back of the head, hair and garment: no '- + 'face, no eyes, no front closures, buttons, zippers or chest emblems.',+ `This angle is behind the character: ${FRONT_GEAR} is ${hidden}. Draw the back of the head, `+ + 'hair and garment: no face, no eyes, no front closures, buttons, zippers or chest emblems.',);} else if (FRONT_FACING.has(direction)) {- parts.push(`This angle is in front of the character: ${BACK_GEAR} is hidden by the body — at `- + 'most its shoulder straps show over the front.');+ parts.push(`This angle is in front of the character: ${BACK_GEAR} is ${partial+ ? 'mostly hidden by the body — at most its shoulder straps and a sliver past the far '+ + 'shoulder show'+ : 'hidden by the body — at most its shoulder straps show over the front'}.`);}- if (RIGHT_SIDE_TO_VIEWER.has(direction)) {- parts.push('The viewer sees the character\'s right side, so right-side gear reads fully and '- + 'left-side gear is occluded by the torso.');- } else if (LEFT_SIDE_TO_VIEWER.has(direction)) {- parts.push('The viewer sees the character\'s left side, so left-side gear reads fully and '- + 'right-side gear is occluded by the torso.');+ const near = RIGHT_SIDE_TO_VIEWER.has(direction) ? 'right'+ : (LEFT_SIDE_TO_VIEWER.has(direction) ? 'left' : null);+ if (near) {+ const far = near === 'right' ? 'left' : 'right';+ parts.push(partial+ ? `The viewer sees more of the character's ${near} side, so ${near}-side gear reads clearly `+ + `and ${far}-side gear is mostly occluded by the torso.`+ : `The viewer sees the character's ${near} side, so ${near}-side gear reads fully and `+ + `${far}-side gear is occluded by the torso.`);}return parts.join(' ');}@@ -157,15 +173,15 @@ export function buildTurnaroundPrompt({ name, designPrompt, chromaKey }) {+ 'actually exposes, including the parts of the body and gear it hides. '// Left/right axis (unchanged rule) — now paired with the screen-position// consequence, so "same side" can't be satisfied by never moving the item.- // Deliberately phrased as "never moves to the other side" rather than- // "appears in every panel": the per-panel rules below hide far-side gear in- // the profiles, and a blanket "visible in both profiles" would contradict- // them and invite the model to draw a right-hip bag through the torso.+ // This sentence governs WHICH SIDE and WHERE IN FRAME only; whether the item+ // is visible at all is deferred to the per-panel rules. Stating visibility+ // here too would contradict them (a front-worn bag is placed "toward the+ // viewer's right in the back panel" by this rule but erased by Panel 3's).+ 'Every accessory (bag, strap, pouch, pocket, weapon) stays on the SAME anatomical side of '+ 'the body in every panel — an item worn on the character\'s right hip is never moved to '- + 'the left hip. Because the character turns, that item is drawn toward the viewer\'s left in '- + 'the front panel and toward the viewer\'s right in the back panel, and it is visible only '- + 'in the panels where that side of the body faces the viewer. '+ + 'the left hip. Wherever it is visible, the turn shifts it across the frame: toward the '+ + 'viewer\'s left in the front panel, toward the viewer\'s right in the back panel. Whether '+ + 'it is visible at all in a given panel is decided by that panel\'s rule below. '+ `${panelRules} `+ 'Flat non-isometric pixel-art game sprite '+ `reference on a plain exact ${keyColorPhrase(chromaKey)} background. No panel borders, `@@ -177,11 +193,28 @@ export function buildTurnaroundPrompt({ name, designPrompt, chromaKey }) {// Shared preamble for a render seeded from the locked turnaround sheet: the// init image is a multi-figure sheet, so the model must be told to read ONE// panel and emit ONE figure — otherwise it happily returns another sheet.+// The sheet only carries the four cardinal panels, so a three-quarter facing has+// no panel of its own. Naming one anyway ("read the panel that shows a+// three-quarter rear view…") points the model at a panel that isn't there and it+// silently picks one — the invent-the-unseen-side failure the sheet exists to+// prevent. Send those facings to the two cardinals they sit between instead.+const INTERPOLATE_FROM = {+ 'south-east': ['south', 'east'],+ 'north-east': ['north', 'east'],+ 'north-west': ['north', 'west'],+ 'south-west': ['south', 'west'],+};+const fromTurnaroundClause = (direction) => {- const facing = REFERENCE_FACING[direction] || direction;+ const pair = INTERPOLATE_FROM[direction];+ const read = pair+ ? 'The sheet has no panel at this exact angle: read the panels showing the character '+ + `${REFERENCE_FACING[pair[0]]} and ${REFERENCE_FACING[pair[1]]}, and interpolate between `+ + 'them rather than inventing a side the sheet never shows'+ : `Read the panel that shows the character ${REFERENCE_FACING[direction] || direction}`;return (`The attached image is a turnaround model sheet showing the same character from `- + `${TURNAROUND_VIEWS.length} angles. Read the panel that shows the character ${facing}, and `+ + `${TURNAROUND_VIEWS.length} angles. ${read}, and `+ 'take accessory placement (which anatomical side each bag, strap, pouch, or pocket sits on) '+ 'from the panels that show that side. Do not reproduce the sheet layout: return one single '+ 'figure, not multiple figures and not panels. 'diff --git a/server/services/sprites/prompts.test.js b/server/services/sprites/prompts.test.jsindex 0f9771a60f..f18f637c83 100644--- a/server/services/sprites/prompts.test.js+++ b/server/services/sprites/prompts.test.js@@ -119,12 +119,14 @@ describe('buildTurnaroundPrompt (#2979)', () => {// The reported failure: a front-worn hip bag surviving into the back panel.expect(p).toContain('hip bag or pouch worn at the front');expect(p).toContain('hidden by the body and must not be drawn');- // The side rule must not claim far-side gear is visible in BOTH profiles —- // that contradicts the per-panel occlusion rules and invites the model to- // draw a right-hip bag straight through the torso in the west panel.+ // The side rule governs WHICH SIDE and WHERE IN FRAME only. If it also+ // asserted visibility it would contradict the per-panel rules — placing a+ // front-worn bag "toward the viewer's right in the back panel" that Panel 3+ // erases — and the model could resolve that by drawing it through the body.expect(p).not.toContain('in both profiles');- expect(p).toContain('visible only in the panels where that side of the body faces the viewer');+ expect(p).toContain('Whether it is visible at all in a given panel is decided by that panel\'s rule below');TURNAROUND_VIEWS.forEach((view, i) => {+ expect(viewGeometryClause(view), view).not.toBe(''); // toContain('') is vacuously trueexpect(p).toContain(`Panel ${i + 1} (${REFERENCE_FACING[view]}): ${viewGeometryClause(view)}`);});});@@ -143,10 +145,16 @@ describe('viewGeometryClause (#3004)', () => {const c = viewGeometryClause(d);expect(c).toContain('behind the character');expect(c).toContain('hip bag or pouch worn at the front');- expect(c).toContain('must not be drawn');// A mirrored front view keeps the face — say so explicitly.expect(c).toContain('no face');}+ // Absolute only head-on. At 45 degrees a near-hip item still peeks past the+ // hip, so an absolute erase there makes gear pop in and out across anchors.+ expect(viewGeometryClause('north')).toContain('must not be drawn');+ for (const d of ['north-east', 'north-west']) {+ expect(viewGeometryClause(d)).toContain('almost entirely hidden by the body');+ expect(viewGeometryClause(d)).not.toContain('must not be drawn');+ }});it('hides back-mounted gear from every front-ish facing', () => {@@ -158,6 +166,16 @@ describe('viewGeometryClause (#3004)', () => {}});+ it('hedges the far-side occlusion on the diagonals only', () => {+ for (const d of ['east', 'west']) {+ expect(viewGeometryClause(d)).toContain('is occluded by the torso');+ expect(viewGeometryClause(d)).not.toContain('mostly occluded');+ }+ for (const d of ['south-east', 'north-east', 'north-west', 'south-west']) {+ expect(viewGeometryClause(d)).toContain('mostly occluded by the torso');+ }+ });+it('names the near side correctly for each profile', () => {// Facing due east the character looks screen-right, so the viewer stands// off their right shoulder (face east and south is on your right).@@ -197,6 +215,7 @@ describe('derive prompts carry the geometry rule (#3004)', () => {it('keeps the main reference free of back-mounted gear', () => {const p = buildMainReferencePrompt({ name: 'Scout', designPrompt: 'x', chromaKey: '#FF00FF' });+ expect(viewGeometryClause('south')).not.toBe(''); // toContain('') is vacuously trueexpect(p).toContain(viewGeometryClause('south'));});@@ -228,6 +247,24 @@ describe('fromTurnaround prompt variants (#2979)', () => {expect(p.trimEnd().endsWith('satchel on the left hip')).toBe(true);});+ it('sends a diagonal facing to the two panels it sits between (#3004)', () => {+ // The sheet only has the 4 cardinals, so naming "the panel that shows a+ // three-quarter rear view" points the model at a panel that isn't there.+ const p = buildAnchorPrompt({+ name: 'Scout', direction: 'north-east', chromaKey: '#FF00FF', fromTurnaround: true,+ });+ expect(p).toContain('The sheet has no panel at this exact angle');+ expect(p).toContain(REFERENCE_FACING.north);+ expect(p).toContain(REFERENCE_FACING.east);+ expect(p).not.toContain(`Read the panel that shows the character ${REFERENCE_FACING['north-east']}`);+ // A cardinal facing still reads its own single panel.+ const cardinal = buildAnchorPrompt({+ name: 'Scout', direction: 'east', chromaKey: '#FF00FF', fromTurnaround: true,+ });+ expect(cardinal).toContain(`Read the panel that shows the character ${REFERENCE_FACING.east}`);+ expect(cardinal).not.toContain('no panel at this exact angle');+ });+it('is opt-in — the default stays the legacy single-reference copy', () => {const legacy = buildAnchorPrompt({ name: 'Scout', direction: 'east', chromaKey: '#FF00FF' });expect(legacy).not.toContain('turnaround model sheet');