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 local review: derive the describe job's scope list from BIBLE_KEYS and reuse sanitizeBibleField
[._.]/ Adam Eivy4f24cf9b6194
diff --git a/server/lib/quotaBurnConfig.js b/server/lib/quotaBurnConfig.jsindex 162ebffb5d..648ff06ad8 100644--- a/server/lib/quotaBurnConfig.js+++ b/server/lib/quotaBurnConfig.js@@ -23,7 +23,7 @@*/import { isPlainObject, POLLUTING_KEYS } from './objects.js';-import { BIBLE_DESCRIBE_DEPTHS } from './universeBibleCompleteness.js';+import { BIBLE_DESCRIBE_DEPTHS, BIBLE_DESCRIBE_SCOPES } from './universeBibleCompleteness.js';/** Provider quota families a burn plan may target. Mirrors `providerUsage.js`'s card ids. */export const QUOTA_BURN_FAMILIES = Object.freeze(['claude', 'codex', 'agy', 'grok']);@@ -158,7 +158,7 @@ export const QUOTA_BURN_JOB_CATALOG = Object.freeze([programmatic: true,params: Object.freeze([{ key: 'universeId', kind: 'universe', label: 'Universe', default: 'all', emptyLabel: 'All universes', emptyValue: 'all' },- { key: 'scope', kind: 'enum', label: 'Entries', options: ['all', 'characters', 'places', 'objects'], default: 'all' },+ { key: 'scope', kind: 'enum', label: 'Entries', options: BIBLE_DESCRIBE_SCOPES, default: 'all' },// `full` is the default because the job exists for the sheet, not the// one-line description: a cast member with a description and nothing else// still renders inconsistently from panel to panel.diff --git a/server/lib/universeBibleCompleteness.js b/server/lib/universeBibleCompleteness.jsindex 090aed37b8..550811259d 100644--- a/server/lib/universeBibleCompleteness.js+++ b/server/lib/universeBibleCompleteness.js@@ -24,11 +24,19 @@* scan, so the two are deliberately one list rather than two that agree today.*/-import { isBlank } from './storyBible.js';+import { BIBLE_KEYS, isBlank } from './storyBible.js';/** Depth vocabulary. `core` = renderable at all; `full` = the whole sheet. */export const BIBLE_DESCRIBE_DEPTHS = Object.freeze(['core', 'full']);+/**+ * Which entries a describe pass covers: everything, or one canon bucket. Derived+ * from `BIBLE_KEYS` so the job catalog's option list and the job's own scope→kind+ * table move together — a renamed or added canon kind that reached only one of+ * them would leave stored jobs carrying a `scope` that matches nothing.+ */+export const BIBLE_DESCRIBE_SCOPES = Object.freeze(['all', ...BIBLE_KEYS]);+/*** The three slider axes, all of which must be rated for `sliders` to count as* filled. Exported so the character expand's merge rates the same three.diff --git a/server/services/quotaBurnJobs/universeBibleDescribe.js b/server/services/quotaBurnJobs/universeBibleDescribe.jsindex 399d1f8932..3fce61eaf6 100644--- a/server/services/quotaBurnJobs/universeBibleDescribe.js+++ b/server/services/quotaBurnJobs/universeBibleDescribe.js@@ -28,24 +28,22 @@import { expandUniverseCharacter } from '../universeCharacterExpand.js';import { expandUniverseCanonEntry } from '../universeCanonEntryExpand.js';import { getQuotaBurnInFlight, recordQuotaBurnInFlight } from '../quotaBurnStore.js';-import { BIBLE_FIELD, BIBLE_KEYS, BIBLE_KIND, BIBLE_KINDS } from '../../lib/storyBible.js';+import { BIBLE_FIELD, BIBLE_KIND, BIBLE_KINDS } from '../../lib/storyBible.js';import { bibleEntryCompleteness, normalizeDescribeDepth } from '../../lib/universeBibleCompleteness.js';import { collectUniverseBacklog } from './universeBacklog.js';import { noProviderReason, resolveBurnProvider } from './providerPick.js';/**- * Scope value → the canon kinds it selects, derived from `BIBLE_FIELD` rather- * than restated, so a future canon kind reaches this job's picker for free (the- * scope option list in the job catalog is the one place it still needs naming).- * Order matters: `all` walks the cast first.+ * Scope value → the canon kinds it selects. Both the keys and the kind lists are+ * derived from `BIBLE_FIELD`, and the job catalog renders its option list from+ * the same `BIBLE_DESCRIBE_SCOPES` — so a future canon kind (or a renamed one)+ * reaches the picker and the form together instead of orphaning stored jobs+ * whose `scope` no longer matches anything.*/const SCOPE_KINDS = Object.freeze({all: BIBLE_KINDS,...Object.fromEntries(BIBLE_KINDS.map((kind) => [BIBLE_FIELD[kind], [kind]])),});-// Pinned so a rename of a `BIBLE_FIELD` value can't silently orphan a stored-// job's `scope` — the catalog's option list has to move with it.-export const DESCRIBE_SCOPES = Object.freeze(['all', ...BIBLE_KEYS]);/*** One in-flight key per ENTRY (ids are unique, unlike the image job's labels),@@ -53,8 +51,6 @@ export const DESCRIBE_SCOPES = Object.freeze(['all', ...BIBLE_KEYS]);*/export const describeInFlightKey = (universeId, kind, entryId) => `describe:${universeId}:${kind}:${entryId}`;-const entryLabel = (entry) => entry?.name || entry?.slugline || entry?.id || '';-/*** Every under-described entry in one universe. Unordered — `sortRows` below is* what ranks the ones actually picked.diff --git a/server/services/universeCanonEntryExpand.js b/server/services/universeCanonEntryExpand.jsindex 9147fb989c..3d4c2aac8e 100644--- a/server/services/universeCanonEntryExpand.js+++ b/server/services/universeCanonEntryExpand.js@@ -21,7 +21,7 @@import { buildStyleClause } from './universeCanon.js';import { runCanonEntryExpand } from './universeCanonExpandRunner.js';import { ServerError } from '../lib/errorHandler.js';-import { BIBLE_KIND, SANITIZERS } from '../lib/storyBible.js';+import { BIBLE_KIND, SANITIZERS, sanitizeBibleField } from '../lib/storyBible.js';import { BIBLE_EXPAND_FIELDS, bibleFieldIsBlank } from '../lib/universeBibleCompleteness.js';/** Kinds this module expands. Characters route to `universeCharacterExpand.js`. */@@ -48,24 +48,20 @@ const peerForExpandPrompt = (entry) => ({*/export function applyCanonEntryExpansion(kind, target, content) {const groups = BIBLE_EXPAND_FIELDS[kind];- const sanitize = SANITIZERS[kind];- if (!groups || !sanitize || !target || typeof target !== 'object' || !content || typeof content !== 'object') {+ if (!groups || !SANITIZERS[kind] || !target || typeof target !== 'object' || !content || typeof content !== 'object') {return { merged: target, updatedFields: [] };}const merged = { ...target };const updatedFields = [];+ // Places and objects have no list or structured fields — strings and enums are+ // the whole surface, which is why this merge is a single loop where the+ // character one needs four.for (const field of [...groups.strings, ...groups.enums]) {if (!(field in content)) continue;const proposed = content[field];if (typeof proposed !== 'string' || !proposed.trim()) continue;if (!bibleFieldIsBlank(target, field)) continue;- // `name`/`slugline` carry the record past the sanitizer's identity check —- // a place needs one of them or `sanitizePlace` returns null and every- // proposal would be discarded as unsanitizable.- const cleaned = sanitize(- { name: target.name, slugline: target.slugline, [field]: proposed },- { preserveTimestamps: false },- )?.[field];+ const cleaned = sanitizeBibleField(kind, target, field, proposed);if (typeof cleaned !== 'string' || !cleaned.trim()) continue;merged[field] = cleaned;updatedFields.push(field);