Add withTransaction() helper to DatabaseService. Wrap handleDeleteVariable,
handleRenameVariable, handleTypeChange, and moveVariable in transactions so
partial writes can't leave the database in an inconsistent state. Also alias
Icon import as LucideIcon where it conflicts with local variables.
Replace arbitrary `typeof Heart` with `typeof Icon` from lucide-svelte's
exported base class for icon map typings across all runtime variable components.
Fold the optional _runtimeVarDefs field directly into ClassificationResult
instead of maintaining a separate wrapper type. Simplifies imports across
6 consumer files and removes an unnecessary re-export.
Remove unused entityId from RuntimeVariableDisplay props and all call
sites. Replace eslint-disable any comments with proper typeof Heart
typing across icon maps.
Move color picker underneath panel label in RuntimeVariableCard for
better visual grouping. Add class prop to RuntimeVariableDisplay for
parent-controlled spacing. Use conditional margins (mt-2 collapsed,
mt-1 expanded) on pinned vars and mt-1.5 on non-pinned vars for
consistent spacing across all entity panels.
- Replace fragmented chip layout with full-width vertical rows
- Respect icon-only setting (show icon without displayName when icon is set)
- Text variables now show full text at full width (no truncation)
- Number+range progress bar is full width (not tiny w-16 inside chip)
- Remove border-t divider for cleaner integration with entity panels
- Include uncommitted runtime variable schema and store changes
- Rewrite RuntimeVariableDisplay with chip-based flex-wrap layout
- Each chip shows both icon AND displayName with color-mix tinted background
- Number+range variables show inline stat bar inside chip
- Enum variables show as colored badge chips
- Text variables show as truncated text chips
- Not-set variables appear dimmed with -- placeholder
- Add pinnedOnly prop to filter by pinned state
- Split all entity panels into pinned (always visible) + non-pinned (collapsible)
- CharacterPanel, LocationPanel, InventoryPanel, QuestPanel updated
- Edit-mode instances unchanged (show all variables)
- Create migration 033 to add pinned column to pack_runtime_variables
- Register migration in Tauri lib.rs
- Add pinned boolean to RuntimeVariable type
- Update mapRuntimeVariable, createRuntimeVariable, updateRuntimeVariable in database.ts
- Add Pin toggle button in RuntimeVariableCard edit form
- Show Pin icon in RuntimeVariableCard collapsed header
- Add move up/down reorder buttons per variable in RuntimeVariableManager
- Pass pinned through handleUpdateVariable and handleAddVariable
- InventoryPanel: runtime vars in all 3 item sections (equipped, backpack, world)
with display and edit modes for each
- QuestPanel: runtime vars in both active and history beat sections
- Both panels load definitions via database.getRuntimeVariablesByEntityType
- All four entity panels now have identical runtime variable integration
- CharacterPanel: display runtime vars after expanded details, edit in edit mode
- LocationPanel: display runtime vars for both current and non-current locations
- Both panels load definitions via database.getRuntimeVariablesByEntityType
- Edit mode initializes editRuntimeVars from entity metadata
- Save merges editRuntimeVars back into entity metadata.runtimeVars
- Add runtimeVars_characters, runtimeVars_locations, runtimeVars_items entries
- Add runtimeVars_storyBeats and runtimeVars_protagonist entries
- Add customVariableInstructions (used by classifier, now registered for autocomplete)
- All entries in 'runtime' category for template editor variable palette
- RuntimeVariableDisplay renders all variable types with distinct visuals:
number+range as colored stat bars, number-only as colored numeric,
text as colored text, enum as colored badge/pill
- Values keyed by defId from metadata.runtimeVars
- RuntimeVariableEditor provides type-appropriate inline editing
(text input, number input with min/max, enum select dropdown)
- Both handle 'Not set' state with dimmed icon/label
- Shared icon map (43 Lucide icons) matching IconPicker curated set
- Sorted by definition sortOrder
- Load runtime variable definitions from pack in forStory()
- Extract entity runtimeVars from metadata for characters, locations, items, story beats
- Format as flat text blocks: runtimeVars_characters, runtimeVars_locations, etc.
- Dedicated runtimeVars_protagonist for protagonist-only values
- Graceful fallback to empty strings when no definitions or values exist
- Error handling wraps entire operation with empty-string defaults
- ClassifierService loads runtime var defs from pack, builds extended schema
- Inject custom variable instructions into classifier prompt dynamically
- Use ExtendedClassificationResult type throughout pipeline (backwards-compatible)
- Post-process: clamp number values to min/max constraints after extraction
- applyClassificationResult merges customVars into entity metadata.runtimeVars
- Values keyed by defId (not variableName) for free rename support
- Before-state snapshots capture metadata for proper rollback
- RollbackService restores metadata on undo
- Update generation pipeline types for ExtendedClassificationResult
- RuntimeVariableManager: groups variables by entity type with section headers
- CRUD operations: add, update, delete, rename, type-change
- Delete uses packId-based clearRuntimeVarFromEntities across all stories
- Rename calls renameRuntimeVarInEntities to update variableName copies
- Type change warns then clears all values via packId-based method
- Soft warning at 10+ variables per entity type
- Entity count cache for delete confirmation display
- PromptPackEditor: new 'Runtime Vars' tab alongside Variables
- showRuntimeVars state with mutual exclusion from other views
- Runtime variables loaded via updated packService.getFullPack
- TemplateGroupList: added Runtime Vars nav button with Activity icon
- pack-service.ts: getFullPack now loads runtimeVariables in parallel
- Create runtime-variables.ts with buildVariableSchema, buildEntityCustomVarsSchema,
buildExtendedClassificationSchema, and ExtendedClassificationResult type
- Handle single-element enums with z.literal (avoid z.union crash)
- Add clampNumber utility to classifier.ts for post-extraction number clamping
- Update classifier template in analysis.ts with customVariableInstructions block
- Add refreshDefaultPackTemplates to pack-service for auto-updating stale templates
- Add getRuntimeVariables, getRuntimeVariablesByEntityType for definition queries
- Add createRuntimeVariable, updateRuntimeVariable, deleteRuntimeVariable for definition CRUD
- Add getStoriesUsingPack to find all stories sharing a pack
- Add countEntitiesWithRuntimeVar for deletion warning counts
- Add clearRuntimeVarFromEntities to strip values on definition delete
- Add renameRuntimeVarInEntities to update variableName copy on rename
- All entity operations accept packId and work across all stories sharing the pack
- Add mapRuntimeVariable private helper for row-to-type conversion
Initialize lastVariableId as empty string instead of capturing
variable.id outside a reactive context. The $effect.pre handles
the initial sync on mount.
createPack now seeds templates from PROMPT_TEMPLATES (code baseline)
instead of copying from the database's default-pack, which may have
user-modified templates and test variables. New packs start clean
with no custom variables.
render() returned '' on error, indistinguishable from an empty
template. Now returns null on error. Context builder falls back to
raw template content instead of sending empty prompts to AI.
TemplatePreview uses null check for clearer error detection.
The UI allowed uppercase letters in variable names but import
validation only allowed lowercase, so variables created in the UI
could fail to round-trip through export/import. Aligned to lowercase
only to match Liquid variable conventions.
Previously, if editorRef.save() failed (returned false), the dialog
still closed and the pending navigation executed, discarding changes.
Now bails early on save failure so the user stays on the editor.
The replace strategy deleted the existing pack without checking if
stories reference it, which could orphan story pack_id references.
Now checks getPackUsageCount and throws if stories are assigned.
The $effect.pre tracked the entire variable prop, causing all
VariableCards to collapse and reset their edit state whenever any
variable in the list changed. Now tracks variable.id so only the
card whose identity changed gets reset.
Renamed 025_preset_packs.sql → 030_preset_packs.sql and
030_pack_variable_extensions.sql → 031_pack_variable_extensions.sql
to match their actual version numbers (30 and 31) in lib.rs,
resolving the collision with 025_world_state_deltas.sql.