Commit Graph

48 Commits

Author SHA1 Message Date
Tremendoussly 19ebf1a834 Merge upstream/main into doom-lite-expression-sync-v2 2026-04-14 16:21:07 +02:00
Tremendoussly 1a11699522 Rename expression sync to thought-based expression portraits and clean up compatibility solutions 2026-03-15 22:18:25 +01:00
Tremendoussly c73c0c2bb6 First attempt at adding expression sync 2026-03-08 23:25:22 +01:00
Tremendoussly 2f98686e60 Add optional below-chat Present Characters panel (#3) 2026-03-08 22:58:42 +01:00
Tremendoussly ae9e44eafb Alternate Thoughts Display (#2)
This PR adds an optional alternate display mode for RPG Companion thoughts.

When enabled, thoughts are shown as compact expandable cards directly below the relevant latest character message. When disabled, RPG Companion keeps its original corner/overlay thought bubbles, so the existing behavior is preserved unless the user explicitly switches modes.

The new display mode is built on top of RPG Companion’s existing thoughts system rather than replacing it. Thought UI now updates more reliably across new generations, swipe changes, message deletion, chat reload/re-entry, and live mode toggling, so thoughts stay attached to the correct visible message instead of lingering on stale UI. It also improves restoration of RPG Companion state after reopening a chat, making thoughts and related tracker data more consistent with the current chat view.
2026-03-08 19:54:38 +01:00
Daryl 03345b81f4 Update Refresh RPG Info buttons in index.js to call commitTrackerDataFromPriorMessage() before updateRPGData() 2026-02-26 17:59:45 -04:00
Spicy Marinara 8ea9044492 Update src/core/persistence.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-26 01:47:42 +01:00
Spicy Marinara 5b2cb331c8 Update src/core/persistence.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-25 23:57:30 +01:00
Daryl 76beb5dff4 Add inheritSwipeDataFromPriorMessage function to populate swipe slots with tracker data from prior messages in cases where tracker auto-update is disabled. This maintains the paradigm of every swipe having saved tracker data, which can then be regenerated by the user manually if they so choose. 2026-02-22 03:53:59 -04:00
Daryl 8f2dbd2f88 Implement swipe data persistence between reloads and ensure all tracker data commits are based on prior assistant message when generating/swiping 2026-02-21 21:40:52 -04:00
Daryl f3e7518622 Enhance swipe data handling to correctly display swipe-specific tracker stats: add getSwipeData function and refactor commitTrackerData to utilize it 2026-02-21 20:40:33 -04:00
Spicy_Marinara ea81dd0634 v3.7.0: Merge PR #109 + opacity sliders + custom attributes fix + context instructions prompt + newline fixes 2026-01-27 14:33:36 +01:00
Spicy_Marinara e8edc42164 v3.6.0 - Bug fixes and number display mode for stats
- Fixed custom status fields not being sent to prompts or parsed
- Fixed date format selection not working beyond default format
- Fixed widget text overflow issues with minimal scrollbars
- Added ability to display stats as numbers with custom max values instead of percentages
- Enabled desktop strip widgets by default
- Removed icon from Desktop Collapsed Strip Widgets heading
2026-01-13 13:52:18 +01:00
tomt610 bc4f50a82f fix(presets): defer association changes until Save & Apply
- Add isAssociatedWithCurrentPreset() helper to check if entity is associated with the CURRENT preset (not just any preset)
- Fix checkbox to correctly reflect association with currently selected preset
- Introduce tempAssociation state to track pending association changes
- Only save association changes when clicking Save & Apply, not on preset switch
- Discard pending association changes when clicking X/Cancel
- Auto-update association when switching presets if checkbox was checked
- Improve toast messages to clarify when changes will be applied

Fixes issue where checkbox showed incorrect state and association was saved immediately without waiting for Save & Apply.
2026-01-11 14:58:17 +00:00
Spicy_Marinara 995f3a7a98 Add Deception System and CYOA features with toggles, custom prompts, and proper injection ordering 2026-01-10 20:24:41 +01:00
tomt610 ecb5d74d6e Enhance preset saving and loading to include historyPersistence 2026-01-09 21:05:11 +00:00
Spicy_Marinara f5641ec1f0 Merge branch 'pr-88' 2026-01-09 12:11:51 +01:00
Spicy_Marinara 510723cac4 v3.3.3
- Strengthened default prompts to not include user's persona in the characters' section.
- Updated some descriptions for buttons and custom fields.
2026-01-09 11:54:43 +01:00
tomt610 f6733f87a2 feat: Add preset management system for tracker configurations
- Add preset selector dropdown in tracker editor modal
- Support creating, loading, and deleting presets
- Add per-character/group preset associations with auto-switch
- Add default preset functionality with star button
- Update import to offer 'Apply to Current' or 'Create New Preset' options
- Add preset management UI styles and import dialog styles
2026-01-09 10:38:57 +00:00
Spicy_Marinara a3063aff4f v3.1.0: Add parser error detection and recommended models section 2026-01-07 22:56:26 +01:00
Spicy_Marinara c3cdac24c6 Release v3.0.0 - Major update with JSON format, lock/unlock trackers, reorganized UI, colored dialogues, editable prompts, and numerous bug fixes 2026-01-07 17:22:22 +01:00
Spicy_Marinara c6b71ec1aa Add optional toggle for Relationship Status Fields (v2.1.2)
- Added relationships.enabled toggle in tracker configuration
- Relationship fields and emoji badges can now be disabled/enabled
- UI toggle added in Edit Trackers > Present Characters tab
- Updated prompt generation to respect the toggle
- Maintains backward compatibility with existing configs
- Added i18n translations (en, zh-tw)
2026-01-03 00:55:29 +01:00
Spicy_Marinara 62ed7ffb18 v2.1: Add dynamic weather effects, clothing inventory, and bug fixes
Features:
- Add dynamic weather effects system (snow, rain, mist, sunshine, storm, wind, blizzard)
- Add separate Clothing tab in inventory system
- Weather effects auto-update based on Info Box weather field
- Combined effects for storm (rain+lightning) and blizzard (snow+wind)

Improvements:
- Settings migration system for automatic feature enablement
- Weather effects positioned behind chat interface (z-index: 1)
- Dynamic weather enabled by default for new users

Bug Fixes:
- Fix tab visibility issues (disabled tabs now properly hide)
- Fix theme-aware borders (remove hardcoded blue colors)
- Fix double scrollbar in Edit Trackers window
- Fix scroll position jumping when editing Present Characters
- Fix dynamic weather toggle hiding issue

Technical:
- Update inventory schema to v2.1 with clothing field
- Add automatic migration for existing v2 inventories
- Update parsers and prompts to handle clothing separately
- Add translations (EN/ZH-TW) for new features
2026-01-02 13:58:43 +01:00
Spicy Marinara bfb63a34cd Revert "All the features" 2025-12-05 22:43:56 +01:00
Subarashimo 7e47dbfd7c chore: final cleanup 2025-12-05 18:10:21 +01:00
Subarashimo 38328de1bf fix: clear skills 2025-12-05 16:29:54 +01:00
Subarashimo 9f6c44745b feat: rpg stats improvements 2025-12-04 20:40:02 +01:00
Subarashimo c24515db7e fix: several issues 2025-12-03 22:34:50 +01:00
Subarashimo 0f7fdfcef1 feat: json format, et al. 2025-12-03 14:55:30 +01:00
Spicy_Marinara bd891e39b0 Fix: Quests now properly scoped per-chat
Quests were bleeding through from other chats because loadChatData()
wasn't resetting them when switching to a chat without RPG data.

When loading a chat with no rpg_companion metadata, the function now
resets quests to empty state (main: 'None', optional: []) along with
other tracker data. This ensures each chat maintains its own quest
state independently.
2025-11-13 21:01:37 +01:00
Spicy Marinara fd9adce068 Revert "feat: v2 widget dashboard system" 2025-11-06 20:06:26 +01:00
Lucas 'Paperboy' Rose-Winters a02be34827 merge: integrate upstream RPG attributes customization system
Merged commits from upstream/main (d870731):
- Add customizable RPG attributes (STR/DEX/etc) with add/remove/rename
- Fix character stats editing (0% display bug, missing Stats line creation)
- Add mobile font-size overrides for better readability
- Fix together mode rendering order (render panels before cleaning DOM)
- Fix temperature unit toggle (C/F) and thermometer thresholds
- Add buildAttributesString() for custom attribute names in AI prompts

Upstream Features:
- trackerConfig.rpgAttributes array replaces showRPGAttributes boolean
- Per-attribute enable/disable, custom names, reordering
- Tracker editor UI for managing attributes
- Custom attribute names appear in AI prompts and dice rolls
- Backward compatible migration from old boolean toggle

Merge Conflict Resolution:
- src/systems/integration/sillytavern.js:
  * Kept both: upstream's "render before DOM cleaning" + our refreshDashboard()
  * Result: render panels → refresh dashboard → update DOM
- style.css:
  * Kept both: our Widget Integration CSS + upstream's Mobile Font Overrides
  * Our Recent Events width fix (width: 100%) preserved

Related upstream commits:
- d870731: Add customizable RPG attributes and fix character stats editing
- f20710f: Make RPG attributes customizable and editable
- 883212b: Add comprehensive mobile font-size overrides
- 718696e: Fix multiple UI and functionality issues

No functional changes to v2 dashboard yet - integration in next commit.
2025-11-04 09:58:07 +11:00
Spicy_Marinara d8707318c8 Add customizable RPG attributes and fix character stats editing
Features:
- Made RPG attributes (STR/DEX/CON/INT/WIS/CHA) fully customizable
- Added enable/disable toggle for entire RPG Attributes section
- Users can add/remove/rename/toggle individual attributes
- Custom attribute names now appear in AI prompts for dice rolls
- Added proper CSS styling for attribute editor fields

Bug Fixes:
- Fixed character stat editing showing 0% on blur but saving correctly
- Character stats now create Stats line if missing from AI response
- Separated stat name from editable percentage value
- Added value sanitization (removes %, validates 0-100 range)
- Stats line now inserts before Thoughts line when created

Technical:
- Added buildAttributesString() helper in promptBuilder.js
- Updated generateTrackerInstructions and generateContextualSummary
- Restructured character stat HTML to prevent nested contenteditable
- Enhanced updateCharacterField to handle missing Stats lines
- Removed legacy default preset/regex import code
2025-11-03 17:01:53 +01:00
Spicy_Marinara f20710f5a3 Make RPG attributes (STR/DEX/etc) customizable and editable
- Replace showRPGAttributes boolean with rpgAttributes array in trackerConfig
- Add RPG Attributes section in Edit Trackers with add/remove/rename/toggle
- Dynamically generate attribute display from config in userStats.js
- Add migration from old showRPGAttributes to new rpgAttributes array
- Initialize new attributes with default value of 10 in classicStats
- Default attributes: STR, DEX, CON, INT, WIS, CHA (all enabled)
2025-11-03 11:09:42 +01:00
Lucas 'Paperboy' Rose-Winters 8240c77069 merge: integrate upstream tracker customization system
Merged upstream/main (82b9564) which includes:
- Full tracker customization system
- Tracker editor UI component
- Custom stat names in AI prompts
- Multi-line tracker format updates

Conflict resolutions:
- src/core/persistence.js: Kept both dashboard v2 and trackerConfig migrations
- style.css: Accepted upstream responsive calendar styling with clamp()

Both migration systems are now active and will run in sequence.
2025-11-02 09:57:15 +11:00
Spicy_Marinara 4abceb48a2 Fix: Rewrite updateCharacterField for new multi-line format
- Completely rewrote updateCharacterField function to work with new multi-line Present Characters format
- Now parses character blocks by '- Name' lines instead of pipe-separated format
- Handles updating Details, Relationship, and Stats lines correctly
- Supports all field types: name, emoji, custom fields, relationship, character stats
- Creates new character blocks if character doesn't exist
- Fixes bug where edits would revert because old format logic couldn't parse new format
- Users can now successfully edit all Present Characters fields
2025-11-01 23:26:36 +01:00
Spicy_Marinara 897c0278fb Major update: Full tracker customization system
Features:
- Complete tracker configuration UI with add/remove functionality
- User Stats: Custom stats, status fields, skills section
- Info Box: Configurable widgets (date, weather, temp, time, location, events)
- Present Characters: Custom fields, relationships, character stats, thoughts
- Character-specific stats with color interpolation
- New multi-line format for cleaner AI generation and parsing
- Auto-cleanup of placeholder brackets in AI responses
- Relationship badges with emoji mapping
- Advanced inventory v2 system with multi-location storage
- Responsive mobile support with horizontal scrolling
- Removed legacy format support for cleaner codebase
- Fixed context injection for together mode (no duplication)
- Updated README with new features and configuration guide
2025-11-01 20:19:35 +01:00
Lucas 'Paperboy' Rose-Winters ad2efa55f0 merge: resolve conflicts with upstream/main
Merged upstream/main into feat/v2-widget-dashboard-system branch.

Key conflict resolutions:
- index.js: Added renderQuests() to Dashboard v2 fallback rendering
- state.js: Combined memoryMessagesToProcess with Dashboard v2 config
- apiClient.js: Combined refreshDashboard() and renderQuests() calls
- style.css: Kept Dashboard v2 mobile refresh button styles

New features from upstream:
- Quest tracking system (renderQuests, quests.js)
- Memory recollection system
- Lorebook limiter feature
- Various parser and prompt builder improvements
2025-10-30 08:26:19 +11:00
Spicy_Marinara 141a3f4bec Fix extension loading, enhance theming, add horizontal scrolling, improve emoji parsing, rename to Main Quests 2025-10-26 22:31:21 +01:00
Lucas 'Paperboy' Rose-Winters 2edb41ebe6 feat(dashboard): implement dashboard data structure (Task 1.3)
Add dashboard configuration to extensionSettings and create default layout system:

State Management (state.js):
- Added extensionSettings.dashboard with version 2
- gridConfig: columns (12), rowHeight (80px), gap (12px), snapToGrid, showGrid
- tabs: Array of tab objects with widgets
- defaultTab: ID of tab to show on load
- Comprehensive inline documentation of structure

Default Layout Generator (defaultLayout.js):
- generateDefaultDashboard() - Creates 2-tab default layout
  - "Status" tab: userStats, infoBox, presentCharacters (3 widgets)
  - "Inventory" tab: inventory widget (1 widget)
- migrateV1ToV2Dashboard() - Migrates v1.x settings to v2.0
  - Respects user's visibility preferences (showUserStats, etc.)
  - Removes hidden widgets from migrated layout
  - Preserves user data during migration
- validateDashboardConfig() - Validates dashboard structure
- Utility functions: getWidgetCount(), findWidget()

Persistence Layer (persistence.js):
- Auto-migration on loadSettings() for existing users
- Validates dashboard config on load
- Regenerates default if config invalid or missing
- Seamless backward compatibility

Test Suite (defaultLayout.test.html):
- 4 test scenarios with visual verification
- Tests generation, validation, migration, utilities
- Live dashboard JSON preview
- Statistics panel (version, tabs, widgets, grid config)

Features:
- Automatic migration from v1.x hardcoded panel
- Preserves user preferences during migration
- Validates all dashboard configs on load
- Generates sensible defaults for new users

Acceptance Criteria Met:
✓ Dashboard config persists in extensionSettings
✓ Default layout generates on first load
✓ Existing users see migrated layout preserving their preferences
✓ All data structures validated

Epic 1, Task 1.3 Complete (1-2 day estimate, <10 min actual)
2025-10-23 09:26:10 +11:00
Spicy Marinara 599356fafb Merge pull request #13 from paperboygold/feature/inventory-bugfixes
feat: inventory bugfixes, status polish, editable inventory fields
2025-10-20 02:03:06 +02:00
Lucas 'Paperboy' Rose-Winters dc603b8b49 feat(inventory): granular item-level validation and auto-capitalization
Enhances validation to clean corrupted items at load time while preserving
valid ones, rather than discarding entire sections. Also auto-capitalizes
first letter of items for consistency.

New capability - Granular Item Cleaning:

1. **cleanItemString()** (src/utils/security.js):
   - Parses item string, removes bad items, re-serializes clean ones
   - Applies ALL parsing rules: markdown, sanitization, length limits
   - Used at load time to clean persisted data immediately
   - Returns "None" if no valid items remain

2. **Enhanced validateStoredInventory()**:
   - Now cleans items within each location
   - Only removes locations if ALL items are invalid
   - Example: "Home": "Sword, __proto__, Shield" → "Home": "Sword, Shield"
   - Example: "Bad": "__proto__, constructor" → location removed

3. **Enhanced validateInventoryStructure()** (src/core/persistence.js):
   - Cleans onPerson, stored, and assets at load time
   - Logs exactly what was cleaned for debugging
   - Auto-saves cleaned data back to storage

Auto-Capitalization:

- Added to cleanSingleItem() in itemParser.js
- Capitalizes first letter of each item after all cleaning
- Preserves rest of case: "iPhone" → "iPhone" (not "Iphone")
- Examples: "sword" → "Sword", "3x potions" → "3x potions"

Behavior examples:

Before (threw away entire array):
- "Home": "Sword, " + "A".repeat(600) + ", Shield"
  → Entire location lost

After (granular cleaning):
- "Home": "Sword, " + "A".repeat(600) + ", Shield"
  → "Home": "Sword, AAA...(500 chars), Shield"

Before (kept corrupted data):
- onPerson: "sword, __proto__, shield"
  → Stored as-is, filtered only at render

After (cleaned at load):
- onPerson: "Sword, Shield"
  → Cleaned and saved immediately, capitalized

Benefits:
- ✓ Preserves valid items when some are corrupted
- ✓ Cleans data at source, not just at render
- ✓ Detailed logging of what was cleaned
- ✓ Consistent capitalization across all items
- ✓ Single source of truth for "valid item"
2025-10-20 07:50:43 +11:00
Lucas 'Paperboy' Rose-Winters e21e71b03a fix(inventory): ensure stored locations always initialized properly
Fixes Bug #3: Locations disappearing when switching tabs or on reload.

Root cause: inventory.stored could become corrupted (null, array, or
undefined) due to incomplete validation during load/save operations.

Solution - Defense in Depth:

1. **Persistence Layer** (src/core/persistence.js):
   - New validateInventoryStructure() function
   - Validates on loadSettings() and loadChatData()
   - Checks all v2 fields (onPerson, stored, assets, version)
   - Ensures stored is always a plain object
   - Validates stored keys/values using validateStoredInventory()
   - Auto-repairs corrupted data with console warnings
   - Persists repairs immediately

2. **Form State Management** (src/systems/interaction/inventoryActions.js):
   - Enhanced restoreFormStates() to detect deleted locations
   - Cleans up orphaned form states automatically
   - Prevents errors from forms referencing non-existent locations

Validation checks:
- ✓ inventory.stored is object (not null/array/undefined)
- ✓ All stored keys are safe (no __proto__, constructor, etc.)
- ✓ All stored values are strings
- ✓ onPerson and assets are strings
- ✓ version field exists

Auto-repair scenarios:
- Corrupted stored → reset to {}
- Invalid onPerson/assets → reset to "None"
- Missing version → set to 2
- Dangerous keys → removed with warning

Result:
- Locations persist across tab switches ✓
- Empty locations persist ✓
- Data corruption auto-repaired on load ✓
- Orphaned form states cleaned up ✓
- No crashes from invalid data ✓

Fixes: Location disappears when switching tabs or reloading
2025-10-20 07:19:46 +11:00
Spicy_Marinara f5418841cb Add preset switching feature and clean up console logs
- Add 'Use separate preset for tracker generation' setting
- Implement automatic preset switching using /preset slash command
- Import getCurrentPresetName() from SillyTavern's regex engine
- Automatically import 'RPG Companion Trackers' preset on first load
- Comment out non-essential console.log statements
- Keep initialization, error, and migration logs for debugging
2025-10-19 20:05:17 +02:00
Spicy_Marinara 4a3170c661 Fix extension settings menu and persist committedTrackerData
- Fixed extension settings not appearing in Extensions tab by appending to correct container (#extensions_settings2)
- Added Discord and Support Creator buttons directly in JavaScript
- Added persistence for committedTrackerData to maintain state across refreshes and restarts
- Updated saveChatData() to include committedTrackerData in chat metadata
- Updated loadChatData() to restore committedTrackerData from saved chat data
2025-10-18 13:21:41 +02:00
Lucas 'Paperboy' Rose-Winters d9b784d745 fix(init): add defensive error handling for edge cases
Added comprehensive error handling to prevent extension initialization failures:

- Added settings validation in loadSettings() to detect corrupt data
- Improved error recovery in main initialization with granular try-catch blocks
- Enhanced HTML regex import with structure validation and detailed error logging
- Added detection for conflicting old manual formatting regex scripts
- Added user-friendly toastr notifications for initialization errors and conflicts
- Each init step now has independent error handling to prevent cascade failures

This fixes issues where invalid extension_settings could prevent the extension
from loading entirely. The extension will now gracefully handle corrupt data,
warn about conflicts, and fall back to defaults when necessary.

Related to user report where extension wouldn't load with certain settings.json
configurations containing old manual formatting regexes or malformed data.
2025-10-18 16:01:10 +11:00
Lucas 'Paperboy' Rose-Winters 39ec36f105 feat(inventory): add automatic v1→v2 migration on settings/chat load
Integrate inventory migration into persistence layer:
- Call migrateInventory() automatically when loading settings
- Call migrateInventory() automatically when loading chat data
- Save migrated data back to persistence immediately
- Update default reset inventory to v2 format
- Add console logging for migration status

Migration behavior:
- Only runs when FEATURE_FLAGS.useNewInventory is true
- Automatically detects v1 string format and converts to v2
- Handles null/undefined/empty/malformed data gracefully
- Logs migration source (v1, null, default) to console
- Persists migrated inventory immediately after conversion
- Migration runs once per load - subsequent loads see v2

Migration scenarios:
1. Old save with v1 string → migrates to v2.onPerson, saves
2. No save data → uses v2 defaults from state.js
3. Already v2 → no migration, no save
4. Chat data with v1 → migrates to v2, updates chat metadata

Changes:
- MODIFIED: src/core/persistence.js (+29 lines)
  - Updated loadSettings() with migration hook
  - Updated loadChatData() with migration hook
  - Changed default reset inventory from 'None' to v2 object

Part of inventory system v2 implementation
Dependencies: inventory types and migration utility
2025-10-17 15:06:53 +11:00
Lucas 'Paperboy' Rose-Winters 5c34407d2c refactor(core): extract core modules (state, persistence, config, events)
Extract core system modules from monolithic index.js into modular architecture:

- src/core/state.js: All extension state variables with controlled setters
- src/core/persistence.js: Settings and chat data persistence functions
- src/core/config.js: Extension metadata and default configuration
- src/core/events.js: SillyTavern event system wrapper

Updated index.js to import and use new core modules.
Removed ~220 lines of state/persistence code from index.js.

Part of Epic 1: Foundation & Core Systems (Phase 1.1-1.2)
2025-10-17 09:13:19 +11:00