Feature scenes#250
Open
StableLlama wants to merge 89 commits into
Open
Conversation
Co-authored-by: Copilot <copilot@github.com>
- simplify data/time requirements for LLM creating or updating scenes
…across reloads
Implements per-project view state persistence so the application remembers
the last open chapter, workspace mode (Page/Scenes/Split), scenes view type
(defaulting to Narrative), and scroll position across application reloads.
Backend (Python):
- New view_state_ops service: load/save view_state.json per project dir
with safe defaults for missing/corrupt files
- New ViewStatePayload/ViewStateResponse Pydantic models
- New API routes: GET/PUT /projects/{name}/view-state
- Tests: 8 backend tests covering missing file, corrupt JSON, roundtrip, etc.
Frontend (TypeScript/React):
- New viewState.ts API client
- Extended api.ts facade with viewState in ProjectApiClients
- Updated uiStore: scenesViewType field + setScenesViewType action;
persists workspaceMode and scenesViewType via Zustand partialize
- New useViewStatePersistence hook for restore and auto-save
- App.tsx integrates restoration and auto-persistence
- ScenesPanelContainer reads scenesViewType from store; default narrative
- Tests: 6 uiStore tests + 9 view state persistence tests
Fixes concurrent-rendering infinite loop: stabilized lane-state callbacks
with useCallback and decoupled external store sync from useState updaters
into dedicated useEffect in useSceneLanes. Includes regression test.
Updates the following packages to patch high-severity CVEs: - dompurify: 3.4.0 → 3.4.11 - protobufjs: 7.5.8 → 7.6.4 - undici: 7.25.0 → 7.28.0 - vite: 8.0.10 → 8.1.0 - ws: 8.18.3 → 8.21.0 - brace-expansion: 5.0.5 → 5.0.6 - js-yaml: 4.1.1 → 4.2.0 Fixes the failing frontend-checks CI job (npm audit --audit-level=high).
Collaborator
Author
… scene DnD/selection sync - Add expand/focus icons to Story, Chapters, Sourcebook section headings so each section can be maximised to fill the sidebar exclusively, with a collapse button to restore the normal view. - Add a scenes-mode toggle in the Chapters header. When active, the chapter list switches from summary cards to a compact tree view showing scenes in narrative order — one compact line per scene with the start of its summary. Supports novel (chapter→scenes) and series (book→ chapter→scenes) layouts. - Scene rows in the left-pane tree are draggable. They use the same custom MIME types as NarrativeView and dispatch `aq-scene-reorder-prose` / `aq-scene-drop-chapter` events so both panes stay in sync via optimistic order broadcasts. - Synchronise scene selection across panes: add `sceneSelectionPrimaryId` to `uiStore`. The main view (NarrativeView / PinboardView) writes it on every cursor-driven or click-driven selection change. The left-pane SceneTreeView reads it and highlights the matching row. Left-pane single-clicks dispatch `aq-scene-select` for the reverse direction. - Add double-click handler on left-pane scene rows to open the SceneEditorDialog, mirroring the behaviour of the main scene views. - Reuse existing `useSceneSelection`, `useSceneProseSync`, and drag-util infrastructure; no selection logic was duplicated.
…rging Replace the global shouldUseBlockMode check (similarity + fragmentation over the entire document) with a local zone-merging approach in the CodeMirror diff plugin. Adjacent changed segments separated by only tiny equal gaps (≤20 chars) are merged into "rewrite zones". Zones with ≥80 changed chars render as block replacements (old deleted + new inserted); everything else stays as word-level inline diff. This fixes the fundamental issue where replacing one scene inside a long chapter never triggered block mode, because the 4000 unchanged chars dominated the global similarity metric. The decision is now truly local — a single-scene rewrite produces one block zone while the rest of the chapter renders normally. - codeMirrorDiffPlugin.ts: add mergeDiffZones(), remove global check - MarkdownView.tsx, ChapterList.tsx: keep global shouldUseBlockMode (appropriate for short summary text) - codeMirrorDiffBlockMode.test.ts: rewrite for zone-based logic - Closes noisy inline diffs for partial scene rewrites in Page view
…e, and undo history grouping - FloatingDiffToolbar: Replace Tailwind dark: classes with conditional isLight-based classes using bg-brand-gray-900 (standard UI surface) in dark mode instead of the paper-colored bg-brand-gray-850. - Scene summary baseline: After user saves a scene via handleSaveScene, explicitly advance the baseline with the computed nextScenes to prevent user-initiated edits from appearing as diffs on re-open. - CodeMirror history: Add Transaction.addToHistory.of(false) to all 11 compartment reconfigure dispatches so extension reconfigurations don't break CodeMirror's input event grouping (per-letter undo checkpoints). - SceneEditorDialog: Add FloatingDiffToolbar integration, AcceptedBaseline local overrides, and data-diff markers for section-level diff highlighting. - TDD: Add baseline-advance test in ScenesPanelContainer (verifies setBaselineState called with updated scene), dark-theme tests in FloatingDiffToolbar, and diff-rule spec tests in SceneEditorDialog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add functionality to handle single scenes that make up the whole plot.
Closes #212
Fixes # (issue)
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
pytest)npm run test)Checklist: