Browser-file-system workflow saves were still bypassing external media storage, so local projects could keep large image, video, and audio data embedded instead of writing refs into the selected browser-backed workspace. The storage path now uses the browser file helpers for image, video, and audio refs and hydrates them back without API calls.
Constraint: Keep local browserfs storage on the existing external media storage path instead of adding a new persistence mode.
Rejected: Keep browserfs excluded from externalization | it preserves the old large-payload behavior for local projects.
Confidence: high
Scope-risk: moderate
Directive: Do not route browserfs media through server API endpoints; browserfs paths must stay client-local.
Tested: npm run test:run
Tested: npm run build
Tested: git diff --check -- src/store/workflowStore.ts src/utils/browserFileSystem.ts src/utils/mediaStorage.ts src/utils/__tests__/mediaStorage.browserfs.test.ts
Not-tested: npm run lint is blocked because next lint is no longer a valid Next 16 command in this repo
Not-tested: npx tsc --noEmit reports existing test-file type debt outside this change while next build TypeScript passes
Vidu-style video models can load parameter schemas that change the Generate Video node height and trigger React Flow dimension updates. The fix keeps schema-driven resize notifications stable, skips no-op node height writes, and ignores duplicate React Flow node changes before they enter the workflow store.
It also preserves completed media outputs when a stopped or reloaded workflow still has transient loading/skipped state, so existing video results do not appear stuck after recovery.
Constraint: The crash was reported from a browser state where choosing Vidu hit React's maximum update depth in onNodesChange.
Rejected: Clear browser storage as the fix | it would hide persisted workflow loops without fixing the update path.
Rejected: Remove dynamic video handles | visible media/text inputs are product behavior and required for model-specific workflows.
Confidence: high
Scope-risk: moderate
Directive: Keep React Flow dimension and schema resize writes idempotent; new node resize paths should no-op when dimensions are already applied.
Tested: npm test -- --run src/components/__tests__/GenerateVideoNode.test.tsx -t 'should not resize repeatedly'
Tested: npm test -- --run src/components/__tests__/GenerateVideoNode.test.tsx src/components/__tests__/ModelParameters.test.tsx src/store/__tests__/workflowStore.integration.test.ts src/store/__tests__/skipPropagation.test.ts src/store/execution/__tests__/generateVideoExecutor.test.ts
Tested: npm run build
Tested: npm run test:run
Default provider mode now exposes only Popi Models while preserving the existing multi-provider implementation behind an explicit multi mode. The model browser, project settings, onboarding, node badges, and model API all share the same provider-mode decision so the test deployment matches the www.popi.art login-aligned direction.
This also includes the pending UI and i18n node-label changes already present in the tracked worktree so the committed state matches the verified build.
Constraint: Product entry must align with www.popi.art by exposing Popi Models instead of internal NewApiWG naming
Constraint: Test deployment should match the full tracked working tree that passed build
Rejected: Delete legacy provider code | multi-provider internals remain useful behind PROVIDER_MODE=multi
Rejected: UI-only hiding | API and store layers now enforce Popi mode too
Confidence: high
Scope-risk: broad
Reversibility: clean
Directive: Keep NewApiWG as the internal provider id unless the gateway API/env contract is migrated
Tested: npm run test:run -- src/components/__tests__/ProjectSetupModal.test.tsx src/app/api/models/__tests__/route.test.ts src/lib/__tests__/llmModels.test.ts
Tested: npm run test:run -- src/components/__tests__/GenerateImageNode.test.tsx src/components/__tests__/GenerateVideoNode.test.tsx src/components/__tests__/GenerateAudioNode.test.tsx src/components/__tests__/Generate3DNode.test.tsx src/components/__tests__/LLMGenerateNode.test.tsx
Tested: npm run test:run -- src/lib/chat/tools.test.ts
Tested: PROVIDER_MODE=popi NEXT_PUBLIC_PROVIDER_MODE=popi npm run build
Tested: Browser smoke on http://localhost:3000 verified Project Settings and Model Search only expose Popi Models
Not-tested: Direct npx tsc --noEmit remains blocked by pre-existing test typing errors outside this change
The browser path helper briefly acted as a type predicate, which made existing non-browser path branches narrow to never under the production build. The callers now guard nullable paths explicitly while the helper stays a plain boolean check.
Constraint: ProjectSetupModal depends on checking both browserfs paths and regular filesystem strings in the same helper flow.
Confidence: high
Scope-risk: narrow
Tested: npm test -- --run src/components/__tests__/GenerateImageNode.test.tsx src/store/execution/__tests__/nanoBananaExecutor.test.ts src/components/__tests__/GenerationComposer.test.tsx
Tested: npx tsc --noEmit --pretty false filtered to touched browser path files
Not-tested: Full tsc remains blocked by existing test typing errors outside this change scope
Browser-local projects were deriving a null generations path, so carousel entries that only retained an image id could not resolve media during previous/next navigation. Generated images are now written into the browser-selected generations folder, project metadata keeps that browserfs generations path, and the image node can read browserfs generation files directly before falling back to the server load endpoint.
Constraint: Browser-selected folders cannot be read through server API routes.
Rejected: Keep relying on inline image history only | saved or migrated workflows can contain id-only history entries.
Confidence: high
Scope-risk: moderate
Directive: Browser-local media paths must stay on the File System Access API path, not server /api/load-generation.
Tested: npm test -- --run src/components/__tests__/GenerateImageNode.test.tsx src/store/execution/__tests__/nanoBananaExecutor.test.ts src/components/__tests__/GenerationComposer.test.tsx
Tested: npx tsc --noEmit --pretty false filtered to touched files
Not-tested: Full tsc remains blocked by existing test typing errors outside this change scope
The bottom composer now edits and reruns the current generation node while canvas-visible actions own downstream node creation. NewApiWG media normalization, video frame extraction, and node quick-add keep generated media flows explicit and connected rather than hidden behind the prompt box.
Constraint: Composer must not call providers directly or create hidden downstream branches when a node is selected
Constraint: NewApiWG video families use inconsistent media schemas, so common media aliases are normalized in the provider adapter
Rejected: Let the bottom composer create next-step nodes from selected outputs | hides graph mutation and conflicts with the PRD source-of-truth rules
Rejected: Put NewApiWG model-family payload rules in the composer | provider-specific schemas would leak into UI state
Confidence: high
Scope-risk: moderate
Directive: Keep provider payload normalization in provider/executor layers; do not move it into GenerationComposer
Tested: npm run test:run -- src/components/__tests__/GenerationComposer.test.tsx
Tested: npm run test:run -- src/components/__tests__/WorkflowCanvas.test.tsx
Tested: npm run test:run -- src/components/__tests__/GenerateVideoNode.test.tsx
Tested: npm run test:run -- src/app/api/generate/providers/__tests__/newapiwg.test.ts src/app/api/generate/__tests__/route.test.ts
Tested: npm run test:run -- src/store/execution/__tests__/videoProcessingExecutors.test.ts
Tested: npm run build
Not-tested: npm run lint fails because next lint is incompatible with the current Next 16 script configuration
Server-side native folder pickers cannot select a Windows user's local directory when the app is deployed remotely. This adds a browser File System Access path for supported browsers so the user can choose a local folder, create the project subfolder, and save the workflow JSON directly from the client.
Constraint: File System Access handles are browser-only and cannot be passed to server filesystem APIs
Constraint: External media folder storage still depends on server filesystem endpoints, so browser-local projects keep media embedded or remote in the workflow JSON
Rejected: Make /api/browse-directory choose the user's Windows folder | that endpoint runs on the server, not in the browser
Confidence: medium
Scope-risk: moderate
Directive: Extend the browser filesystem utility for local media inputs/generations before enabling external media storage for browserfs paths
Tested: npx vitest run src/components/__tests__/ProjectSetupModal.test.tsx src/components/__tests__/Header.test.tsx
Tested: npm run build
Not-tested: Manual Chrome/Edge File System Access flow on Windows test server
NewApiWG image and video models need to work against the PopiArt test gateway, with generated remote media visible in the canvas and UI text localized for Chinese users. This wires the gateway-specific image/video paths, model fallback display, remote media proxying, and related i18n cleanup into one releaseable change.
Constraint: Test gateway exposes image and video models through mixed OpenAI-compatible and Gemini-native response shapes
Constraint: Browser video playback can fail when loading signed third-party media URLs directly
Rejected: Keep remote video URLs as direct <video> sources | CORS and range handling made successful generations appear unloaded
Confidence: high
Scope-risk: moderate
Directive: Do not remove the media proxy without validating remote video playback, trimming, and stitching against signed CDN URLs
Tested: npm run build
Tested: npx vitest run src/components/__tests__/OutputNode.test.tsx src/components/__tests__/GenerateVideoNode.test.tsx src/components/__tests__/VideoStitchNode.test.tsx
Tested: npx vitest run src/components/__tests__/WorkflowCanvas.test.tsx src/store/execution/__tests__/generateVideoExecutor.test.ts
Tested: npx vitest run src/app/api/generate/providers/__tests__/newapiwg.test.ts
Not-tested: Live browser replay after pushing to remote deployment
Resolve conflicts in 4 executor files by combining develop's
runWithFallback structure with feature branch's client-side polling.
Both capabilities are now integrated: executors use runWithFallback
for model redundancy, and pollGenerateTask for long-running Kie tasks.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- runWithFallback: use "loading" (valid NodeStatus) instead of "running"
- WorkflowCanvas: clear fallbackParameters when selecting a new fallback model
- workflowStore: add response.ok check before reading tutorial image blob
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Normalize and clamp loopCount at execution time (1-100 range)
- Validates imported/malformed values are finite numbers
- Falls back to default of 3 if invalid
- Prevents NaN, Infinity, or extreme values from bypassing setLoopCount validation
2. Fix resume logic for nodes inside loop bodies
- Compute loopStartLevel when startFromNodeId is in loopLevels
- On first iteration, start from that level instead of level 0
- On subsequent iterations, start from level 0 as normal
- Preserves existing copyLoopOutput skip on first iteration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reset fallbackParameters when saving a new fallback model provider to
prevent stale parameter values (e.g. temperature=1.5) being sent to a
provider with different valid ranges (e.g. Anthropic max=1).
Wire AbortController signal through mockTutorialExecution so clicking
Stop actually cancels the 5s delay, fetch request, and FileReader,
returning the node to idle state instead of completing silently.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Restore FTUX production logic (remove testing override)
- Fix generate3dExecutor clearOutput field and add modelId validation
- Remap startLevel index after loop partitioning in executeWorkflow
- Add missing mockTutorialExecution dep in FloatingActionBar
- Reset settingsTab to "primary" when fallbackModel is removed
- Clear orphaned fallbackParameters when removing fallback model
- Fix OutputGalleryNode removeMedia to splice single item, not all duplicates
- Add data-tutorial="save-button" to untitled save button in Header
- Move data-tutorial to layout-producing element in BaseNode
- Hydrate FTUXApiKeysStep localKeys from providerSettings
- Remove broken docs URL from ftuxStore tutorial steps
- Add error handling in loadTutorialSampleImage
- Fix mediaStorage ref array misalignment in outputGallery hydration
- Make OutputGalleryNodeData.videos optional to match usage
- Remove unused fitView destructuring from WorkflowCanvas
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(49-01): add FTUX types and localStorage helpers
- Create src/types/ftux.ts with FTUXStep, FTUXModalProps, FTUXStepProps
- Add FTUX_COMPLETED_KEY to localStorage keys
- Add getFTUXCompleted() and setFTUXCompleted() helpers
- Follow existing localStorage pattern with server-safe checks
* feat(49-02): create tutorial state management with Zustand
- TutorialStep interface with id, message, highlightSelector, requiredAction
- FTUXState with tutorialActive, currentTutorialStep, tutorialSteps, lockedFeatures
- Actions: startTutorial, skipTutorial, completeCurrentStep, nextTutorialStep, resetTutorial
- setFTUXCompleted/getFTUXCompleted localStorage helpers
- Initial tutorial steps (5 steps, placeholders for Plan 03)
* feat(49-01): build FTUXModal container and step components
- Create FTUXModal.tsx: 4-step modal with navigation, skip confirmation
- Create FTUXWelcomeStep.tsx: Welcome screen with project intro
- Create FTUXApiKeysStep.tsx: Provider list with .env status checking
- Create FTUXModelDefaultsStep.tsx: Model selection via ModelSearchDialog
- Create FTUXReadyStep.tsx: Completion screen with tutorial option
- Follow WelcomeModal and ProjectSetupModal patterns
- Use Tailwind neutral-800 theme throughout
- Step indicators show progress (1-4)
- Back button hidden on step 1
- Skip confirmation shows nested dialog overlay
* feat(49-02): build typewriter hook and tutorial UI components
- useTypewriter hook with 50ms/char animation and isComplete flag
- TutorialMessage component with typewriter animation and dark backdrop
- ElementHighlight component with pulsing blue ring (2px border, 8px blur)
- Three-layer highlight: dimmed overlay (bg-black/60), blue ring (z-91), clickable window (z-92)
- TutorialOverlay coordinator with action detection (add-image-node, connect-nodes, run-workflow)
- Skip tutorial button in top-right corner
- pulse-ring keyframes added to globals.css
- Uses React portals for correct z-index stacking
* feat(49-03): replace WelcomeModal with FTUXModal in app entry point
- Import FTUXModal, getFTUXCompleted, setFTUXCompleted, useFTUXStore
- Add SSR-safe showFTUX state (initialized via useEffect)
- Render FTUXModal when showFTUX=true
- onComplete callback sets showFTUX=false and marks FTUX complete
- onStartTutorial callback hides modal and starts tutorial via ftuxStore
- WelcomeModal still available via logo click (not removed, just not on first visit)
* feat(49-03): integrate tutorial overlay and add data-tutorial attributes
WorkflowCanvas.tsx:
- Import TutorialOverlay and useFTUXStore
- Get tutorialActive and lockedFeatures from ftuxStore
- Apply dimming (opacity-30 + pointer-events-none) to Background, Controls, MiniMap when tutorial active
- Render TutorialOverlay component after AnnotationModal
FloatingActionBar.tsx:
- Add optional dataTutorial prop to NodeButton interface
- Add data-tutorial="image-button" to Image input button
- Add data-tutorial="output-button" to Output button
- These attributes allow ElementHighlight to target buttons during tutorial
* fix(49-03): resolve Zustand SSR hydration issue in WorkflowCanvas
- Replace direct useFTUXStore hook call with useState + useEffect pattern
- Subscribe to ftuxStore on client-side only via useEffect
- Initialize state with getState() after subscription
- Prevents 'getServerSnapshot should be cached' error during SSR
- Prevents 'Maximum update depth exceeded' infinite loop
* chore(49-03): add FTUX testing override to always show modal
- Force setShowFTUX(true) to bypass localStorage check
- Allows repeated testing without clearing localStorage each time
- Added clear TODO comment to revert before production
- Original production code commented out for easy restoration
* ux(49-03): improve FTUX modal copy and layout based on user testing
FTUXModal.tsx:
- Increase modal width from max-w-[520px] to max-w-[640px] for better readability
FTUXWelcomeStep.tsx:
- Remove large banana icon (w-20 h-20) for cleaner look
- Change headline from "Welcome to Node Banana" to "Let's get set up."
- Keep workflow description, update subtext to "This will only take a few quick steps."
FTUXApiKeysStep.tsx:
- Simplify description to emphasize .env.local security benefit
- New: "Add your API keys here, or save them to .env.local to keep them secure across sessions."
- Remove mention of settings (cleaner messaging)
FTUXModelDefaultsStep.tsx:
- Remove redundant "You can always change these later" from main description
- Remove "These defaults are applied when creating nodes" from footer (redundant)
- Keep single mention: "You can skip this step and configure them later in settings."
FTUXReadyStep.tsx:
- Remove large green checkmark icon (w-16 h-16 circular bg)
- Keep "All Set Up!" headline and description
- Keep both tutorial buttons unchanged
* ux(49-03): remove redundant .env.local text below API keys list
- Remove duplicate messaging at bottom of FTUXApiKeysStep
- Top description already mentions .env.local security benefit
- Cleaner, less repetitive UI
* copy(49-03): rewrite FTUX copy for clarity and conciseness
Applied principles: Clear, Concise, Consistent, Useful, Human
FTUXWelcomeStep:
- Headline: "Let's get set up." → "Let's get started."
- Body: Simplified from wordy workflow/pipeline jargon to clear action
Old: "Build AI workflows visually with nodes and connections. Create complex image and video generation pipelines by connecting simple building blocks."
New: "Connect AI models like building blocks to generate images, videos, and more."
- Removed defensive subtext ("This will only take a few quick steps")
FTUXApiKeysStep:
- Description: Clearer security benefit, less technical
Old: "Add your API keys here, or save them to .env.local to keep them secure across sessions."
New: "Add keys to use AI providers. For security, save them to your .env.local file instead of the browser."
FTUXModelDefaultsStep:
- Headline: "Default Models (Optional)" → "Choose Your Models (Optional)"
- Description: Removed redundant "by default when creating new nodes"
Old: "Choose which AI models to use by default when creating new nodes."
New: "Pick which AI models to use for images and videos."
- Removed defensive footer text ("You can skip...")
FTUXReadyStep:
- Headline: "All Set Up!" → "You're ready!"
- Body: Removed jargon and redundancy
Old: "You're ready to start building workflows. Would you like a quick tutorial to get started?"
New: "Want a quick tutorial?"
- Buttons: "Skip Tutorial" → "Skip", "Start Tutorial" → "Show me how"
* fix(49-03): remove double scrollbar in API Keys step
- Remove max-h-[380px] overflow-y-auto from provider list container
- FTUXModal already has overflow-y-auto on content area (line 112)
- Provider list now scrolls with rest of modal content, not separately
- Fixes nested scroll container causing double scrollbar
* copy(49-03): clarify browser storage in API Keys step
- Make it explicit that adding keys in UI = stored in browser
- Parenthetical "(stored in browser)" right after action
- "for better security" instead of "For security" flows better
- Clearer tradeoff between convenience (browser) and security (.env.local)
Old: "Add keys to use AI providers. For security, save them to your .env.local file instead of the browser."
New: "Add keys here to use AI providers (stored in browser), or save them to your .env.local file for better security."
* copy(49-03): add "across sessions" to API Keys security benefit
- Change "better security" to "better security across sessions"
- Makes the persistence benefit of .env.local more explicit
- Clarifies why file storage is better than browser storage
New: "Add keys here to use AI providers (stored in browser), or save them to your .env.local file for better security across sessions."
* fix(49-03): save API keys entered during FTUX onboarding
Problem: API keys entered in FTUX modal were stored in local state only
and disappeared when modal closed, requiring users to re-enter them.
Original plan decision (49-01): "API key inputs not persisted during FTUX flow"
Rationale: "Setup is informational only, actual persistence happens in ProjectSetupModal"
This created broken UX - users entered keys expecting them to work.
Solution:
- Import useWorkflowStore and updateProviderApiKey function
- Create handleKeyChange that saves to localStorage immediately via updateProviderApiKey
- Replace direct setLocalKeys with handleKeyChange in input onChange
- Keys now persist automatically as user types (saved as null if empty)
Impact: Users can now enter API keys during onboarding and they'll be
available immediately in the app without re-entry.
Deviation: Auto-fix bug (Rule 1) - keys not persisting broke user expectations
* fix(49-03): close FTUX modal and center tutorial message
Issue 1 - FTUX modal still visible after starting tutorial:
- Add setFTUXCompleted(true) to handleStartTutorial
- Ensures modal won't re-render even with testing override
- Modal now properly closes before tutorial starts
Issue 2 - Tutorial message overlapping floating action bar:
- Change TutorialMessage position from bottom-4 to center of screen
- Use top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 for true center
- Message now displays prominently in center, not at bottom
- Update comment: "contextual placement" → "center of screen for maximum visibility"
Before: bottom-4 left-1/2 -translate-x-1/2 (bottom center)
After: top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 (true center)
* fix(49-03): close WelcomeModal when starting tutorial
Problem: WelcomeModal (original quickstart modal with "New Project", "Load Workflow",
etc.) remained visible when user clicked "Show me how" to start tutorial, blocking the
tutorial UI.
Root cause: WelcomeModal is controlled by workflowStore.showQuickstart state and was not
being closed when tutorial started.
Solution:
- Import setShowQuickstart from useWorkflowStore
- Add setShowQuickstart(false) to handleStartTutorial
- WelcomeModal now closes before tutorial overlay appears
Now when tutorial starts, both FTUXModal and WelcomeModal are closed, allowing tutorial
overlay to display without obstruction.
* fix(49-03): implement complete tutorial progression flow
Problem: Tutorial stuck on "Let's cook." message without progressing.
Root causes:
1. Step 1 (welcome) had no requiredAction, so action detection never triggered
2. Steps 3-5 were placeholder steps with no content or actions
3. No auto-advance logic for informational steps
Solution:
ftuxStore.ts - Replace placeholder steps with real tutorial:
- Step 1: "Let's cook." (welcome, auto-advances after 3s)
- Step 2: "Click the Image button to add an image node." (highlights image button, requires add-image-node)
- Step 3: "Now add an Output node to see your results." (highlights output button, requires add-output-node)
- Step 4: "You're all set! Connect nodes to build workflows, or press Cmd+Enter to run." (completion, auto-advances)
- Add "add-output-node" to TutorialStep requiredAction type
TutorialOverlay.tsx - Add auto-advance and output detection:
- Steps without requiredAction now auto-advance after 3 seconds (typewriter completes ~2s)
- Add detection for "add-output-node" action (checks for node.type === "output")
- Early return cleanup timer to prevent memory leaks
Tutorial now flows: Welcome → Add Image → Add Output → Complete
Each step progresses based on user action or auto-advances for info steps.
* fix(49-03): make tutorial highlighted elements clickable and visible
Problem 1: Floating action bar was darkened during tutorial even though it
contains the highlighted image button that user needs to see and click.
Problem 2: Image button was not clickable - Layer 3 "clickable window" was
blocking clicks instead of allowing them through.
Root cause: ElementHighlight had full-screen dimmed overlay (Layer 1) blocking
clicks, and Layer 3 created an empty div that blocked the actual element.
Solution - Use box-shadow cutout technique:
- Remove solid dimmed overlay (bg-black/60)
- Remove Layer 3 entirely (not needed)
- Use box-shadow: "0 0 0 9999px rgba(0, 0, 0, 0.6)" on positioned div
- Creates dimmed overlay with cutout hole where highlighted element is
- Highlighted element remains fully visible (not dimmed)
- Highlighted element is fully clickable (no overlay blocking it)
- Everything else gets dimmed
FloatingActionBar.tsx:
- Import useFTUXStore (prepared for future use)
- Add tutorial state awareness (not currently used but ready for expansion)
ElementHighlight.tsx:
- Replace full-screen overlay + clickable window with box-shadow cutout
- Simpler 2-layer approach: dimmed background with hole + blue ring
- All pointer-events-none, so nothing blocks the actual DOM element
* fix(49-03): resolve Zustand SSR hydration issue in FloatingActionBar
Error: "The result of getServerSnapshot should be cached to avoid an infinite loop"
at FloatingActionBar (src/components/FloatingActionBar.tsx:345:58)
Same issue as WorkflowCanvas - direct useFTUXStore hook call during SSR.
Solution (identical pattern to WorkflowCanvas fix):
- Replace direct useFTUXStore hook with useState + useEffect pattern
- Initialize with false defaults (SSR-safe, no hydration mismatch)
- Subscribe to ftuxStore on client-side only via useEffect
- Initialize state with getState() after subscription
- Return cleanup function to unsubscribe on unmount
Before: const { tutorialActive, lockedFeatures } = useFTUXStore(...)
After: useState + useEffect subscription (client-side only)
This prevents the SSR hydration error while maintaining reactive updates.
* chore(49-03): restore production FTUX localStorage check
- Remove testing override that forced FTUX to show every time
- Restore production code: if (!getFTUXCompleted()) { setShowFTUX(true); }
- Remove TODO comment about reverting
- FTUX now only shows on first visit as intended
* feat(tutorial): add connection drop menu workflow steps
Extend the FTUX tutorial with 4 new steps that teach users how to use the
connection drop menu workflow pattern:
Step 6: Drag from output handle
- Prompts user to drag from the image node's output handle
- Tracks drag start via onConnectStart handler
Step 7: Release in empty space
- Prompts user to release to show the connection drop menu
- Tracks menu appearance via handleConnectEnd
Step 8: Explain connection menu
- Highlights the drop menu with blue ring
- Explains it shows compatible nodes
- Requires click to continue
Step 9: Select Generate Image
- Highlights "Generate Image" button in menu
- Tracks nanoBanana selection via handleMenuSelect
- Only advances when selected from menu (not FloatingActionBar)
Step 10: Tutorial complete
- Shows completion message with workflow tips
- Auto-advances after 3s and marks FTUX done
Implementation details:
- Add 3 new requiredAction types to TutorialStep interface
- Add 3 state tracking flags to FTUXState (connectionDragStarted, etc.)
- Add tutorial tracking in WorkflowCanvas connection lifecycle
- Add data-tutorial attributes for highlighting menu elements
- Import OnConnectStart type and create handleConnectStart handler
- Track menu appearance and nanoBanana selection with tutorialActive guards
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* refactor(tutorial): simplify drag-and-drop flow
Combine drag and drop instructions into a single step and immediately
highlight the Generate Image button when the context menu appears:
Changes:
- Combine step 6 (drag) and step 7 (drop) into one: "Drag from the output
handle and drop into empty space"
- Remove step 8 (explain menu) - go straight to highlighting Generate Image
- Step 6 now waits for menu to appear (show-connection-menu)
- Step 7 highlights Generate Image button immediately (add-nanoBanana-from-menu)
Removed unused tracking:
- Remove start-connection-drag requiredAction type
- Remove connectionDragStarted state flag and setter
- Remove handleConnectStart callback from WorkflowCanvas
- Remove onConnectStart prop from ReactFlow
- Remove OnConnectStart import
New flow is cleaner and more direct:
Step 5: Explain outputs (click to continue)
Step 6: Drag and drop to show menu (auto-advance)
Step 7: Select Generate Image (auto-advance)
Step 8: Complete
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(tutorial): highlight Generate Image button immediately
Combine drag-and-drop and selection steps into one to ensure the Generate
Image button is highlighted as soon as the connection menu appears.
Problem:
- Previous flow had two separate steps (drag-drop, then select)
- 1 second delay between menu appearing and Generate Image highlighting
- Output handle was highlighted while menu was already visible (confusing)
Solution:
- Single step: "Drag from the output handle and drop into empty space. Then
select 'Generate Image'."
- highlightSelector targets the Generate Image button from the start
- ElementHighlight polls every 500ms, so highlights button immediately when
menu appears (no delay)
- Cleaner UX: instruction → action → immediate visual feedback
Removed:
- show-connection-menu requiredAction (no longer needed)
- connectionMenuShown state flag and setter
- Tutorial tracking in handleConnectEnd
New flow:
- Step 5: Explain outputs (click to continue)
- Step 6: Drag, drop, select Generate Image (highlight on button, auto-advance)
- Step 7: Complete
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(tutorial): increase highlight z-index above connection menu
The ElementHighlight component was rendering at z-index 91, but the
ConnectionDropMenu is at z-index 100, causing the highlight ring to
appear behind the menu.
Change: Increase ElementHighlight z-index from 91 to 101
This ensures the pulsing blue ring appears on top of the menu while
still allowing clicks through (pointer-events-none).
Z-index stack:
- ElementHighlight: 101 (above menu)
- ConnectionDropMenu: 100
- Skip tutorial button: 94
- TutorialMessage: 93
- Click overlay: 92
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(tutorial): highlight output handle when prompting drag action
Split the combined step back into two sequential steps with proper highlights
and instant transition between them.
Problem:
- Single step told user to "Drag from the output handle" but highlighted
the Generate Image button (which doesn't exist yet)
- Confusing visual feedback - wrong element highlighted for the instruction
Solution:
- Step 6: "Drag from the output handle and drop into empty space."
- Highlights: node-output-handle
- Action: show-connection-menu
- advanceDelay: 0ms (instant transition)
- Step 7: "Select 'Generate Image' to add an AI image generation node."
- Highlights: generate-image-option
- Action: add-nanoBanana-from-menu
- advanceDelay: 1000ms (default)
New feature: advanceDelay property
- Added to TutorialStep interface
- Configurable delay before advancing to next step after action completes
- Default: 1000ms (preserves existing behavior)
- Step 6 uses 0ms for instant transition when menu appears
Flow:
1. User sees output handle highlighted → drags and drops
2. Menu appears → step advances instantly (0ms delay)
3. Generate Image button immediately highlighted
4. User clicks → tutorial advances after 1s
Restored:
- show-connection-menu requiredAction
- connectionMenuShown state and setter
- Tutorial tracking in handleConnectEnd
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(tutorial): subscribe to ftux state for action detection
The action detection useEffect wasn't re-running when connectionMenuShown
or nanoBananaAddedFromMenu changed because these states weren't in the
dependency array.
Problem:
- User drags and drops → menu appears
- setConnectionMenuShown(true) updates ftuxStore
- But action detection useEffect doesn't re-run (missing dependency)
- Step doesn't advance to highlight Generate Image button
Solution:
- Subscribe to connectionMenuShown and nanoBananaAddedFromMenu at component level
- Use these subscribed values instead of getState() calls
- Add them to useEffect dependency array
Now when these states change:
1. Component re-renders with new values
2. useEffect re-runs due to dependency change
3. Action is detected as completed
4. Step advances with configured delay (0ms for instant transition)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(tutorial): add prompt node and connection steps
Extend tutorial with steps 8-9 to teach users:
- Adding nodes via FloatingActionBar (different from connection menu)
- Connecting nodes by dragging between existing handles
Changes:
- Add data-tutorial="prompt-button" to Prompt button
- Add data-tutorial="prompt-output-handle" to Prompt output handle
- Add "add-prompt-node" to requiredAction types
- Add step 8: Add Prompt node via FloatingActionBar
- Add step 9: Connect Prompt to Generate Image node
- Update step 10 (complete) message for clarity
- Add action detection for add-prompt-node in TutorialOverlay
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(tutorial): wait for prompt node connection in step 9
Step 9 was advancing immediately because it checked for ANY edges,
but an edge already existed from step 7 (Image → Generate Image).
Changes:
- Add "connect-prompt-node" requiredAction type
- Update step 9 to use "connect-prompt-node" instead of "connect-nodes"
- Add detection logic that specifically checks for edges FROM prompt nodes
- Track edges in TutorialOverlay component state for reactive detection
- Add edges to useEffect dependency array
Now step 9 correctly waits for user to connect the prompt node
before advancing to the completion step.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat: prevent node overlap on creation with automatic collision detection
Implements AABB collision detection to automatically place new nodes in collision-free positions. When users add nodes via FloatingActionBar or keyboard shortcuts, the system now finds the nearest free position using a spiral search pattern (right, down, left, up, diagonals).
Changes:
- Add spatialLayout.ts with rectanglesIntersect() and findNearestFreePosition()
- Update addNode() to use collision detection before placing nodes
- Remove random offset from FloatingActionBar for more deterministic placement
- Use consistent 20px gap (COLLISION_GAP) matching existing STACK_GAP pattern
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(tutorial): extend FTUX with content setup and resource guidance
Add four new tutorial steps to guide users through completing their first workflow:
- Prompt users to add text to the Prompt node
- Prompt users to add an image to the Image node
- Instruct users to run the workflow with Cmd/Ctrl+Enter
- Inform users about saving projects, templates, and Discord community
This ensures users complete a full workflow cycle during onboarding and know where to find help and resources.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(tutorial): remove emojis from tutorial messages
Remove decorative emojis from the save-and-resources and completion steps for a cleaner, more professional appearance.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix(tutorial): improve viewport zoom timing with auto-populated nodes
Increase timeout from 400ms to 600ms and improve viewport setting logic
to ensure proper 0.7 zoom level when tutorial image node is added with
pre-loaded base64 data. Fetch fresh nodes from store and extend animation
duration for smoother transition.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(tutorial): delay auto-population until after prompt connection
Change tutorial flow to create empty nodes initially and auto-populate
with sample content only after the prompt node is connected to generate.
This maintains hands-on learning while still removing friction.
Changes:
- Nodes created empty during tutorial
- Auto-populate after "connect-prompt-node" step completes
- Switch sample image: model.png → owl.jpg
- Update prompt: "wearing aviator sunglasses and a leather jacket"
- Add nodesPopulated ref to prevent duplicate population
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(tutorial): improve messaging, dual highlights, and pulsing animation
- Change welcome message: "Let's cook" → "Let's go over the basics"
- Add dual highlight for connect-prompt step: both prompt output and
generate text input handles are now highlighted simultaneously
- Position connect-prompt message on left side of screen
- Update ElementHighlight to support array of selectors
- Add data-tutorial attribute to generate node's text input handle
- Pulsing animation already present via pulse-ring animation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat(tutorial): implement mock execution and organized node demonstration
- Add mock workflow execution to save API costs during tutorial
- Mock execution simulates 5-second generation time with edge animations
- Loads pre-made owl aviator image instead of calling Gemini API
- Provides realistic experience without incurring charges
- Implement visible workflow tree demonstration
- Automatically builds branching workflow after mock execution
- Video branch: Prompt → Generate Video → Output
- LLM branch: Prompt → LLM → Generate Image #2 → Output
- Clean horizontal layout with 350px spacing between nodes
- Vertical separation of ±350px for clear branch distinction
- Improve user experience
- Auto-close run menu when advancing past tutorial steps
- Unlock canvas navigation after demonstration completes
- Zoom to 0.35 with centered viewport for complete tree overview
- Updated LLM prompt for nightclub scene generation
- Add tutorial assets
- Add owl aviator image (public/tutorial/owl-aviator.png)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: restore .env.example file
Restore .env.example that was accidentally deleted in commit 9be881c.
This file is needed as a reference for users to set up their environment.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Nodes downstream of the loop body (e.g. outputGallery connected to a looped
generateVideo) were classified as suffix and only executed once after all
iterations. Now the loop iteration set expands via forward-edge traversal
to include downstream observers, so they execute each pass and can accumulate
results (e.g. collecting each generated video into the gallery).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Extract executeLevels helper that gets fresh node refs each level
- Import findLoopSubgraph and copyLoopOutput from executionUtils
- Partition workflow into prefix/loop-body/suffix levels
- Execute loop body N times with data feedback between iterations
- Use forwardEdges only for topological sort (exclude loop edges)
- Show toast warning for multiple loop edges
- Respect abort signal between loop iterations
- Non-loop workflows completely unaffected
All 21 loop edge tests pass, 2011 total tests pass, clean build
- Import wouldCreateCycle from executionUtils in WorkflowCanvas
- Add cycle detection in handleConnect for batch and single connections
- Mark backward connections as loop edges (isLoop: true, loopCount: 3)
- Add setLoopCount store action with 1-100 clamping
- Add loop color (#d946ef magenta) to EDGE_COLORS in both files
- Loop edges render in magenta before pause edges
- Add loop indicator overlay (↻ N×) at edge midpoint using foreignObject
- Loop gradient defined in SharedEdgeGradients
regenerateNode was not creating an AbortController or passing a signal
to _buildExecutionContext, so stopWorkflow() couldn't cancel in-progress
batch iterations. Now creates and stores _abortController on entry and
clears it on all exit paths (early returns, success, and error).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
copySelectedNodes, pasteNodes, and AI captureSnapshot were still using
JSON.parse(JSON.stringify(...)) which duplicates multi-MB base64 blobs.
Switched to clonePreservingStrings which shares immutable string refs.
Also clarified docstring re: toJSON not being called.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Edge metadata (arrayBatchAll) was stamped at connection creation time and
went stale if the source node's batchMode was toggled later. Now
connectedInputs.ts reads batchMode directly from the source node, making
batch behavior always consistent with the current toggle state.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The batch textItems loop was only in executeWorkflow. regenerateNode and
executeSelectedNodes bypassed batch mode entirely, causing inconsistent
behavior when array nodes feed into generate nodes.
Extracted runBatchIfApplicable() into src/store/execution/batchExecution.ts
and wired it into all three execution entry points.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When batch mode is enabled on an array node, all parsed items are sent
through a single connection to a downstream generate node, which loops
through them sequentially. This eliminates the need to create separate
downstream nodes for each array item.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace JSON.parse(JSON.stringify(...)) in captureUndoSnapshot with
clonePreservingStrings — a custom deep-clone that creates new
object/array containers but returns string primitives by reference.
Since JS strings are immutable, snapshots safely share base64 blobs
instead of duplicating them. Reduces undo history memory from ~500MB
to ~12.5MB for workflows with 10MB of media data (97.5% reduction).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The selected-node runner was treating audioInput and videoInput as no-ops,
so select-executing these nodes with upstream connections wouldn't pull
connected data. Now matches executeWorkflow's hydration logic.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix redo shortcut by normalizing event.key to lowercase (Shift makes it "Z")
- Flush pendingDataSnapshot in undo/redo instead of discarding it, preserving
the pre-edit checkpoint so Cmd+Z doesn't skip states
- Recompute dimmedNodeIds after undo/redo to keep dimming in sync
- Set deleteCheckpointActive in removeEdge before clearStaleInputImages to
prevent split undo entries
- Wire videoInput in handleMenuSelect and isValidConnection for video connections
- Validate video MIME type against ACCEPTED_FORMATS whitelist instead of broad regex
- Use URL.createObjectURL(file) for metadata extraction instead of base64→Blob
- Add Shift+Y (Video Input) to keyboard shortcuts dialog
- Update executeNode JSDoc to include videoInput as data-source no-op
- Clear all *Ref/*Refs fields dynamically in clearNodeImageRefs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
If a debounced data-edit snapshot was pending when loading or clearing
a workflow, it could fire after undoManager.clear() and push stale
state into the new workflow's undo history. Now both paths cancel the
pending timer and snapshot before clearing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
React Flow v12's deleteElements fires onEdgesChange(remove) BEFORE
onNodesChange(remove), not after. The previous fix assumed the opposite
order, so the microtask-based nodeRemoveCheckpointActive flag was never
true when onEdgesChange ran.
Replace with deleteCheckpointActive — a bidirectional flag set by
whichever handler (edges or nodes) fires first. The second handler
skips its checkpoint. Use setTimeout(0) instead of Promise.resolve()
so the flag survives all microtasks in the current event-loop turn.
Also suppresses debounced undo snapshots from clearStaleInputImages
side effects during the same deletion cycle.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When deleting a connected node, clearStaleInputImages calls updateNodeData
on target nodes to clear stale input images. Each updateNodeData call was
creating a debounced undo snapshot, resulting in 3-4 undos needed instead
of 1. Now updateNodeData skips undo tracking when nodeRemoveCheckpointActive
is true, since the node removal checkpoint already captured full pre-deletion state.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When deleting a node via the canvas (Delete key), React Flow fires
onNodesChange(remove) then onEdgesChange(remove) synchronously.
Previously this created two undo entries, requiring two undos and
leaving an intermediate state with orphaned edges.
Now onNodesChange sets a microtask-scoped flag that tells onEdgesChange
to skip its checkpoint, collapsing both into a single undo entry.
Added integration test verifying single-undo restores node + edges.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Captures snapshots before all undoable mutations (add/remove nodes,
connect/remove edges, paste, group operations, edge style, drag start).
Data edits are debounced (500ms). Execution outputs are not undoable.
History depth: 50 entries. Cleared on load/clear workflow.
Keyboard shortcuts added to WorkflowCanvas and shortcuts dialog.
15 integration tests covering all undo/redo scenarios through the store.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a new videoInput node type that allows users to drag-and-drop or
browse for video files (MP4, WebM, QuickTime), preview them inline with
native video controls, and feed them into downstream video processing
nodes. Includes full media externalization/hydration support, Shift+Y
keyboard shortcut, and ConnectionDropMenu integration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the local Set variable in executeWorkflow() with direct
reads/writes to the Zustand store field. The dual tracking was
redundant since get() is synchronous and Set.has() is O(1).
Extract a resetSkippedNodes() helper to DRY up the two cleanup blocks.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The rebase dropped the commit that re-added skippedNodeIds to the store
interface since develop had already extracted it to a local variable.
However, WorkflowCanvas.tsx needs to observe skippedNodeIds from the
store to apply visual dimming during execution.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
skippedNodeIds was in the Zustand store interface but never read by any
component — it was only used as a local variable during executeWorkflow.
Removed the store field/initial state/set() calls, keeping only the local
variable.
Also extracted the duplicate 5-line skip-reset block (success + error paths)
into a resetSkippedNodes() helper inside executeWorkflow.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The directoryPath field was defined in WorkflowFile and checked during
load, but never written during save. Workflows opened from a different
machine or via file picker had no way to find their externalized media
files, so all ref-based nodes appeared empty.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add node-skipped CSS class (opacity 0.35) for skip dimming
- Expose skippedNodeIds in Zustand store for reactive CSS updates
- Apply node-skipped class in WorkflowCanvas alongside switch-dimmed
- Clear skippedNodeIds on workflow stop, reset, and completion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When an optional input node has no data, it and all downstream nodes
with a skipped source are silently skipped during execution. Uses
ANY merge policy — if any source is skipped, the downstream node
is also skipped. Skipped status is reset to idle after workflow
completes or errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pre-subtraction in loadWorkflow was overridden by React Flow's
dimension reconciliation. Instead, correct at the source: in BaseNode's
expand timeout, read _settingsPanelHeight from node data and only add
the delta (measured - saved) so reloaded nodes don't double-count.
Also clear _settingsPanelHeight on collapse to avoid stale values.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Store measured settings panel height in node data (_settingsPanelHeight).
On workflow load, subtract it from persisted height so BaseNode's expand
effect re-adds the real panel height from a clean baseline instead of
double-counting.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On 144Hz+ displays, requestAnimationFrame fires ~144 times/sec. This
adds a throttledRAF utility that limits callback execution to ~60fps
regardless of display refresh rate, normalizing performance across
60Hz, 120Hz, and 144Hz monitors.
Applied to:
- workflowStore hover debounce (event-driven throttle)
- FloatingNodeHeader position tracking (continuous loop throttle)
- ModelParameters ResizeObserver (event-driven throttle)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rapid mouse movement across the canvas fires multiple mouseout events
per frame, each triggering ~150 Zustand selector evaluations. This
coalesces hover updates into one per animation frame and skips them
entirely during canvas panning/dragging.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The capabilities prop doesn't exist on ModelSearchDialogProps. Use the
correct initialCapabilityFilter="image" prop instead.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Skip Zustand set() when hoveredNodeId already matches the incoming value.
Prevents redundant store updates when the mouse stays on the same node
or when onMouseLeave fires with null when already null.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove solid color header bar from groups, replace with floating rounded-rectangle label at top-left
- Add floating controls toolbar (color picker, lock, delete) at top-right with bg-neutral-800/80 backdrop
- Both label and controls use transform: scale(1/zoom) for constant screen size regardless of canvas zoom
- Remove headerHeight offset from createGroup in workflowStore (no longer reserves vertical space for header)
- Keep all existing group interactions: rename, recolor, lock, delete, drag, resize
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>