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
feat: add configurable card face orientation
[._.]/ Adam Eivy293048c7cc6e
diff --git a/client/src/components/decks/DeckCardDrawer.jsx b/client/src/components/decks/DeckCardDrawer.jsxindex 58dccf7b5b..b7431d7dc8 100644--- a/client/src/components/decks/DeckCardDrawer.jsx+++ b/client/src/components/decks/DeckCardDrawer.jsx@@ -77,6 +77,7 @@ export default function DeckCardDrawer({ deck, card, open, inFlight, onClose, on</div><PromptPart label="Deck style" hint="from the style guide" value={composed.parts.style} /><PromptPart label="Layout" hint="shared by every card" value={composed.parts.layout} />+ <PromptPart label="Face orientation" hint="shared by every card" value={composed.parts.orientation} /><PromptPart label="Subject" hint="this card" value={composed.parts.subject} /><PromptPart label="Negative" value={composed.negativePrompt} tone="error" /><details>diff --git a/client/src/components/decks/DeckCardDrawer.test.jsx b/client/src/components/decks/DeckCardDrawer.test.jsxindex 27d4d6951a..76c0436ba7 100644--- a/client/src/components/decks/DeckCardDrawer.test.jsx+++ b/client/src/components/decks/DeckCardDrawer.test.jsx@@ -34,9 +34,10 @@ describe('DeckCardDrawer render prompt', () => {renderDrawer();expect(screen.getByText('copperplate engraving')).toBeInTheDocument();expect(screen.getByText('Full tarot card, framed border')).toBeInTheDocument();+ expect(screen.getAllByText(/One-way card face: all rank, suit and title markings/).length).toBeGreaterThan(0);expect(screen.getByText('The Fool: a youth at a cliff edge')).toBeInTheDocument();- expect(screen.getByText('text, blurry')).toBeInTheDocument();- expect(screen.getByText(/copperplate engraving\. Full tarot card, framed border\. The Fool: a youth at a cliff edge/)).toBeInTheDocument();+ expect(screen.getByText('text, upside-down index, rotated bottom-right rank, inverted duplicate, mirrored lettering, blurry')).toBeInTheDocument();+ expect(screen.getByText(new RegExp(`copperplate engraving\\. Full tarot card, framed border\\. One-way card face:.*The Fool: a youth at a cliff edge`))).toBeInTheDocument();});it('still names a clause the deck has not filled in', () => {@@ -84,4 +85,3 @@ describe('DeckCardDrawer render prompt', () => {});});});-diff --git a/client/src/components/decks/DeckStylePanel.jsx b/client/src/components/decks/DeckStylePanel.jsxindex a1ccdc0bdf..61e9de3428 100644--- a/client/src/components/decks/DeckStylePanel.jsx+++ b/client/src/components/decks/DeckStylePanel.jsx@@ -3,7 +3,10 @@ import { ImagePlus, Trash2 } from 'lucide-react';import InfluenceChipsInput from '../universeBuilder/InfluenceChipsInput';import DeckSampleModal from './DeckSampleModal';import useFieldDraft from '../../hooks/useFieldDraft';-import { DECK_KIND_LABELS, deckCardAspectStyle } from '../../lib/decks';+import {+ DECK_CARD_ORIENTATION, DECK_CARD_ORIENTATION_LABELS, DECK_CARD_ORIENTATIONS, DECK_KIND_LABELS,+ DEFAULT_DECK_CARD_ORIENTATION, deckCardAspectStyle, defaultDeckCardOrientationPrompt,+} from '../../lib/decks';const INPUT_CLASS = 'w-full bg-port-bg border border-port-border rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-port-accent';@@ -17,6 +20,12 @@ export default function DeckStylePanel({ deck, universes, onPatch, onDeckReplaceconst description = useFieldDraft(deck.description, (v) => onPatch({ description: v }));const styleNotes = useFieldDraft(deck.styleNotes, (v) => onPatch({ styleNotes: v }));const layoutPrompt = useFieldDraft(deck.layoutPrompt, (v) => onPatch({ layoutPrompt: v }));+ const orientation = deck.cardOrientation || DEFAULT_DECK_CARD_ORIENTATION[deck.kind] || DECK_CARD_ORIENTATIONS[0];+ const builtInOrientationPrompt = defaultDeckCardOrientationPrompt({ ...deck, cardOrientation: orientation, cardOrientationPrompt: null });+ const orientationPrompt = useFieldDraft(+ deck.cardOrientationPrompt || builtInOrientationPrompt,+ (value) => onPatch({ cardOrientationPrompt: value.trim() === builtInOrientationPrompt ? null : (value.trim() || null) }),+ );const influences = deck.influences || { embrace: [], avoid: [] };const samples = Array.isArray(deck.samples) ? deck.samples : [];@@ -57,6 +66,45 @@ export default function DeckStylePanel({ deck, universes, onPatch, onDeckReplace<textarea id="deck-layout-prompt" rows={3} value={layoutPrompt.value} onChange={layoutPrompt.onChange} onBlur={layoutPrompt.onBlur} className={INPUT_CLASS} /><p className="text-[11px] text-gray-500 mt-1">Sits between the style prompt and each card's subject so every card shares one border, index and title treatment.</p></div>+ <div>+ <label htmlFor="deck-card-orientation" className="block text-xs text-gray-400 mb-1">Card face orientation</label>+ <select+ id="deck-card-orientation"+ value={orientation}+ onChange={(e) => onPatch({ cardOrientation: e.target.value })}+ className={INPUT_CLASS}+ >+ {DECK_CARD_ORIENTATIONS.map((value) => <option key={value} value={value}>{DECK_CARD_ORIENTATION_LABELS[value]}</option>)}+ </select>+ <p className="text-[11px] text-gray-500 mt-1">+ {orientation === DECK_CARD_ORIENTATION.STANDARD+ ? 'The top-left index is upright and the matching bottom-right index is rotated 180°, so a 6 stays a 6 when the card is turned over.'+ : 'All indices and titles face one direction; the bottom-right copy is not rotated.'}+ </p>+ </div>+ <div>+ <div className="flex items-start justify-between gap-2 mb-1 flex-wrap">+ <label htmlFor="deck-card-orientation-prompt" className="block text-xs text-gray-400">Face-orientation prompt (built-in, overridable)</label>+ {deck.cardOrientationPrompt ? (+ <button+ type="button"+ onClick={() => { orientationPrompt.reset(); onPatch({ cardOrientationPrompt: null }); }}+ className="min-h-[32px] shrink-0 rounded px-2 text-[11px] text-gray-400 hover:bg-white/5 hover:text-white"+ >+ Use built-in+ </button>+ ) : null}+ </div>+ <textarea+ id="deck-card-orientation-prompt"+ rows={4}+ value={orientationPrompt.value}+ onChange={orientationPrompt.onChange}+ onBlur={orientationPrompt.onBlur}+ className={INPUT_CLASS}+ />+ <p className="text-[11px] text-gray-500 mt-1">This guard is added to every card render after the shared layout. Leave the built-in wording in place unless this deck needs a different physical reading convention.</p>+ </div><div><label htmlFor="deck-universe" className="block text-xs text-gray-400 mb-1">Universe</label><select id="deck-universe" value={deck.universeId || ''} onChange={(e) => onPatch({ universeId: e.target.value || null })} className={INPUT_CLASS}>diff --git a/client/src/components/decks/DeckStylePanel.test.jsx b/client/src/components/decks/DeckStylePanel.test.jsxnew file mode 100644index 0000000000..0d4c4e2d6d--- /dev/null+++ b/client/src/components/decks/DeckStylePanel.test.jsx@@ -0,0 +1,59 @@+import { describe, it, expect, vi } from 'vitest';+import { render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import DeckStylePanel from './DeckStylePanel';++vi.mock('./DeckSampleModal', () => ({ default: () => null }));+vi.mock('../universeBuilder/InfluenceChipsInput', () => ({+ default: ({ tokens = [] }) => <div>{tokens.join(', ')}</div>,+}));++const deck = {+ id: 'd1',+ kind: 'playing',+ description: '',+ styleNotes: '',+ layoutPrompt: 'Complete playing card',+ cardOrientation: 'standard',+ cardOrientationPrompt: null,+ influences: { embrace: [], avoid: [] },+ samples: [],+ universeId: null,+ cardSize: { width: 1096, height: 1536 },+};++const renderPanel = (over = {}) => {+ const props = {+ deck: { ...deck, ...over },+ universes: [],+ onPatch: vi.fn(),+ onDeckReplaced: vi.fn(),+ onRemoveSample: vi.fn(),+ };+ render(<DeckStylePanel {...props} />);+ return props;+};++describe('DeckStylePanel face orientation', () => {+ it('shows the standard two-way guard and persists a changed orientation', async () => {+ const user = userEvent.setup();+ const { onPatch } = renderPanel();++ expect(screen.getByRole('combobox', { name: 'Card face orientation' })).toHaveValue('standard');+ expect(screen.getByDisplayValue(/Standard two-way playing-card face/)).toBeInTheDocument();+ expect(screen.getByText(/bottom-right index is rotated 180°/)).toBeInTheDocument();++ await user.selectOptions(screen.getByRole('combobox', { name: 'Card face orientation' }), 'one-way');+ expect(onPatch).toHaveBeenCalledWith({ cardOrientation: 'one-way' });+ });++ it('lets an authored orientation prompt be edited or restored to the built-in wording', async () => {+ const user = userEvent.setup();+ const { onPatch } = renderPanel({ cardOrientationPrompt: 'Use a custom diagonal index treatment' });+ const prompt = screen.getByLabelText('Face-orientation prompt (built-in, overridable)');++ expect(prompt).toHaveValue('Use a custom diagonal index treatment');+ await user.click(screen.getByRole('button', { name: 'Use built-in' }));+ expect(onPatch).toHaveBeenCalledWith({ cardOrientationPrompt: null });+ });+});diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex 82959e39c1..5a6fb4f011 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -90,7 +90,7 @@ grep -i "what you want to do" client/src/lib/README.md| `wrImageDefaults.js` | Writers Room per-scene image-gen defaults + style discriminators. || `imageGenBackends.js` | Icon metadata, `deriveAvailableBackends`, and `imageGenReadiness(status)` — a compatibility-safe `ready` / `unavailable` / `unknown` read of image-gen status responses; re-exports everything from `imageGenModes.js` so consumers keep one import site. || `imageGenModes.js` | Node-safe image/video backend constants + pure helpers. Re-exports the backend / render-target / lane alphabets from the server leaves `server/lib/generationModes.js` + `server/lib/renderTargets.js` (see its header for why nothing is copied); adds the Settings rows (`RENDER_TARGET_OPTIONS`), `applyRecordRenderPin` (fold a record's `imageMode`/`imageModelId` pin over a settings-derived cfg), `isCloudCliMode`/`isCloudVideoMode`, `modeLabel`, `mediaJobLane` (a projected media job's scheduler lane, re-derived for responses predating the server's `executionLane` field), and the cloud/model-override/i2i capability mirrors of the server service specs. Imported by the server-side parity suite — must stay importable without client packages. |-| `decks.js` | Deck alphabet, card roster/status/completion rules, render-prompt composition, and `deckCardSize` / `deckCardAspectStyle` (thumbnail box from the deck's trim) — re-exported from `server/lib/deckTemplates.js` (one definition, no client copy). |+| `decks.js` | Deck alphabet, card roster/status/completion rules, face-orientation defaults/prompts, render-prompt composition, and `deckCardSize` / `deckCardAspectStyle` (thumbnail box from the deck's trim) — re-exported from `server/lib/deckTemplates.js` (one definition, no client copy). || `imageGenDefaults.js` | Shared `DEFAULT_NEGATIVE_PROMPT` used by the Image Gen form and quick-submit entry points. Mirrors server-side default. || `imageGenResolutions.js` | Shared resolution presets for image generation. || `imageTo3dReasons.js` | Client mirror of the image-to-3D unavailable-reason labels in `server/services/imageTo3d/targets.js`: `UNAVAILABLE_REASONS` (reason code → user-facing label), `UNAVAILABLE_REASON_FALLBACK`, and `unavailableReasonLabel(code, fallback?)`, plus `isTargetReady(target)` — the shared readiness predicate (`installed` is tri-state: `null` = a hosted lane with no install concept, ready as soon as it is available). Use these anywhere a target's `unavailableReason` or readiness is rendered — never re-declare the codes or re-derive readiness from `target.installed` truthiness. Parity + code coverage enforced by `server/services/imageTo3d/unavailableReasons.parity.test.js`. |diff --git a/client/src/lib/decks.js b/client/src/lib/decks.jsindex c462f4ba6f..283da90e96 100644--- a/client/src/lib/decks.js+++ b/client/src/lib/decks.js@@ -4,6 +4,9 @@export {CARD_STATUS,DECK_BACK_KEY,+ DECK_CARD_ORIENTATION,+ DECK_CARD_ORIENTATIONS,+ DECK_CARD_ORIENTATION_LABELS,DECK_CARD_SIZE,DECK_CARD_SIZE_BY_KIND,DECK_CARD_SIZE_MAX,@@ -11,10 +14,15 @@ export {DECK_KIND,DECK_KINDS,DECK_KIND_LABELS,+ DEFAULT_DECK_CARD_ORIENTATION,DEFAULT_LAYOUT_PROMPT,cardInFlightJobId,cardStatus,composeCardRenderPrompt,+ defaultDeckCardOrientationPrompt,+ deckCardOrientation,+ deckCardOrientationNegativePrompt,+ deckCardOrientationPrompt,deckCardAspectStyle,deckCardSize,deckCompletion,diff --git a/client/src/pages/DeckDetail.preview.test.jsx b/client/src/pages/DeckDetail.preview.test.jsxindex 733e9ded27..17081d7675 100644--- a/client/src/pages/DeckDetail.preview.test.jsx+++ b/client/src/pages/DeckDetail.preview.test.jsx@@ -39,7 +39,7 @@ vi.mock('../hooks/useDeckRenderTarget', () => ({default: () => ({ summary: 'Local · flux2 · 1096×1536', blocked: false, mode: 'local', options: [] }),}));-const COMPOSED = 'copperplate engraving. Full tarot card, framed border. The Fool: a youth at a cliff edge';+const COMPOSED = 'copperplate engraving. Full tarot card, framed border. One-way card face: all rank, suit and title markings share one upright reading direction; the top-left and bottom-right indices face the same way, with no 180-degree rotation or inverted duplicate. The Fool: a youth at a cliff edge';const deck = {id: 'd1',@@ -114,7 +114,7 @@ describe('DeckDetail preview items', () => {await waitFor(() => expect(getGalleryImages).toHaveBeenCalled());await waitFor(() => {expect(previewProps?.preview?.prompt).toBe(COMPOSED);- expect(previewProps?.preview?.negativePrompt).toBe('blurry');+ expect(previewProps?.preview?.negativePrompt).toBe('upside-down index, rotated bottom-right rank, inverted duplicate, mirrored lettering, blurry');});});});diff --git a/server/lib/README.md b/server/lib/README.mdindex 2bafbd766b..24334efd01 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -711,7 +711,7 @@ pm` default, `NPM_CONFIG_PREFIX`, nvm/Volta) installed `codex` successfully and| `auditQuality.js` | Category discovery strategies, assessment prompt and strict schema, sentinel parsing, and freshness-aware app quality aggregation with deterministic latest-per-category selection across peers. || `mindToolRecipes.js` | Closed recipe schemas, current semantic-contract validation, and safe JSON field binding resolution. |-| `deckTemplates.js` | Decks (playing cards / tarot): kind alphabet, per-kind card roster (`deckCardRoster`), shared layout clause, render prompt composition (`composeCardRenderPrompt`), per-card status and `deckCompletion`, plus `deckCardSize` / `deckCardAspectStyle` (persisted trim → thumbnail box). Pure — re-exported by `client/src/lib/decks.js`. |+| `deckTemplates.js` | Decks (playing cards / tarot): kind alphabet, per-kind card roster (`deckCardRoster`), shared layout and face-orientation prompts (`deckCardOrientationPrompt`), render prompt composition (`composeCardRenderPrompt`), per-card status and `deckCompletion`, plus `deckCardSize` / `deckCardAspectStyle` (persisted trim → thumbnail box). Pure — re-exported by `client/src/lib/decks.js`. || `deckValidation.js` | Zod schemas + limits for the `/api/decks` routes (create/update deck, card patch, sample analysis, prompt generation, render). || `kilo.js` | Kilo Code command identity (`kilo`/`kilocode`), `run` headless argv, `--auto` approval posture, and TUI arguments. || `openchamber.js` | OpenChamber control-CLI identity, `session create` headless argv, `provider/model` gate, and `--dir`/`--prompt` spawn-time delivery. |diff --git a/server/lib/deckTemplates.js b/server/lib/deckTemplates.jsindex 2a9d253932..0352adad21 100644--- a/server/lib/deckTemplates.js+++ b/server/lib/deckTemplates.js@@ -2,9 +2,10 @@* Decks — the pure, dependency-free half of the card-deck designer.** Owns the deck alphabet (`playing` | `tarot`), the card roster each kind- * mints on creation, the layout clause each kind renders with, the render- * prompt composition (deck style → layout → card subject), and the completion- * math the index page and the detail header both show. Keeping this leaf+ * mints on creation, the layout clause and face-orientation prompt each kind+ * renders with, the render prompt composition (deck style → layout → face+ * orientation → card subject), and the completion math the index page and the+ * detail header both show. Keeping this leaf* import-free lets `client/src/lib/decks.js` re-export it verbatim, so the* client never carries a second copy of the roster or the completion rule.*@@ -24,6 +25,63 @@ export const DECK_KIND_LABELS = Object.freeze({[DECK_KIND.TAROT]: 'Tarot',});+const trimmed = (v) => (typeof v === 'string' ? v.trim() : '');++// Face orientation is a deck-wide property because every card in a physical+// deck must agree on how its indices read. Playing cards default to the+// conventional two-way face; tarot defaults to one-way because its title and+// illustration are normally read from one direction.+export const DECK_CARD_ORIENTATION = Object.freeze({+ STANDARD: 'standard',+ ONE_WAY: 'one-way',+});+export const DECK_CARD_ORIENTATIONS = Object.freeze(Object.values(DECK_CARD_ORIENTATION));+export const DECK_CARD_ORIENTATION_LABELS = Object.freeze({+ [DECK_CARD_ORIENTATION.STANDARD]: 'Standard two-way (mirrored indices)',+ [DECK_CARD_ORIENTATION.ONE_WAY]: 'One-way (upright indices)',+});+export const DEFAULT_DECK_CARD_ORIENTATION = Object.freeze({+ [DECK_KIND.PLAYING]: DECK_CARD_ORIENTATION.STANDARD,+ [DECK_KIND.TAROT]: DECK_CARD_ORIENTATION.ONE_WAY,+});++// These are intentionally explicit rather than relying on a model to infer+// what "symmetrical" means. In particular, a bottom-right upright 6 is easily+// read as a 9 after the physical card is turned around.+const BUILT_IN_CARD_ORIENTATION_PROMPTS = Object.freeze({+ [DECK_CARD_ORIENTATION.STANDARD]: 'Standard two-way playing-card face, vertically mirrored: the top-left rank and suit index is upright, while the matching bottom-right index is an exact 180-degree rotation and reads upside down from the top edge; the two indices must be the same glyph and rank, so a six remains a six and never becomes a nine',+ [DECK_CARD_ORIENTATION.ONE_WAY]: 'One-way card face: all rank, suit and title markings share one upright reading direction; the top-left and bottom-right indices face the same way, with no 180-degree rotation or inverted duplicate',+});+const BUILT_IN_CARD_ORIENTATION_NEGATIVES = Object.freeze({+ [DECK_CARD_ORIENTATION.STANDARD]: 'upright duplicate bottom-right index, mismatched rank indices, six rendered as nine, incorrect glyph rotation',+ [DECK_CARD_ORIENTATION.ONE_WAY]: 'upside-down index, rotated bottom-right rank, inverted duplicate, mirrored lettering',+});++/** The effective face orientation, or null for a non-deck-shaped prompt input. */+export function deckCardOrientation(deck) {+ if (DECK_CARD_ORIENTATIONS.includes(deck?.cardOrientation)) return deck.cardOrientation;+ return DEFAULT_DECK_CARD_ORIENTATION[deck?.kind] || null;+}++/** The built-in orientation prompt, ignoring a deck's authored override. */+export function defaultDeckCardOrientationPrompt(deck) {+ const orientation = deckCardOrientation(deck);+ return orientation ? BUILT_IN_CARD_ORIENTATION_PROMPTS[orientation] : '';+}++/** The effective orientation prompt: an authored override or the safe default. */+export function deckCardOrientationPrompt(deck) {+ const override = trimmed(deck?.cardOrientationPrompt);+ return override || defaultDeckCardOrientationPrompt(deck);+}++/** The matching built-in negative guard; custom positive prompts own their negatives. */+export function deckCardOrientationNegativePrompt(deck) {+ if (trimmed(deck?.cardOrientationPrompt)) return '';+ const orientation = deckCardOrientation(deck);+ return orientation ? BUILT_IN_CARD_ORIENTATION_NEGATIVES[orientation] : '';+}+// Fallback portrait size for an unrecognized deck kind (2:3, matching the// universe canon thumbnail convention `EntryThumbSlot` was built around).// Real decks use `DECK_CARD_SIZE_BY_KIND` below instead.@@ -95,7 +153,7 @@ export const CARD_STATUS = Object.freeze({// canvas disagreed about the shape being drawn. Deriving means changing a// canvas changes the sentence, and the two cannot drift apart again.const layoutClauseFor = {- [DECK_KIND.PLAYING]: (framing) => `Complete playing-card face, ${framing}, ornate decorative border, the rank and suit index drawn in the top-left and bottom-right corners, symmetrical composition`,+ [DECK_KIND.PLAYING]: (framing) => `Complete playing-card face, ${framing}, ornate decorative border, the rank and suit index placed in the top-left and bottom-right corners, symmetrical composition`,[DECK_KIND.TAROT]: (framing) => `Complete tarot card, ${framing}, decorative framed border, the card title lettered in a banner along the bottom edge, symbolic centered composition`,};@@ -235,8 +293,6 @@ export function deckCardRoster(kind) {throw new Error(`Unknown deck kind: ${kind}`);}-const trimmed = (v) => (typeof v === 'string' ? v.trim() : '');-/*** Compose the prompt one card renders with. Order is deliberate: the deck's* embrace influences lead (diffusion models weight early tokens heaviest),@@ -255,10 +311,13 @@ export function composeCardRenderPrompt(deck, card) {const style = buildVisualStyleClause(deck);const avoid = universeVisualStyleTokens(deck).avoid.join(', ');const layout = trimmed(deck?.layoutPrompt);+ const orientation = deckCardOrientationPrompt(deck);+ const orientationNegative = deckCardOrientationNegativePrompt(deck);const subject = [trimmed(card?.name), trimmed(card?.prompt)].filter(Boolean).join(': ');- const body = [layout, subject].filter(Boolean).join('. ');- const composed = composeStyledPrompt(body, trimmed(card?.negativePrompt), { prompt: style, negativePrompt: avoid });- return { ...composed, parts: { style, layout, subject } };+ const body = [layout, orientation, subject].filter(Boolean).join('. ');+ const cardNegative = [trimmed(card?.negativePrompt), orientationNegative].filter(Boolean).join(', ');+ const composed = composeStyledPrompt(body, cardNegative, { prompt: style, negativePrompt: avoid });+ return { ...composed, parts: { style, layout, orientation, subject } };}const IN_FLIGHT_RENDER = new Set(['queued', 'running']);diff --git a/server/lib/deckTemplates.test.js b/server/lib/deckTemplates.test.jsindex b76605cf42..08a53ee309 100644--- a/server/lib/deckTemplates.test.js+++ b/server/lib/deckTemplates.test.js@@ -1,7 +1,8 @@import { describe, it, expect } from 'vitest';import {- CARD_STATUS, DECK_BACK_KEY, DECK_CARD_SIZE, DECK_CARD_SIZE_BY_KIND, DECK_KIND, DECK_KINDS, DEFAULT_LAYOUT_PROMPT,- cardStatus, composeCardRenderPrompt, deckCardAspectStyle, deckCardRoster, deckCardSize, deckCompletion,+ CARD_STATUS, DECK_BACK_KEY, DECK_CARD_ORIENTATION, DECK_CARD_SIZE, DECK_CARD_SIZE_BY_KIND, DECK_KIND, DECK_KINDS,+ DEFAULT_LAYOUT_PROMPT, cardStatus, composeCardRenderPrompt, deckCardAspectStyle, deckCardRoster, deckCardSize,+ deckCompletion, defaultDeckCardOrientationPrompt,} from './deckTemplates.js';import { aspectRatioPhrase } from './aspectRatio.js';@@ -45,7 +46,7 @@ describe('composeCardRenderPrompt', () => {const out = composeCardRenderPrompt({}, { name: 'Ace of Spades', prompt: 'one large ornate spade' });expect(out.prompt).toBe('Ace of Spades: one large ornate spade');expect(out.negativePrompt).toBe('');- expect(out.parts).toEqual({ style: '', layout: '', subject: 'Ace of Spades: one large ornate spade' });+ expect(out.parts).toEqual({ style: '', layout: '', orientation: '', subject: 'Ace of Spades: one large ornate spade' });});it('reports each contribution unjoined so the editor can attribute it', () => {@@ -53,9 +54,38 @@ describe('composeCardRenderPrompt', () => {expect(out.parts).toEqual({style: 'copperplate engraving, aged paper',layout: 'Full tarot card, framed border',+ orientation: '',subject: 'XVII · The Star: a kneeling figure',});});++ it('spells out the standard two-way rotation so a six cannot become a nine', () => {+ const out = composeCardRenderPrompt(+ { kind: DECK_KIND.PLAYING, layoutPrompt: 'Complete card' },+ { name: 'Six of Hearts', prompt: 'six heart pips' },+ );+ expect(out.prompt).toContain('bottom-right index is an exact 180-degree rotation');+ expect(out.prompt).toContain('a six remains a six and never becomes a nine');+ expect(out.negativePrompt).toContain('six rendered as nine');+ expect(out.parts.orientation).toBe(defaultDeckCardOrientationPrompt({ kind: DECK_KIND.PLAYING }));+ });++ it('supports one-way faces and a true authored prompt override', () => {+ const oneWay = composeCardRenderPrompt(+ { kind: DECK_KIND.PLAYING, cardOrientation: DECK_CARD_ORIENTATION.ONE_WAY },+ { name: 'Six of Hearts', prompt: 'six heart pips' },+ );+ expect(oneWay.prompt).toContain('all rank, suit and title markings share one upright reading direction');+ expect(oneWay.prompt).not.toContain('exact 180-degree rotation');++ const custom = composeCardRenderPrompt(+ { kind: DECK_KIND.PLAYING, cardOrientation: DECK_CARD_ORIENTATION.STANDARD, cardOrientationPrompt: 'Use a custom diagonal index treatment' },+ { name: 'Six of Hearts', prompt: 'six heart pips' },+ );+ expect(custom.prompt).toContain('Use a custom diagonal index treatment');+ expect(custom.prompt).not.toContain('a six remains a six and never becomes a nine');+ expect(custom.negativePrompt).toBe('');+ });});describe('cardStatus + deckCompletion', () => {diff --git a/server/lib/deckValidation.js b/server/lib/deckValidation.jsindex e5ae915ab0..cdf2e0d28b 100644--- a/server/lib/deckValidation.js+++ b/server/lib/deckValidation.js@@ -5,7 +5,9 @@*/import { z } from 'zod';-import { DECK_CARD_SIZE_MAX, DECK_CARD_SIZE_MIN, DECK_KINDS } from './deckTemplates.js';+import {+ DECK_CARD_ORIENTATIONS, DECK_CARD_SIZE_MAX, DECK_CARD_SIZE_MIN, DECK_KINDS,+} from './deckTemplates.js';import { llmRoutePinSchema } from './llmRoutePin.js';import { INFLUENCE_ENTRY_MAX, INFLUENCES_PER_LIST_MAX, STYLE_NOTES_MAX } from './universeBibleLimits.js';@@ -52,6 +54,10 @@ export const deckUpdateSchema = z.object({styleNotes: z.string().trim().max(STYLE_NOTES_MAX).optional(),influences: influencesSchema.optional(),layoutPrompt: z.string().trim().max(DECK_LAYOUT_PROMPT_MAX).optional(),+ cardOrientation: z.enum(DECK_CARD_ORIENTATIONS).optional(),+ // Null clears the authored override and returns to the built-in prompt for+ // the selected orientation.+ cardOrientationPrompt: z.string().trim().max(DECK_LAYOUT_PROMPT_MAX).nullable().optional(),universeId: idField.nullable().optional(),// Per-record render pin (#3231 Phase 3 shape): null clears.imageMode: z.string().trim().max(40).nullable().optional(),diff --git a/server/lib/schemaVersions.js b/server/lib/schemaVersions.jsindex 00bf3dedb1..7bed4bb352 100644--- a/server/lib/schemaVersions.js+++ b/server/lib/schemaVersions.js@@ -241,10 +241,11 @@ export const PORTOS_SCHEMA_VERSIONS = Object.freeze({// on `decks` and gets a 409 — only the decks category pauses, every other// category keeps flowing. A v1 receiver still accepts a ≤v0 sender// (sender-behind): pre-feature peers never push a `deck` record at all. The- // FIRST incompatible deck/card-shape change MUST bump this to 2 (where a v1- // peer would round-trip the new shape through an unaware sanitizer and LWW- // the strip back onto the newer peer).- decks: 1,+ // v2 = deck-level `cardOrientation` + optional `cardOrientationPrompt`.+ // A v1 peer would round-trip the deck through an unaware projection and+ // silently strip a user's face-orientation choice, so only the decks+ // category pauses until that peer upgrades.+ decks: 2,// v1 = author personas (PostgreSQL `authors` table) federated via the// per-record peer-sync push pipeline (record kind `author`, sync category// `authors`). A brand-NEW synced record type like `storyBuilder` below, so itdiff --git a/server/routes/decks.db.test.js b/server/routes/decks.db.test.jsindex 7502b1b9e3..c095b91c1f 100644--- a/server/routes/decks.db.test.js+++ b/server/routes/decks.db.test.js@@ -39,6 +39,8 @@ describe.skipIf(!ready)('decks over HTTP and PostgreSQL', () => {const deck = await create({ name: 'Example Deck', kind: 'tarot' });expect(deck.cards).toHaveLength(79);expect(deck.layoutPrompt).toMatch(/tarot card/);+ expect(deck.cardOrientation).toBe('one-way');+ expect(deck.cardOrientationPrompt).toBeNull();expect(deck.completion).toMatchObject({ total: 79, prompted: 0, rendered: 0, percent: 0 });const fool = deck.cards.find((c) => c.key === 'major-0');expect(fool).toMatchObject({ name: '0 · The Fool', imageRefs: [] });@@ -61,6 +63,8 @@ describe.skipIf(!ready)('decks over HTTP and PostgreSQL', () => {styleNotes: 'Engraved, sepia, celestial.',influences: { embrace: ['copperplate engraving', ' aged paper '], avoid: ['blurry'] },layoutPrompt: 'Full playing card',+ cardOrientation: 'one-way',+ cardOrientationPrompt: 'Keep both indices upright in this custom deck',imageMode: 'codex',imageModelId: 'gpt-image-2',promptLlm: { providerId: 'p1', model: 'm1', effort: 'high' },@@ -70,12 +74,15 @@ describe.skipIf(!ready)('decks over HTTP and PostgreSQL', () => {styleNotes: 'Engraved, sepia, celestial.',influences: { embrace: ['copperplate engraving', 'aged paper'], avoid: ['blurry'] },layoutPrompt: 'Full playing card',+ cardOrientation: 'one-way',+ cardOrientationPrompt: 'Keep both indices upright in this custom deck',imageMode: 'codex',imageModelId: 'gpt-image-2',promptLlm: { providerId: 'p1', model: 'm1', effort: 'high' },});// Clearing the pin: key present with null.expect((await patch(`/${deck.id}`, { imageMode: null, imageModelId: null })).body).toMatchObject({ imageMode: null, imageModelId: null });+ expect((await patch(`/${deck.id}`, { cardOrientationPrompt: null })).body.cardOrientationPrompt).toBeNull();expect((await patch(`/${deck.id}`, { bogus: 1 })).status).toBe(400);expect((await get('/not-a-uuid')).status).toBe(400);diff --git a/server/routes/decks.test.js b/server/routes/decks.test.jsindex 820226b358..f05d90c4b5 100644--- a/server/routes/decks.test.js+++ b/server/routes/decks.test.js@@ -84,6 +84,18 @@ describe('deck routes', () => {}));});+ it('validates and forwards the deck-wide face orientation settings', async () => {+ svc.updateDeck.mockResolvedValueOnce(deck({ cardOrientation: 'one-way', cardOrientationPrompt: 'Keep both indices upright' }));+ const res = await request(makeApp()).patch(`/api/decks/${D1}`).send({+ cardOrientation: 'one-way', cardOrientationPrompt: 'Keep both indices upright',+ });+ expect(res.status).toBe(200);+ expect(svc.updateDeck).toHaveBeenCalledWith(D1, {+ cardOrientation: 'one-way', cardOrientationPrompt: 'Keep both indices upright',+ });+ expect((await request(makeApp()).patch(`/api/decks/${D1}`).send({ cardOrientation: 'diagonal' })).status).toBe(400);+ });+it('generate-prompts targets only empty cards by default and skips casting without a universe', async () => {const res = await request(makeApp()).post(`/api/decks/${D1}/generate-prompts`).send({});expect(res.status).toBe(200);diff --git a/server/services/deckPrompts.js b/server/services/deckPrompts.jsindex 44fe42f677..a488193705 100644--- a/server/services/deckPrompts.js+++ b/server/services/deckPrompts.js@@ -20,7 +20,9 @@ import { extractJson } from '../lib/jsonExtract.js';import { ServerError } from '../lib/errorHandler.js';import { stripPromptControlChars, buildUniverseStyleContext } from './universeBuilder/compile.js';import { truncDesc } from '../lib/universePromptRenderers.js';-import { DECK_KIND, DECK_KIND_LABELS } from '../lib/deckTemplates.js';+import {+ DECK_KIND, DECK_KIND_LABELS, deckCardOrientation, deckCardOrientationPrompt,+} from '../lib/deckTemplates.js';import { DECK_CARD_PROMPT_MAX } from '../lib/deckValidation.js';// Small enough that one bad string can't sink a long response; a 79-card@@ -82,12 +84,14 @@ const rosterLine = (card) => {const deckContext = (deck) => {const embrace = Array.isArray(deck.influences?.embrace) ? deck.influences.embrace : [];+ const orientation = deckCardOrientation(deck);const lines = [`DECK: "${safe(deck.name)}" (${DECK_KIND_LABELS[deck.kind] || deck.kind})`,deck.description ? `CONCEPT: ${safe(deck.description)}` : '',deck.styleNotes ? `ART DIRECTION: ${safe(deck.styleNotes)}` : '',embrace.length ? `STYLE TOKENS (prepended automatically at render time): ${safe(embrace.join(', '))}` : '',deck.layoutPrompt ? `SHARED LAYOUT (also prepended automatically): ${safe(deck.layoutPrompt)}` : '',+ orientation ? `FACE ORIENTATION (also prepended automatically): ${safe(deckCardOrientationPrompt(deck))}` : '',].filter(Boolean);return `# Deck\n${lines.join('\n')}\n`;};@@ -136,7 +140,7 @@ ${targets.map((c) => ` - ${c.key}: ${safe(c.name)}${c.canonRef?.name ? ` → deReturn a SINGLE JSON object: { "prompts": [ { "key": "<card key>", "prompt": "<string, max 600 chars>" } ] } — exactly one entry per card in the list above.# Rules-- "prompt" describes the SUBJECT of the card only — figures, pose, setting, symbols, composition, the suit emblem count — as comma-separated renderable phrases. The deck's style tokens and shared layout are prepended automatically at render time, so do NOT repeat style, medium, palette, border or index/title instructions.+- "prompt" describes the SUBJECT of the card only — figures, pose, setting, symbols, composition, the suit emblem count — as comma-separated renderable phrases. The deck's style tokens, shared layout and face-orientation instructions are prepended automatically at render time, so do NOT repeat style, medium, palette, border, index/title or orientation instructions.${kindRules}- When a card is cast with a canon entry, depict that entry faithfully to its description; otherwise invent a subject that belongs in this deck's world.- Cards of one suit should share a visual through-line (a recurring emblem, setting or color accent) so the suit reads as a family.diff --git a/server/services/deckPrompts.test.js b/server/services/deckPrompts.test.jsindex 8c1f00af45..104bc1314c 100644--- a/server/services/deckPrompts.test.js+++ b/server/services/deckPrompts.test.js@@ -119,6 +119,7 @@ describe('generateDeckCardPrompts', () => {});expect(text).toContain('→ depict The Keeper (character)');expect(text).toContain('STYLE TOKENS (prepended automatically at render time): sepia');+ expect(text).toContain('FACE ORIENTATION (also prepended automatically): One-way card face');expect(text).toContain('do NOT repeat style');});});diff --git a/server/services/deckRender.test.js b/server/services/deckRender.test.jsindex a0915b2696..03ccc085fb 100644--- a/server/services/deckRender.test.js+++ b/server/services/deckRender.test.js@@ -60,7 +60,8 @@ describe('renderDeckCards', () => {expect(owner).toBe('decks');expect(params).toMatchObject({mode: 'local', pythonPath: '/py', modelId: 'flux2-klein-4b', width: 1024, height: 1536, seed: 7,- prompt: 'engraving. Full card. Ace of Spades: one spade', negativePrompt: 'blurry',+ prompt: expect.stringContaining('Standard two-way playing-card face'),+ negativePrompt: expect.stringContaining('six rendered as nine'),deckCard: { deckId: 'd1', cardId: 'a', key: 'spades-A' },});expect(markCardsRenderQueued).toHaveBeenCalledTimes(1);@@ -71,7 +72,11 @@ describe('renderDeckCards', () => {resolveRenderTargetConfig.mockReturnValue({ mode: 'codex', cloud: { enabled: true, modelId: 'gpt-image-2', jobParams: { mode: 'codex', model: 'gpt-image-2', effort: 'high' } } });await renderDeckCards('d1', { cardIds: ['b'] });const { params } = enqueueJob.mock.calls[0][0];- expect(params).toMatchObject({ mode: 'codex', model: 'gpt-image-2', effort: 'high', negativePrompt: 'text, blurry', deckCard: { cardId: 'b' } });+ expect(params).toMatchObject({+ mode: 'codex', model: 'gpt-image-2', effort: 'high',+ negativePrompt: expect.stringContaining('text, upright duplicate bottom-right index'),+ deckCard: { cardId: 'b' },+ });expect(params.pythonPath).toBeUndefined();expect(markCardsRenderQueued.mock.calls[0][1][0].render).toMatchObject({ model: 'gpt-image-2' });});diff --git a/server/services/deckStyleAnalysis.js b/server/services/deckStyleAnalysis.jsindex 9eaa1c0268..3bc282e000 100644--- a/server/services/deckStyleAnalysis.js+++ b/server/services/deckStyleAnalysis.js@@ -18,7 +18,9 @@import { randomUUID } from 'node:crypto';import { ServerError } from '../lib/errorHandler.js';import { trimTo } from '../lib/textUtils.js';-import { DECK_KIND_LABELS, DEFAULT_LAYOUT_PROMPT } from '../lib/deckTemplates.js';+import {+ DECK_KIND_LABELS, DEFAULT_LAYOUT_PROMPT, deckCardOrientation, deckCardOrientationPrompt,+} from '../lib/deckTemplates.js';import { DECK_LAYOUT_PROMPT_MAX, DECK_SAMPLE_PROMPT_MAX, DECK_SAMPLE_TITLE_MAX } from '../lib/deckValidation.js';import { STYLE_NOTES_MAX } from '../lib/universeBibleLimits.js';import { universeVisualStyleTokens } from '../lib/universeVisualStyle.js';@@ -32,10 +34,12 @@ export function buildDeckSamplePrompt({ deck, title }) {currentStyleNotes: trimTo(deck.styleNotes, STYLE_NOTES_MAX),currentInfluences: universeVisualStyleTokens(deck),currentLayoutPrompt: trimTo(deck.layoutPrompt, DECK_LAYOUT_PROMPT_MAX) || DEFAULT_LAYOUT_PROMPT[deck.kind],+ cardOrientation: deckCardOrientation(deck),+ cardOrientationPrompt: deckCardOrientationPrompt(deck),});return `Analyze the attached image as a SAMPLE DESIGN for a ${kindLabel} deck called "${deck.name}". Every card in the deck must read as one physical object printed in this visual language.-Concentrate on renderable visual style: medium and finish (engraving, gouache, risograph, foil, letterpress…), line and brush treatment, palette (name the dominant colors and the paper/ground tone), lighting, texture, ornament and border language, typographic feel, era and mood. Also decide how a single CARD in this style should be laid out — border/frame treatment, where indices or titles sit, how much of the face the central illustration fills. Do not invent story facts or named characters, and do not attribute the style to a copyrighted living artist.+Concentrate on renderable visual style: medium and finish (engraving, gouache, risograph, foil, letterpress…), line and brush treatment, palette (name the dominant colors and the paper/ground tone), lighting, texture, ornament and border language, typographic feel, era and mood. Also decide how a single CARD in this style should be laid out — border/frame treatment, where indices or titles sit, how much of the face the central illustration fills. The deck's face-orientation setting is authoritative: describe index/title placement in the layout only, never contradict or restate its one-way/two-way rotation rule. Do not invent story facts or named characters, and do not attribute the style to a copyrighted living artist.Current deck context:${context}@@ -49,7 +53,7 @@ Return JSON only:"embrace": ["complete ordered list of 8–18 comma-free style tokens an image model should lean into"],"avoid": ["complete ordered list of 4–12 tokens for the negative prompt"]},- "layoutPrompt": "one sentence describing the shared card layout in this style (border, index/title placement, illustration framing) — keep it usable as a prefix on every card prompt",+ "layoutPrompt": "one sentence describing the shared card layout in this style (border, index/title placement, illustration framing, but not face-orientation rotation) — keep it usable as a prefix on every card prompt","rationale": "one concise explanation of the proposed changes"}diff --git a/server/services/decks.js b/server/services/decks.jsindex 55413fcf61..65971babed 100644--- a/server/services/decks.js+++ b/server/services/decks.js@@ -2,8 +2,9 @@* Decks — db-primary card-deck design projects (playing cards and tarot).** A deck row holds the style guide (notes + embrace/avoid influences), the- * shared layout clause, sample references (gallery images the vision step- * analyzed), per-record render/LLM pins and an optional universe link. Each+ * shared layout clause and face-orientation rule, sample references (gallery+ * images the vision step analyzed), per-record render/LLM pins and an optional+ * universe link. Each* card is its own `deck_cards` row so a completed render attaches to exactly* one card, serialized by the completion hook per deck. Rendered bytes stay in* the shared gallery (`data/images/`) and are referenced by filename, the same@@ -26,7 +27,10 @@ import { ServerError } from '../lib/errorHandler.js';import { trimTo, isNonBlankStr } from '../lib/textUtils.js';import { sanitizeLlmRoutePin } from '../lib/llmRoutePin.js';import { universeVisualStyleTokens } from '../lib/universeVisualStyle.js';-import { DECK_CARD_SIZE, DECK_CARD_SIZE_BY_KIND, DEFAULT_LAYOUT_PROMPT, deckCardRoster, deckCompletion } from '../lib/deckTemplates.js';+import {+ DECK_CARD_SIZE, DECK_CARD_SIZE_BY_KIND, DEFAULT_DECK_CARD_ORIENTATION, DEFAULT_LAYOUT_PROMPT,+ deckCardOrientation, deckCardRoster, deckCompletion,+} from '../lib/deckTemplates.js';import { DECK_CARD_IMAGE_REFS_MAX, DECK_SAMPLES_MAX } from '../lib/deckValidation.js';import { recordRenderPin } from '../lib/renderTargets.js';import { createRecordWriteQueue } from '../lib/fileWriteQueue.js';@@ -72,6 +76,8 @@ const projectDeck = (row) => {styleNotes: trimTo(d.styleNotes),influences: universeVisualStyleTokens(d),layoutPrompt: trimTo(d.layoutPrompt) || DEFAULT_LAYOUT_PROMPT[row.kind] || '',+ cardOrientation: deckCardOrientation({ kind: row.kind, cardOrientation: d.cardOrientation }),+ cardOrientationPrompt: trimTo(d.cardOrientationPrompt) || null,samples: Array.isArray(d.samples) ? d.samples : [],imageMode: pin.mode,imageModelId: pin.modelId,@@ -232,6 +238,7 @@ export async function createDeck({ name, kind, description = '', universeId = nudescription: trimTo(description),...seeded,layoutPrompt: DEFAULT_LAYOUT_PROMPT[kind],+ cardOrientation: DEFAULT_DECK_CARD_ORIENTATION[kind] || null,samples: [],cardSize: { ...(DECK_CARD_SIZE_BY_KIND[kind] || DECK_CARD_SIZE) },};@@ -279,6 +286,8 @@ function applyDefinitionPatch(d, patch) {if (patch.styleNotes !== undefined) d.styleNotes = trimTo(patch.styleNotes);if (patch.influences !== undefined) d.influences = universeVisualStyleTokens({ influences: patch.influences });if (patch.layoutPrompt !== undefined) d.layoutPrompt = trimTo(patch.layoutPrompt);+ if (patch.cardOrientation !== undefined) d.cardOrientation = patch.cardOrientation;+ if (patch.cardOrientationPrompt !== undefined) d.cardOrientationPrompt = trimTo(patch.cardOrientationPrompt) || null;if (patch.samples !== undefined) d.samples = Array.isArray(patch.samples) ? patch.samples.slice(0, DECK_SAMPLES_MAX) : [];if (patch.cardSize !== undefined) d.cardSize = { width: patch.cardSize.width, height: patch.cardSize.height };}@@ -512,6 +521,15 @@ const definitionFromRemote = (remote, local) => ({styleNotes: trimTo(remote?.styleNotes),influences: universeVisualStyleTokens(remote),layoutPrompt: trimTo(remote?.layoutPrompt),+ // A pre-v2 peer has no keys to send. Preserve a receiver's authored choice+ // in that sender-behind case; a current peer's explicit null still clears a+ // prompt override as intended.+ cardOrientation: Object.hasOwn(remote || {}, 'cardOrientation')+ ? deckCardOrientation({ kind: remote?.kind, cardOrientation: remote?.cardOrientation })+ : (local?.cardOrientation || DEFAULT_DECK_CARD_ORIENTATION[remote?.kind] || null),+ cardOrientationPrompt: Object.hasOwn(remote || {}, 'cardOrientationPrompt')+ ? (trimTo(remote?.cardOrientationPrompt) || null)+ : (local?.cardOrientationPrompt || null),samples: Array.isArray(remote?.samples) ? remote.samples.slice(0, DECK_SAMPLES_MAX) : [],cardSize: remote?.cardSize?.width && remote?.cardSize?.height? { width: remote.cardSize.width, height: remote.cardSize.height }@@ -536,7 +554,11 @@ const remoteWinsOver = (remoteAt, localAt) => {*/async function writeRemoteDeck(id, remote, local) {const localDefinition = local ? {- imageMode: local.imageMode, imageModelId: local.imageModelId, promptLlm: local.promptLlm,+ imageMode: local.imageMode,+ imageModelId: local.imageModelId,+ promptLlm: local.promptLlm,+ cardOrientation: local.cardOrientation,+ cardOrientationPrompt: local.cardOrientationPrompt,} : null;await withTransaction(async (client) => {const definition = definitionFromRemote(remote, localDefinition);diff --git a/server/services/decksSync.db.test.js b/server/services/decksSync.db.test.jsindex 79b487f149..4fa34468ac 100644--- a/server/services/decksSync.db.test.js+++ b/server/services/decksSync.db.test.js@@ -75,6 +75,8 @@ describe.skipIf(!ready)('deck federation', () => {await updateDeck(deck.id, {imageMode: 'grok', imageModelId: 'grok-image-1',promptLlm: { providerId: 'claude-cli', model: 'claude-opus-5' },+ cardOrientation: 'one-way',+ cardOrientationPrompt: 'Keep both indices upright in this custom deck',});const pinned = await getDeck(deck.id);expect(pinned.promptLlm).toMatchObject({ providerId: 'claude-cli', model: 'claude-opus-5' });@@ -87,6 +89,8 @@ describe.skipIf(!ready)('deck federation', () => {expect(merged.imageMode).toBe('grok');expect(merged.imageModelId).toBe('grok-image-1');expect(merged.promptLlm).toEqual(pinned.promptLlm);+ expect(merged.cardOrientation).toBe('one-way');+ expect(merged.cardOrientationPrompt).toBe('Keep both indices upright in this custom deck');});it('keeps a card\'s local render history when the remote carries none for it', async () => {