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
refactor: simplify sprite reference generation while preserving render behavior (#9276)
Adam Eivy34000f0bfb93
diff --git a/server/services/sprites/reference.js b/server/services/sprites/reference.jsindex f14153b633..6f612a4c98 100644--- a/server/services/sprites/reference.js+++ b/server/services/sprites/reference.js@@ -378,179 +378,172 @@ export function startReferenceGeneration(recordId, body, upload = null) {return manifestWriteTail(recordId, () => startReferenceGenerationImpl(recordId, body, upload));}-async function startReferenceGenerationImpl(recordId, body, upload = null) {- const record = await requireTrack(recordId);- const directional = kindSupportsTrack(record.kind, WALK_TRACK, getEffectiveAnimationTracks());- const manifest = (await loadManifest(recordId)) || seedManifest(recordId, { directional });- const target = body.target;- if (!directional && target !== 'main') {- throw new ServerError('Ambient references use one main identity root; they have no turnaround or directional anchors', { status: 400, code: 'INVALID_TARGET' });- }- // Once either identity artifact is locked — the sheet on a turnaround-first- // record, the main on a legacy one — the manifest's key is canonical (set at- // that lock, possibly auto-selected); a later record-level repin must not- // fork subsequent renders onto a different background than the frozen set.- const genKey = manifest.chromaKey || record.chromaKey || DEFAULT_CHROMA_KEY;- const settings = await getSettings();- // Render-target ladder (#3231): the page's explicit body.mode wins, then- // the sprite record's persisted pin (Phase 3), then the sprite-reference- // pin in settings.renderDefaults, then the install default — the shared- // `imageModeCandidates` order (lib/renderModeLadder.js, #6815). The pins go- // through pickUsableMode so each disabled rung falls to the NEXT rung- // (matching resolveRenderTargetConfig's per-rung gating) instead of a- // disabled record pin swallowing the target pin; resolveQueueImageMode- // keeps the historical gate for an explicit body.mode.- const spritePin = recordRenderPin(record);- const mode = resolveQueueImageMode(- body.mode || pickUsableMode(settings, imageModeCandidates(settings, RENDER_TARGET.SPRITE_REFERENCE, record)),- settings,+function normalizeCorrectionPrompt(body) {+ return typeof body.correctionPrompt === 'string' ? body.correctionPrompt.trim() : '';+}++function hasSeedInput(body, upload, { allowCandidate = false, allowDesignPrompt = true } = {}) {+ return Boolean(+ (allowDesignPrompt && typeof body.designPrompt === 'string' && body.designPrompt.trim())+ || upload || body.initImageGalleryFile || body.initImageSpriteId+ || (allowCandidate && body.initImageCandidate));+}++async function planTurnaroundRender({ recordId, record, manifest, body, upload, designPrompt, genKey }) {+ const turnaroundLocked = manifest.turnaround?.locked === true;+ const correctionPrompt = normalizeCorrectionPrompt(body);+ let initImagePath;+ let initImageStrength = Number.isFinite(body.initImageStrength) ? body.initImageStrength : undefined;+ let designReferencePath;+ if (turnaroundLocked) {+ throw new ServerError('Turnaround sheet is locked — unlock the turnaround before regenerating it', { status: 409, code: 'REFERENCE_LOCKED' });+ }+ // The sheet establishes the character's look, so it needs SOME input: a+ // prompt, an uploaded image, a gallery pick, another sprite's reference —+ // or, on a legacy record, the locked main this backfill expands.+ if (!hasSeedInput(body, upload, { allowCandidate: true })+ && !manifest.mainReference.locked) {+ throw new ServerError('Provide a design prompt and/or a reference image', { status: 400, code: 'DESIGN_INPUT_REQUIRED' });+ }+ const anchorId = TURNAROUND_ID;+ const prompt = buildTurnaroundPrompt({+ name: record.name,+ designPrompt: designPrompt || manifest.designPrompt,+ chromaKey: genKey,+ correctionPrompt: body.correctionPrompt,+ });+ if (body.initImageCandidate) {+ initImagePath = await requireTurnaroundCandidatePath(recordId, body.initImageCandidate);+ designReferencePath = body.initImageCandidate;+ } else {+ ({ initImagePath, designReferencePath } = await resolveSeedSource(recordId, body, upload));+ }+ // Legacy backfill: no explicit seed, but a frozen main exists — expand the+ // one view we already have into the full sheet rather than inventing a new+ // character from text.+ if (!initImagePath && manifest.mainReference.locked) {+ initImagePath = await requireLockedArtifactPath(recordId, manifest.mainReference.path, {+ message: 'Locked main reference file is missing on disk', code: 'MAIN_REFERENCE_MISSING',+ });+ designReferencePath = manifest.mainReference.path;+ }+ if (initImagePath) initImageStrength ??= UPLOAD_DEFAULT_STRENGTH;+ if (designPrompt) manifest.designPrompt = designPrompt;+ // The sheet is the first render, so this save may be persisting a manifest+ // that was only just seeded — it runs unconditionally. The later branches+ // require locked predecessors, so their manifest is already on disk and+ // only needs writing back when the design prompt actually changed.+ await saveManifest(recordId, manifest);+ return { anchorId, direction: undefined, prompt, initImagePath, initImageStrength, designReferencePath, correctionPrompt };+}+async function planMainRender({ recordId, record, manifest, body, upload, designPrompt, genKey, directional }) {+ const turnaroundLocked = manifest.turnaround?.locked === true;+ const correctionPrompt = normalizeCorrectionPrompt(body);let prompt;let initImagePath;let initImageStrength = Number.isFinite(body.initImageStrength) ? body.initImageStrength : undefined;let anchorId;let direction;let designReferencePath;- let correctionPrompt;-- const turnaroundLocked = manifest.turnaround?.locked === true;- const designPrompt = typeof body.designPrompt === 'string' ? body.designPrompt.trim() : '';-- if (target === TURNAROUND_ID) {- if (turnaroundLocked) {- throw new ServerError('Turnaround sheet is locked — unlock the turnaround before regenerating it', { status: 409, code: 'REFERENCE_LOCKED' });- }- // The sheet establishes the character's look, so it needs SOME input: a- // prompt, an uploaded image, a gallery pick, another sprite's reference —- // or, on a legacy record, the locked main this backfill expands.- if (!designPrompt && !upload && !body.initImageGalleryFile && !body.initImageSpriteId- && !body.initImageCandidate- && !manifest.mainReference.locked) {+ if (manifest.mainReference.locked) {+ throw new ServerError('Main reference is locked — unlock the turnaround to rebuild its dependent reference chain', { status: 409, code: 'REFERENCE_LOCKED' });+ }+ // A place/object ambient loop has one identity root, not a turnaround or+ // directional anchors. Its main is generated directly and later becomes+ // both its idle cell and image-to-video source.+ if (!directional) {+ if (!hasSeedInput(body, upload)) {throw new ServerError('Provide a design prompt and/or a reference image', { status: 400, code: 'DESIGN_INPUT_REQUIRED' });}- anchorId = TURNAROUND_ID;- prompt = buildTurnaroundPrompt({- name: record.name,- designPrompt: designPrompt || manifest.designPrompt,- chromaKey: genKey,- correctionPrompt: body.correctionPrompt,+ anchorId = 'main';+ direction = 'south';+ // A place/object main takes BOTH inputs (#3134): `designPrompt` replaces+ // the design outright, `correctionPrompt` keeps it and fixes one thing+ // about the last render. They compose — the user can do either or both.+ prompt = buildAmbientReferencePrompt({+ name: record.name, kind: record.kind, designPrompt, chromaKey: genKey, correctionPrompt,});- correctionPrompt = typeof body.correctionPrompt === 'string' ? body.correctionPrompt.trim() : '';- if (body.initImageCandidate) {- initImagePath = await requireTurnaroundCandidatePath(recordId, body.initImageCandidate);- designReferencePath = body.initImageCandidate;- } else {- ({ initImagePath, designReferencePath } = await resolveSeedSource(recordId, body, upload));- }- // Legacy backfill: no explicit seed, but a frozen main exists — expand the- // one view we already have into the full sheet rather than inventing a new- // character from text.- if (!initImagePath && manifest.mainReference.locked) {- initImagePath = await requireLockedArtifactPath(recordId, manifest.mainReference.path, {- message: 'Locked main reference file is missing on disk', code: 'MAIN_REFERENCE_MISSING',- });- designReferencePath = manifest.mainReference.path;- }+ ({ initImagePath, designReferencePath } = await resolveSeedSource(recordId, body, upload));if (initImagePath) initImageStrength ??= UPLOAD_DEFAULT_STRENGTH;if (designPrompt) manifest.designPrompt = designPrompt;- // The sheet is the first render, so this save may be persisting a manifest- // that was only just seeded — it runs unconditionally. The later branches- // require locked predecessors, so their manifest is already on disk and- // only needs writing back when the design prompt actually changed.await saveManifest(recordId, manifest);- } else if (target === 'main') {- if (manifest.mainReference.locked) {- throw new ServerError('Main reference is locked — unlock the turnaround to rebuild its dependent reference chain', { status: 409, code: 'REFERENCE_LOCKED' });- }- // A place/object ambient loop has one identity root, not a turnaround or- // directional anchors. Its main is generated directly and later becomes- // both its idle cell and image-to-video source.- if (!directional) {- if (!designPrompt && !upload && !body.initImageGalleryFile && !body.initImageSpriteId) {- throw new ServerError('Provide a design prompt and/or a reference image', { status: 400, code: 'DESIGN_INPUT_REQUIRED' });- }- anchorId = 'main';- direction = 'south';- // A place/object main takes BOTH inputs (#3134): `designPrompt` replaces- // the design outright, `correctionPrompt` keeps it and fixes one thing- // about the last render. They compose — the user can do either or both.- correctionPrompt = typeof body.correctionPrompt === 'string' ? body.correctionPrompt.trim() : '';- prompt = buildAmbientReferencePrompt({- name: record.name, kind: record.kind, designPrompt, chromaKey: genKey, correctionPrompt,- });- ({ initImagePath, designReferencePath } = await resolveSeedSource(recordId, body, upload));- if (initImagePath) initImageStrength ??= UPLOAD_DEFAULT_STRENGTH;- if (designPrompt) manifest.designPrompt = designPrompt;- await saveManifest(recordId, manifest);- } else {- // The main is always the sheet's front view: a manifest that reaches here- // with no locked sheet was either seeded turnaround-first or upgraded to it- // on read (upgradeManifestShape), and the only manifests that skip that- // upgrade have a locked main — which threw REFERENCE_LOCKED just above.- if (!turnaroundLocked) {- throw new ServerError('Lock the turnaround sheet before deriving the main reference', { status: 409, code: 'TURNAROUND_NOT_LOCKED' });- }- anchorId = anchorIdForDirection('south');- direction = 'south';- // Same optional re-roll note the anchors take (#3134) — the main derives- // from the sheet, so a bad front view can be described instead of only- // re-rolled blind.- correctionPrompt = typeof body.correctionPrompt === 'string' ? body.correctionPrompt.trim() : '';- prompt = buildMainReferencePrompt({- name: record.name,- designPrompt: designPrompt || manifest.designPrompt,- chromaKey: genKey,- correctionPrompt,- fromTurnaround: true,- });- // The sheet IS the seed here, so a caller-supplied one has nowhere to go.- // Reject rather than silently dropping it.- if (upload || body.initImageGalleryFile || body.initImageSpriteId) {- throw new ServerError('The main reference derives from the locked turnaround sheet — seed a new design through the sheet, not the main', { status: 400, code: 'SEED_NOT_APPLICABLE' });- }- initImagePath = await requireLockedTurnaroundPath(recordId, manifest);- initImageStrength ??= ANCHOR_DEFAULT_STRENGTH;- // Nothing else in this branch mutates the manifest, so skip the write —- // and its per-record serialization — on the common no-prompt re-roll.- if (designPrompt) {- manifest.designPrompt = designPrompt;- await saveManifest(recordId, manifest);- }- }} else {- if (!ANCHOR_DIRECTIONS.includes(target)) {- throw new ServerError(`Unknown reference target: ${target}`, { status: 400, code: 'INVALID_TARGET' });- }- // The whole point of the sheet: an anchor drawn from a single front view- // has to invent the side it is facing, which is how a hip bag ends up on- // the character's back. Required on every record — a legacy one backfills.+ // The main is always the sheet's front view: a manifest that reaches here+ // with no locked sheet was either seeded turnaround-first or upgraded to it+ // on read (upgradeManifestShape), and the only manifests that skip that+ // upgrade have a locked main — which threw REFERENCE_LOCKED just above.if (!turnaroundLocked) {- throw new ServerError('Lock the turnaround sheet before deriving directional anchors', { status: 409, code: 'TURNAROUND_NOT_LOCKED' });+ throw new ServerError('Lock the turnaround sheet before deriving the main reference', { status: 409, code: 'TURNAROUND_NOT_LOCKED' });}- if (!manifest.mainReference.locked) {- throw new ServerError('Lock the main reference before deriving directional anchors', { status: 409, code: 'MAIN_NOT_LOCKED' });- }- direction = target;- anchorId = anchorIdForDirection(direction);- const anchor = findAnchor(manifest, anchorId);- if (anchor?.status === 'locked') {- throw new ServerError(`Anchor ${anchorId} is locked — unlock the anchor before regenerating it`, { status: 409, code: 'REFERENCE_LOCKED' });- }- // Optional user correction re-appended on every re-roll — diverges the- // render from the previous candidate rather than reproducing its mistakes.- correctionPrompt = typeof body.correctionPrompt === 'string' ? body.correctionPrompt.trim() : '';- prompt = buildAnchorPrompt({- name: record.name, direction, chromaKey: genKey, correctionPrompt, fromTurnaround: true,+ anchorId = anchorIdForDirection('south');+ direction = 'south';+ // Same optional re-roll note the anchors take (#3134) — the main derives+ // from the sheet, so a bad front view can be described instead of only+ // re-rolled blind.+ prompt = buildMainReferencePrompt({+ name: record.name,+ designPrompt: designPrompt || manifest.designPrompt,+ chromaKey: genKey,+ correctionPrompt,+ fromTurnaround: true,});+ // The sheet IS the seed here, so a caller-supplied one has nowhere to go.+ // Reject rather than silently dropping it.+ if (hasSeedInput(body, upload, { allowDesignPrompt: false })) {+ throw new ServerError('The main reference derives from the locked turnaround sheet — seed a new design through the sheet, not the main', { status: 400, code: 'SEED_NOT_APPLICABLE' });+ }initImagePath = await requireLockedTurnaroundPath(recordId, manifest);initImageStrength ??= ANCHOR_DEFAULT_STRENGTH;- // Known limitation shared with every i2i surface (proof-as-base, refine):- // the WINDOWS local runner (imagine_win.py) has no i2i and drops the- // init image — anchors there degrade to text-to-image, like all other- // pipeline i2i renders on that platform. Cloud modes are unaffected.+ // Nothing else in this branch mutates the manifest, so skip the write —+ // and its per-record serialization — on the common no-prompt re-roll.+ if (designPrompt) {+ manifest.designPrompt = designPrompt;+ await saveManifest(recordId, manifest);+ }}+ return { anchorId, direction, prompt, initImagePath, initImageStrength, designReferencePath, correctionPrompt };+}+async function planAnchorRender({ recordId, record, manifest, body, genKey }) {+ const target = body.target;+ const turnaroundLocked = manifest.turnaround?.locked === true;+ const correctionPrompt = normalizeCorrectionPrompt(body);+ let initImageStrength = Number.isFinite(body.initImageStrength) ? body.initImageStrength : undefined;+ if (!ANCHOR_DIRECTIONS.includes(target)) {+ throw new ServerError(`Unknown reference target: ${target}`, { status: 400, code: 'INVALID_TARGET' });+ }+ // The whole point of the sheet: an anchor drawn from a single front view+ // has to invent the side it is facing, which is how a hip bag ends up on+ // the character's back. Required on every record — a legacy one backfills.+ if (!turnaroundLocked) {+ throw new ServerError('Lock the turnaround sheet before deriving directional anchors', { status: 409, code: 'TURNAROUND_NOT_LOCKED' });+ }+ if (!manifest.mainReference.locked) {+ throw new ServerError('Lock the main reference before deriving directional anchors', { status: 409, code: 'MAIN_NOT_LOCKED' });+ }+ const direction = target;+ const anchorId = anchorIdForDirection(direction);+ const anchor = findAnchor(manifest, anchorId);+ if (anchor?.status === 'locked') {+ throw new ServerError(`Anchor ${anchorId} is locked — unlock the anchor before regenerating it`, { status: 409, code: 'REFERENCE_LOCKED' });+ }+ // Optional user correction re-appended on every re-roll — diverges the+ // render from the previous candidate rather than reproducing its mistakes.+ const prompt = buildAnchorPrompt({+ name: record.name, direction, chromaKey: genKey, correctionPrompt, fromTurnaround: true,+ });+ const initImagePath = await requireLockedTurnaroundPath(recordId, manifest);+ initImageStrength ??= ANCHOR_DEFAULT_STRENGTH;+ // Known limitation shared with every i2i surface (proof-as-base, refine):+ // the WINDOWS local runner (imagine_win.py) has no i2i and drops the+ // init image — anchors there degrade to text-to-image, like all other+ // pipeline i2i renders on that platform. Cloud modes are unaffected.+ return { anchorId, direction, prompt, initImagePath, initImageStrength, designReferencePath: undefined, correctionPrompt };+}++function resolveReferenceRenderRoute(settings, body, mode, spritePin) {// No edit-capability fallback here: every queueable backend accepts an input// image (local `--image-path`, codex `referenced_image_paths`, grok// `image_edit.image`, agy `ImagePaths` — see EDIT_INCAPABLE_IMAGE_MODES), so@@ -590,6 +583,49 @@ async function startReferenceGenerationImpl(recordId, body, upload = null) {: mode === IMAGE_GEN_MODE.LOCAL? selectedLocalModel.id: null;+ return { cleanC2PA, denoise, cloud, cloudJobParams, effectiveModel };+}++const REFERENCE_PLANNERS = {+ __proto__: null,+ [TURNAROUND_ID]: planTurnaroundRender,+ main: planMainRender,+};++async function startReferenceGenerationImpl(recordId, body, upload = null) {+ const record = await requireTrack(recordId);+ const directional = kindSupportsTrack(record.kind, WALK_TRACK, getEffectiveAnimationTracks());+ const manifest = (await loadManifest(recordId)) || seedManifest(recordId, { directional });+ const target = body.target;+ if (!directional && target !== 'main') {+ throw new ServerError('Ambient references use one main identity root; they have no turnaround or directional anchors', { status: 400, code: 'INVALID_TARGET' });+ }+ // Once either identity artifact is locked — the sheet on a turnaround-first+ // record, the main on a legacy one — the manifest's key is canonical (set at+ // that lock, possibly auto-selected); a later record-level repin must not+ // fork subsequent renders onto a different background than the frozen set.+ const genKey = manifest.chromaKey || record.chromaKey || DEFAULT_CHROMA_KEY;+ const settings = await getSettings();+ // Render-target ladder (#3231): the page's explicit body.mode wins, then+ // the sprite record's persisted pin (Phase 3), then the sprite-reference+ // pin in settings.renderDefaults, then the install default — the shared+ // `imageModeCandidates` order (lib/renderModeLadder.js, #6815). The pins go+ // through pickUsableMode so each disabled rung falls to the NEXT rung+ // (matching resolveRenderTargetConfig's per-rung gating) instead of a+ // disabled record pin swallowing the target pin; resolveQueueImageMode+ // keeps the historical gate for an explicit body.mode.+ const spritePin = recordRenderPin(record);+ const mode = resolveQueueImageMode(+ body.mode || pickUsableMode(settings, imageModeCandidates(settings, RENDER_TARGET.SPRITE_REFERENCE, record)),+ settings,+ );++ const designPrompt = typeof body.designPrompt === 'string' ? body.designPrompt.trim() : '';+ const planner = REFERENCE_PLANNERS[target] ?? planAnchorRender;+ const {+ anchorId, direction, prompt, initImagePath, initImageStrength, designReferencePath, correctionPrompt,+ } = await planner({ recordId, record, manifest, body, upload, designPrompt, genKey, directional });+ const { cleanC2PA, denoise, cloud, cloudJobParams, effectiveModel } = resolveReferenceRenderRoute(settings, body, mode, spritePin);const baseParams = {prompt,// Codex ImageGen otherwise selects an arbitrary native aspect ratio. Thediff --git a/server/services/sprites/reference.test.js b/server/services/sprites/reference.test.jsindex 8f3954d1fe..cb1a3f298d 100644--- a/server/services/sprites/reference.test.js+++ b/server/services/sprites/reference.test.js@@ -11,11 +11,13 @@ import { describe, it, expect, vi, beforeEach, afterAll } from 'vitest';import { mkdtempSync, rmSync, readFileSync } from 'fs';import { tmpdir } from 'os';import { join } from 'path';+import { createHash } from 'crypto';import sharp from 'sharp';import { mkdir, writeFile, readFile } from 'fs/promises';import { writeCandidatePng, placeCandidate as placeCandidateFixture, expectCarriesCorrection } from './spriteTestFixtures.js';const TEST_ROOT = mkdtempSync(join(tmpdir(), 'sprite-reference-test-'));+const manifestWrites = [];const localImageModels = [{ id: 'dev', hardwareCompatibility: { state: 'available' } },{ id: 'flux-dev-4bit', hardwareCompatibility: { state: 'available' } },@@ -33,7 +35,13 @@ vi.mock('../../lib/fileUtils.js', async (importOriginal) => {sprites: join(TEST_ROOT, 'sprites'),images: join(TEST_ROOT, 'images'),});- return actual;+ return {+ ...actual,+ atomicWrite: async (path, ...args) => {+ if (path.endsWith('-reference-set-v1.json')) manifestWrites.push(path);+ return actual.atomicWrite(path, ...args);+ },+ };});const enqueueJob = vi.fn(() => ({ jobId: 'job-1234567890', position: 0, status: 'queued' }));@@ -171,6 +179,124 @@ describe('the animation gates (#3017)', () => {});describe('startReferenceGeneration', () => {+ // Pins the entire queue contract across target planners and backend routes;+ // the payload digest detects any serialized field or prompt wording drift.+ it('preserves queued payloads and manifest writes for every target and backend', async () => {+ const contracts = {};+ for (const mode of ['local', 'codex', 'agy', 'grok']) {+ for (const target of ['turnaround', 'ambient-main', 'main', 'east']) {+ const id = newId();+ if (target === 'ambient-main') {+ await records.createRecord({ kind: 'place', name: 'Hero' }, id);+ } else {+ await createCharacter(id);+ }+ if (target === 'main') await lockTurnaround(id);+ if (target === 'east') await lockMain(id);+ const run = async (designPrompt) => {+ enqueueJob.mockClear();+ manifestWrites.length = 0;+ await startReferenceGeneration(id, {+ target: target === 'ambient-main' ? 'main' : target,+ mode, designPrompt, correctionPrompt: ' repair the hem ',+ });+ const job = enqueueJob.mock.calls[0][0];+ const normalized = JSON.stringify(job).replaceAll(TEST_ROOT, '<test-root>').replaceAll(id, '<record>');+ return {+ payloadSHA256: createHash('sha256').update(normalized).digest('hex'),+ manifestWrites: manifestWrites.length,+ };+ };+ contracts[mode + '/' + target] = await run('example design');+ if (target === 'main') contracts[mode + '/main-reroll'] = await run(undefined);+ }+ }+ expect(contracts).toMatchInlineSnapshot(`+ {+ "agy/ambient-main": {+ "manifestWrites": 1,+ "payloadSHA256": "618f006a1923f147257030bae9aed0e892b410dd99864c6651b66c3a6e13c0d7",+ },+ "agy/east": {+ "manifestWrites": 0,+ "payloadSHA256": "663174cc78679ce571095b2d7ff363b5d5c025173a8d49c10afc24fe3fd24bcb",+ },+ "agy/main": {+ "manifestWrites": 1,+ "payloadSHA256": "19eadde44bc1333da317b56d5817b31124e5c5985147e20bc369105fef881a74",+ },+ "agy/main-reroll": {+ "manifestWrites": 0,+ "payloadSHA256": "9582217d0025d10f254571114dfa232bec7b8cc4a2e55aad41234b3d8c53b828",+ },+ "agy/turnaround": {+ "manifestWrites": 1,+ "payloadSHA256": "d06be938985f946942bc4c5f37a8ef5a5eb9d5c010a55195ecab2530b4b22e45",+ },+ "codex/ambient-main": {+ "manifestWrites": 1,+ "payloadSHA256": "1a3056e9172577fb5fc052d701753a657682a40c33106841fe720a18acd6ab16",+ },+ "codex/east": {+ "manifestWrites": 0,+ "payloadSHA256": "1c4b040e9ef9687cfbbf3e879addd15e0a71a905a3b5cc8ae68f10f1a1e145da",+ },+ "codex/main": {+ "manifestWrites": 1,+ "payloadSHA256": "a7836b97b8c12d00cbc57abd1934d0d31b0009f1c662c06d99603a5d27f30a6e",+ },+ "codex/main-reroll": {+ "manifestWrites": 0,+ "payloadSHA256": "c852aac43df1f7cb288081e1c3df3e74a56226ffd64f669149dd92bf499e2633",+ },+ "codex/turnaround": {+ "manifestWrites": 1,+ "payloadSHA256": "2191d6e8863245b323ba4ba3bc88b22f7d902449e37f77a1f4906e9ff1f5ac47",+ },+ "grok/ambient-main": {+ "manifestWrites": 1,+ "payloadSHA256": "696eb01070645ad71b91654275004782ec12e94a53d9404dd6fef633cbe86a9d",+ },+ "grok/east": {+ "manifestWrites": 0,+ "payloadSHA256": "7b022a6ac38c48e984b04e9dc2fdf6228a2690a7c0296b107be72afe4b539089",+ },+ "grok/main": {+ "manifestWrites": 1,+ "payloadSHA256": "180dc044dd6c4ca6396181bd2ef23f9bccb23e374170369fd2dd072e6d44e7e2",+ },+ "grok/main-reroll": {+ "manifestWrites": 0,+ "payloadSHA256": "7547bf855275eb89e35830b2fa88d10672ab8a478b54d393434ca1499380fbc4",+ },+ "grok/turnaround": {+ "manifestWrites": 1,+ "payloadSHA256": "8da78c2e920e50bfc161c3e7f236bed531581ac5005220818a69f15e94aeafd7",+ },+ "local/ambient-main": {+ "manifestWrites": 1,+ "payloadSHA256": "3655b224dc8e5b084b0a3a97410394badf0c411838470d3c191b9f7ef499a508",+ },+ "local/east": {+ "manifestWrites": 0,+ "payloadSHA256": "01c6c651ce1dbe0108044ec268aa4aa75cc364faa14d9c366c266d067e5bc037",+ },+ "local/main": {+ "manifestWrites": 1,+ "payloadSHA256": "652c79b1af5ced63055aed1ca002730b30e889e76ddaace9086fc82d5a798a39",+ },+ "local/main-reroll": {+ "manifestWrites": 0,+ "payloadSHA256": "4c828a15f8eca717a498f90b2a0469e3ca2a5eb9c18019805c947a9c6037e7d8",+ },+ "local/turnaround": {+ "manifestWrites": 1,+ "payloadSHA256": "02aa273d1b41b9a29809e5e62ead21587be57aaca11fc04a8b57e31b42e40afe",+ },+ }+ `);+ });+it('404s an unknown record and queues a props main reference for the ambient workflow', async () => {await expect(startReferenceGeneration('nope', { target: 'main', designPrompt: 'x' })).rejects.toMatchObject({ code: 'NOT_FOUND' });