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: hoist LLM_DRILL_TYPES into the postDrillTypes leaf so server and client share one list (#6824)
[._.]/ Adam Eivyb8920b1f1773
diff --git a/client/src/components/meatspace/post/PostDrillConfig.test.jsx b/client/src/components/meatspace/post/PostDrillConfig.test.jsxindex d15b476d7c..8e8a8c75ed 100644--- a/client/src/components/meatspace/post/PostDrillConfig.test.jsx+++ b/client/src/components/meatspace/post/PostDrillConfig.test.jsx@@ -16,10 +16,11 @@ import PostDrillConfig from './PostDrillConfig';import { updatePostConfig, getProviders, getPostAdaptivePreview, getPostMultiplicationProgress, getPostPowersProgress, getPostCognitiveProgress, getMemoryItems } from '../../../services/api';import { LLM_DRILL_TYPES, DRILL_LABELS, COGNITIVE_DRILL_TYPES, COGNITIVE_LADDER_TYPES } from './constants';-// The generatable LLM drill types + labels, imported from the canonical-// client constant (mirrors server LLM_DRILL_TYPES in meatspacePostLlm.js) —-// NOT a hardcoded parallel copy, so this test can't stay green against a-// stale list if a drill type is ever added/removed/relabeled.+// The generatable LLM drill types + labels, imported from the client constant+// (itself a re-export of the server's LLM_DRILL_TYPES in+// server/lib/postDrillTypes.js) — NOT a hardcoded parallel copy, so this test+// can't stay green against a stale list if a drill type is ever+// added/removed/relabeled.const ALL_LLM_TYPES = LLM_DRILL_TYPES;// The 5 legacy drills that ship enabled by default (server DEFAULT_CONFIG);// everything else in ALL_LLM_TYPES is newly-exposed and defaults to opt-in.diff --git a/client/src/components/meatspace/post/constants.js b/client/src/components/meatspace/post/constants.jsindex 3f08249972..8fc3b6f931 100644--- a/client/src/components/meatspace/post/constants.js+++ b/client/src/components/meatspace/post/constants.js@@ -1,4 +1,6 @@-export const LLM_DRILL_TYPES = ['word-association', 'story-recall', 'verbal-fluency', 'wit-comeback', 'pun-wordplay', 'compound-chain', 'bridge-word', 'double-meaning', 'idiom-twist', 'what-if', 'alternative-uses', 'story-prompt', 'invention-pitch', 'reframe'];+// Every LLM-generated drill type. Re-exported from the server's zod-free leaf+// so the client and the server validation schemas share one definition.+export { LLM_DRILL_TYPES } from '../../../../../server/lib/postDrillTypes.js';// All three memory drill types are now fully scored in a POST session (issue// #2099/#2116): usePostSession.finishDrill uses this to tag the result's// module as `memory` (not `mental-math`) and preserve memoryItemId so thediff --git a/server/lib/README.md b/server/lib/README.mdindex d7d6f19068..861689e113 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -43,7 +43,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `fableLoomContinuity.js` | FableLoom episodic continuity review: multi-vector deterministic checks for visual entity bindings, convergence clarity, voice profile consistency/drift, pronunciation anchors, and playback safety. || `fableLoomOutline.js` | FableLoom story-first episode beat outlines: bounded log-lines, deterministic arc validation, and compact prompt rendering before teleplay expansion. || `fableLoomPlaytest.js` | FableLoom branching-playthrough harness: bounded exhaustive path enumeration, ending/loop/coverage diagnostics, aggregate loom reports, and compact traces for narrative-quality review. |-| `postDrillTypes.js` | MeatSpace POST drill vocabularies (`CACHEABLE_TYPES`, `COGNITIVE_DRILL_TYPES`), kept below validation so a route schema never pulls in the POST services (and, through them, the LLM drill generator). |+| `postDrillTypes.js` | MeatSpace POST drill vocabularies (`LLM_DRILL_TYPES`, `CACHEABLE_TYPES`, `COGNITIVE_DRILL_TYPES`, `POST_SUPPORTED_MEMORY_TYPES`), kept below validation so a route schema never pulls in the POST services (and, through them, the LLM drill generator). || `spriteVocabulary.js` | Sprite id pattern, record kinds, the canonical 8-direction order + derived anchor set, `TURNAROUND_ID`, and the animation provider ids — the alphabets the sprite route schemas enumerate, kept below the sprite services. || `spriteChromaKey.js` | Chroma-key selection color math (`CHROMA_KEYS`, `CHROMA_KEY_HEXES`, `DEFAULT_CHROMA_KEY`, hue-distance picking). Pure color math, no image I/O — that lives in `services/sprites/normalize.js`. || `spriteAnimationTracks.js` | The animation-track registry (`ANIMATION_TRACKS`, `WALK_TRACK`, `TRACK_BOUND_TRIPLES`, `AUTHORED_TRACK_FIELDS`) — a zero-import table of per-track frame/fps bounds. |diff --git a/server/lib/postDrillTypes.js b/server/lib/postDrillTypes.jsindex 8f2af86df4..d30769b513 100644--- a/server/lib/postDrillTypes.js+++ b/server/lib/postDrillTypes.js@@ -1,7 +1,7 @@/*** MeatSpace POST drill-type vocabulary.*- * These two lists sit below both validation and the POST services so a route+ * These lists sit below both validation and the POST services so a route* schema can enumerate a drill type without importing service-layer* orchestration (issue #4901). That mattered more than the layering nit:* `CACHEABLE_TYPES` used to live in `services/meatspacePostDrillCache.js`,@@ -9,10 +9,33 @@* every POST route, transitively pulled in the LLM path just to know four* strings.*- * A leaf module (no imports). The service modules re-export both lists, so- * existing deep imports keep working.+ * A leaf module (no imports). The service modules re-export the lists they+ * used to own, so existing deep imports keep working, and the client's+ * `meatspace/post/constants.js` re-exports them too — each vocabulary has+ * exactly one definition instead of a hand-copied server/client mirror.*/+// Every drill type the LLM drill generator (`services/meatspacePostLlm.js`)+// can produce and score. Also the enum behind the llm-drill config and task+// schemas in `lib/postValidation.js` and the client's "is this an LLM drill?"+// checks.+export const LLM_DRILL_TYPES = Object.freeze([+ 'word-association',+ 'story-recall',+ 'verbal-fluency',+ 'wit-comeback',+ 'pun-wordplay',+ 'compound-chain',+ 'bridge-word',+ 'double-meaning',+ 'idiom-twist',+ 'what-if',+ 'alternative-uses',+ 'story-prompt',+ 'invention-pitch',+ 'reframe',+]);+// Wordplay drills the cache can pre-generate and hold. A subset of the LLM// drill types — the ones cheap and deterministic enough to prime ahead of use.export const CACHEABLE_TYPES = Object.freeze([diff --git a/server/lib/postValidation.js b/server/lib/postValidation.jsindex 94d125cc1b..7c16bc08f7 100644--- a/server/lib/postValidation.js+++ b/server/lib/postValidation.js@@ -1,5 +1,5 @@import { z } from 'zod';-import { CACHEABLE_TYPES, COGNITIVE_DRILL_TYPES, POST_SUPPORTED_MEMORY_TYPES } from './postDrillTypes.js';+import { CACHEABLE_TYPES, COGNITIVE_DRILL_TYPES, LLM_DRILL_TYPES, POST_SUPPORTED_MEMORY_TYPES } from './postDrillTypes.js';import { TOPIC_IDS } from './postTopics.js';import { HHMM_STRICT_RE } from './timezone.js';import { POST_LLM_MAX_SEMANTIC_CANDIDATES, postLlmEvaluationSchema } from './postLlmContracts.js';@@ -97,10 +97,10 @@ const llmResponseSchema = z.object({// Drill type configurationconst MATH_DRILL_TYPES = ['doubling-chain', 'serial-subtraction', 'multiplication', 'powers', 'estimation', 'applied-numeracy'];-const LLM_DRILL_TYPES = ['word-association', 'story-recall', 'verbal-fluency', 'wit-comeback', 'pun-wordplay', 'compound-chain', 'bridge-word', 'double-meaning', 'idiom-twist', 'what-if', 'alternative-uses', 'story-prompt', 'invention-pitch', 'reframe'];const MEMORY_DRILL_TYPES = ['memory-fill-blank', 'memory-sequence', 'memory-element-flash'];-// POST_SUPPORTED_MEMORY_TYPES lives in ./postDrillTypes.js (a zod-free leaf,-// re-exported by the client's meatspace/post/constants.js) — imported above.+// LLM_DRILL_TYPES, COGNITIVE_DRILL_TYPES and POST_SUPPORTED_MEMORY_TYPES live in+// ./postDrillTypes.js (a zod-free leaf, re-exported by the client's+// meatspace/post/constants.js) — imported above, so each list has one owner.// Canonical set of coarse "module" tags a scored POST task/session can carry// (mental-math / llm-drills / cognitive drills / memory drills). Shared by the// session-submit schema (below) and sessionModules config so a typo'd module@@ -108,8 +108,7 @@ const MEMORY_DRILL_TYPES = ['memory-fill-blank', 'memory-sequence', 'memory-elem// `byModule` stats bucket (issue #2099). Morse is deliberately excluded — it// only ever posts through the separate, unrestricted `trainingEntrySchema`.const POST_MODULES = ['mental-math', 'llm-drills', 'cognitive', 'memory'];-// Cognitive drills (deterministic, no LLM) — n-back / digit-span / stroop.-// Sourced from meatspacePostCognitive.js so the type list has one owner.+// Every scored drill type across the four modules — backs taskResultSchema.type.const DRILL_TYPES = [...MATH_DRILL_TYPES, ...LLM_DRILL_TYPES, ...MEMORY_DRILL_TYPES, ...COGNITIVE_DRILL_TYPES];// Morse trainer drill types (client-side scoring — exact-match copy/send comparison).// Deliberately NOT spliced into DRILL_TYPES: that array also backsdiff --git a/server/services/meatspacePostLlm.js b/server/services/meatspacePostLlm.jsindex 8a4f529784..7e379b9aca 100644--- a/server/services/meatspacePostLlm.js+++ b/server/services/meatspacePostLlm.js@@ -23,22 +23,10 @@ import {validatePostLlmSemanticVerdicts,} from '../lib/postLlmContracts.js';-export const LLM_DRILL_TYPES = [- 'word-association',- 'story-recall',- 'verbal-fluency',- 'wit-comeback',- 'pun-wordplay',- 'compound-chain',- 'bridge-word',- 'double-meaning',- 'idiom-twist',- 'what-if',- 'alternative-uses',- 'story-prompt',- 'invention-pitch',- 'reframe',-];+// The list lives in the zod-free leaf so lib/postValidation.js and the client+// can share it without importing this module; re-exported here so existing+// deep imports keep working.+export { LLM_DRILL_TYPES } from '../lib/postDrillTypes.js';// ─────────────────────────────────────────────────────────────────────────────// AI CALLER (mirrors brain.js pattern)