Commit graph

822 commits

Author SHA1 Message Date
munimunigamer
09429d2cbd chore: bump version to 0.7.0-pre.3 2026-02-19 21:10:48 -06:00
munimunigamer
71fcf951d6
Merge pull request #153 from AventurasTeam/feat/runtime-variables
Feat/runtime variables
2026-02-19 20:36:06 -06:00
munimunigamer
e6dd0dfb62 fix: use max-suffix approach for nextVariableName instead of linear scan
Find the highest existing suffix in one pass rather than scanning from 2
upward looking for gaps.
2026-02-19 00:21:26 -06:00
munimunigamer
97f4d61732 fix: wrap multi-DB-write operations in transactions
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.
2026-02-19 00:19:43 -06:00
munimunigamer
bd1accaba0 fix: use lucide-svelte Icon base type instead of typeof Heart
Replace arbitrary `typeof Heart` with `typeof Icon` from lucide-svelte's
exported base class for icon map typings across all runtime variable components.
2026-02-19 00:16:10 -06:00
munimunigamer
0c724e1859 refactor: remove ExtendedClassificationResult in favor of ClassificationResult
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.
2026-02-18 14:55:11 -06:00
munimunigamer
22d1607f79 fix: wrap icon in span for title tooltip to fix type error 2026-02-18 09:27:55 -06:00
munimunigamer
921df4176c fix: remove unused entityId prop and eslint-disable directives
Remove unused entityId from RuntimeVariableDisplay props and all call
sites. Replace eslint-disable any comments with proper typeof Heart
typing across icon maps.
2026-02-18 09:26:58 -06:00
munimunigamer
4b8ae1b337 clearerd out unnecessary entityId 2026-02-18 02:30:35 -06:00
munimunigamer
3a76c6ff8e fix: improve runtime variable display spacing and color picker placement
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.
2026-02-18 02:26:50 -06:00
munimunigamer
ebf58005f7 removed unnecessary extra migration 33 2026-02-18 02:01:12 -06:00
munimunigamer
6af9bfa0b2 fix: fixed up and down arrows to be more properly aligned 2026-02-18 01:51:45 -06:00
munimunigamer
5245f72c88 more colors! 2026-02-18 01:48:32 -06:00
munimunigamer
18298c8d1e fix: redesign RuntimeVariableDisplay as vertical stat rows
- 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
2026-02-18 01:36:48 -06:00
munimunigamer
87ea7e5fbc feat(quick-008): redesign RuntimeVariableDisplay as compact chips and wire pinned/unpinned split
- 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)
2026-02-18 01:31:20 -06:00
munimunigamer
c43360bdb0 feat(quick-008): add pinned field, reorder buttons, and pinned toggle to runtime 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
2026-02-18 01:27:57 -06:00
munimunigamer
08d9147a00 feat(07-04): integrate RuntimeVariableDisplay into InventoryPanel and QuestPanel
- 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
2026-02-17 23:36:18 -06:00
munimunigamer
7e111651d9 feat(07-04): integrate RuntimeVariableDisplay into CharacterPanel and LocationPanel
- 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
2026-02-17 23:30:46 -06:00
munimunigamer
c137d6cf32 feat(07-05): register runtime variable context variables in variable registry
- 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
2026-02-17 23:28:00 -06:00
munimunigamer
ee6ad82c30 feat(07-04): create RuntimeVariableDisplay and RuntimeVariableEditor components
- 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
2026-02-17 23:27:24 -06:00
munimunigamer
a03b79a06a feat(07-05): add runtime variable values to ContextBuilder template context
- 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
2026-02-17 23:27:17 -06:00
munimunigamer
ce30880735 feat(07-02): integrate runtime variables into classifier pipeline
- 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
2026-02-17 23:18:49 -06:00
munimunigamer
a612579e24 feat(07-03): create RuntimeVariableManager and integrate into PromptPackEditor
- 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
2026-02-17 23:18:01 -06:00
munimunigamer
c6d3ac28e7 feat(07-03): create IconPicker, ColorPicker, and RuntimeVariableCard components
- IconPicker: searchable Lucide icon picker with 43 curated icons in popover grid
- ColorPicker: 16 color swatch picker with checkmark selection indicator
- RuntimeVariableCard: expandable card for editing runtime variable definitions
  - Supports all fields: variableName, displayName, entityType, variableType,
    description, color, icon, defaultValue, min/max for numbers, enum options
  - Inline type change warning before clearing values
  - Inline delete confirmation with entity count display
  - Snake_case enforcement on variable name input
  - onRename callback for variable name changes on blur
2026-02-17 23:14:20 -06:00
munimunigamer
e3a80adea9 feat(07-02): dynamic Zod schema factory for runtime variable extraction
- 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
2026-02-17 23:10:09 -06:00
munimunigamer
92c9b6501f feat(07-01): add runtime variable CRUD and entity value operations
- 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
2026-02-17 23:00:17 -06:00
munimunigamer
50ddbafbeb feat(07-01): add RuntimeVariable types and database migration
- Add RuntimeVariable, RuntimeVariableType, RuntimeEntityType, RuntimeVariableValue, RuntimeVarsMap types
- RuntimeVarsMap keyed by defId (not variableName) for free rename support
- Add runtimeVariables field to FullPack interface
- Create migration 032: pack_runtime_variables table with constraints and indexes
- Register migration 032 in lib.rs
2026-02-17 22:59:03 -06:00
munimunigamer
0a38329b95
Merge pull request #152 from AventurasTeam/fix/autocomplete-for-providers
Replace provider type dropdown with searchable autocomplete
2026-02-17 21:32:36 -06:00
munimunigamer
98f89d4d3b Replace provider type dropdown with searchable autocomplete 2026-02-17 21:22:08 -06:00
munimunigamer
617007ecb5
Merge pull request #151 from AventurasTeam/fix/quick-dev-fixes
Fix/quick dev fixes
2026-02-17 21:17:25 -06:00
munimunigamer
b332388dd2 Fix Svelte state_referenced_locally warning in VariableCard
Initialize lastVariableId as empty string instead of capturing
variable.id outside a reactive context. The $effect.pre handles
the initial sync on mount.
2026-02-17 21:02:22 -06:00
munimunigamer
7087369310 Run prettier on remaining vault prompt files 2026-02-17 21:01:02 -06:00
munimunigamer
81c0cd5dec Run prettier on modified files 2026-02-17 21:00:15 -06:00
munimunigamer
b01e64873c Fix new packs copying from modified default-pack DB row
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.
2026-02-17 20:34:27 -06:00
munimunigamer
3fbaeb918d Fix silent empty render in template engine
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.
2026-02-17 20:25:47 -06:00
munimunigamer
5610ee174b Fix variable name regex mismatch between UI and import validation
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.
2026-02-17 20:25:03 -06:00
munimunigamer
55845d5896 Fix handleSaveAndSwitch ignoring save failure
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.
2026-02-17 20:24:44 -06:00
munimunigamer
85b77dd4ba Fix import replace strategy bypassing story usage check
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.
2026-02-17 20:24:26 -06:00
munimunigamer
9ba079c880 Fix unchecked JSON.parse in pack variable and story custom variables
Wrap JSON.parse calls in mapPackVariable (enum_options) and
getStoryCustomVariables in try/catch to prevent crashes on
malformed database data.
2026-02-17 20:24:06 -06:00
munimunigamer
c4c6c9a1a5 Fix VariableCard $effect.pre resetting all cards on any change
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.
2026-02-17 20:23:46 -06:00
munimunigamer
cbf3a4a38e Fix duplicate migration 025 filename prefix
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.
2026-02-17 20:23:37 -06:00
Tony Frazier
cc163c3aad
Merge pull request #150 from AventurasTeam/release/v0.7.0-pre.2
Release/v0.7.0 pre.2
2026-02-17 20:43:45 -05:00
Tony Frazier
3203dfbaea chore: bump version to 0.7.0-pre.2 2026-02-17 20:31:02 -05:00
Tony Frazier
5fd37fcb24 Fix upstream repo in release.js 2026-02-17 20:28:43 -05:00
munimunigamer
39d77f7157
Merge pull request #92 from AventurasTeam/feat/jinja-prompting
Feat/jinja prompting
2026-02-17 19:14:56 -06:00
Tony Frazier
37509e904d Fix merge issue 2026-02-17 20:12:02 -05:00
Tony Frazier
dafd788735 Merge remote-tracking branch 'origin/dev' into feat/jinja-prompting 2026-02-17 20:05:24 -05:00
munimunigamer
457548011f
Merge pull request #85 from AventurasTeam/feat/separate-image-profiles
Feat/separate image profiles
2026-02-17 19:00:20 -06:00
munimunigamer
085ceb82e8
Merge branch 'dev' into feat/separate-image-profiles 2026-02-17 18:59:46 -06:00
munimunigamer
42b2f892f4 small typesscript fixes 2026-02-17 01:51:49 -06:00