Skip to content

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

1.0 KB
Raw Blame
/**
 * Writers Room — editable recurring-objects bible.
 *
 * Per-work canonical roster stored at data/writers-room/works/<workId>/
 * objects.json. CRUD + file I/O + dedup rules all live in the shared
 * `createBibleStore` factory; this module just supplies the per-kind config.
 */

import { BIBLE_KIND, normalizeBibleName } from '../../lib/storyBible.js';
import { createBibleStore } from '../bibleStore.js';

export const {
  list: listObjects,
  get: getObject,
  create: createObject,
  update: updateObject,
  remove: deleteObject,
  mergeExtracted: mergeExtractedObjects,
} = createBibleStore({
  kind: BIBLE_KIND.OBJECT,
  idPrefix: 'wr-object-',
  dedupKey: (entry) => normalizeBibleName(entry?.name),
  primaryFields: ['name'],
  editableFields: ['aliases', 'description', 'significance', 'notes'],
  requireOnCreate: (patch) => (String(patch?.name || '').trim() ? null : 'Object name required'),
  conflictMessage: ({ name }) => `An object named "${name}" already exists`,
  notFoundLabel: 'Object',
  invalidIdMessage: 'Invalid object id',
});