Fix video element not reloading on regeneration by adding key prop tied
to video history ID. Fix cancel showing timeout message by passing
"user-cancelled" reason through AbortController and checking it in all
three executor catch blocks.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove dead trackSaveGeneration function (no longer called after executor
extraction) and unused type imports. Store: 3,838 -> 1,721 lines (55% reduction).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire extracted executors into workflowStore, replacing the ~1000-line
switch statement in executeWorkflow and ~750-line if-else chain in
regenerateNode with executor registry calls. Store reduced from 3,402
to 1,782 lines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move getConnectedInputs (136 lines) and validateWorkflow (59 lines) into
connectedInputs.ts as pure functions taking (nodeId, nodes, edges).
Store methods become thin wrappers. Add 22 new tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move groupNodesByLevel, chunk, revokeBlobUrl, clearNodeImageRefs,
and concurrency settings into executionUtils.ts with 21 new tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace 6 duplicated header-building if/else chains (across executeWorkflow
and regenerateNode) with buildGenerateHeaders() and buildLlmHeaders() utility
functions. Add 13 new tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move generateWithFalQueue, generateWithKie, generateWithWaveSpeed and all
their helpers into providers/fal.ts, providers/kie.ts, providers/wavespeed.ts.
Add barrel export at providers/index.ts.
route.ts reduced from 2,838 to 518 lines (POST handler + routing only).
Re-export clearFalInputMappingCache from route.ts for test backward compat.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move generateWithReplicate() into providers/replicate.ts.
It imports schema utilities from schemaUtils.ts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move MODEL_MAP and generateWithGemini() into providers/gemini.ts.
Remove unused imports (GoogleGenAI, uploadImageForUrl, shouldUseImageUrl,
deleteImages, ProviderModel) from route.ts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract INPUT_PATTERNS, InputMapping, ParameterTypeInfo, getParameterTypesFromSchema,
coerceParameterTypes, and getInputMappingFromSchema into schemaUtils.ts with 23 new tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The loopCount (1x/2x/3x) feature was only applied in executeWorkflow()
but not in regenerateNode(), which is the code path triggered by
clicking the "Stitch" button. This adds the blob duplication logic to
both code paths and includes the UI controls and type definitions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Validate uploadUrl and fileUrl from fal CDN initiate response through
validateMediaUrl() and HTTPS check before performing the PUT request.
Throws if either URL is missing or fails validation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Validate fal-provided status_url and response_url against validateMediaUrl()
and domain allowlist (queue.fal.run) before using them for polling. Falls back
to constructed URLs on validation failure.
Also updates mockFalCdnUpload test helper to match the two-step CDN upload
flow (initiate + PUT) introduced in 3fea13e.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WaveSpeed's CloudFront CDN returns `binary/octet-stream` which wasn't
caught by the old `!== "application/octet-stream"` check, producing
unplayable data URLs. Now only accepts content types starting with
`video/` or `image/`, falling back to `video/mp4` or `image/png`.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The old single-POST endpoint (fal.ai/api/storage/upload) returns 404.
Switched to the current fal.ai upload API: initiate via
rest.alpha.fal.ai/storage/upload/initiate, then PUT binary data to
the returned signed URL.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Delete unused generateWithFal function (replaced by generateWithFalQueue)
- Add 20MB size guard in uploadImageToFal to prevent memory spikes
- Add refresh button to ModelSearchDialog that clears model and schema
localStorage caches plus in-memory fetch cache
- Wire "Try Again" error button to also clear stale caches
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace blocking fal.run endpoint with async queue.fal.run + 1s polling
to match Replicate/WaveSpeed behavior. Upload base64 images to fal CDN
before queue submission to avoid large inline payloads. Cache schema
mappings in-memory (30min TTL) to eliminate redundant API calls per
generation. Also fix localStorage cache leaking between tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Derive provider capabilities from mediaType instead of hardcoding
text-to-image, so isVideoModel is correct for video generations.
Treat application/octet-stream as unhelpful content-type and fall back
to video/mp4 or image/png based on model type. Add safety net in
save-generation to override .bin extension when media type is known.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds 48-hour client-side caching to persist model data across dev server
restarts and page refreshes, eliminating repeated API calls during hot
reloading in development mode.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Veo 3 and Veo 3 Fast models (text-to-video + image-to-video) with
custom API integration using Kie's /api/v1/veo/ endpoints and numeric
successFlag polling. Also document Kie model integration SOP in CLAUDE.md.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Stabilize thumbnail extraction deps with a string key derived from clip
edge IDs, preventing excessive re-runs on unrelated node changes
- Use ref-based cache for thumbnails and add cleanup abort for pending
extractions
- Fix clipOrder sync triggering extra render by tracking last written order
- Add WaveSpeed case to ProviderBadge in GenerateImageNode and
GenerateVideoNode
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Refactor executeSingleNode error paths to throw instead of setting global
isRunning/currentNodeIds state, which corrupted sibling nodes running in
parallel via Promise.allSettled
- Validate WaveSpeed providedPollUrl with SSRF check before use
- Sanitize WaveSpeed taskId in provider with path-traversal validation
- Revoke blob URLs (URL.revokeObjectURL) before replacing outputVideo to
prevent memory leaks from large video files
- Move pause edge cleanup to outer executeWorkflow loop
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace RegExp constructor with replaceAll() for @variable substitution
in promptConstructor to prevent regex injection via variable names
- Wrap annotation, prompt, and promptConstructor execution cases in
try/catch to gracefully handle errors (log + set node error, continue)
- Fix MediaBunny resource cleanup type safety with closeable type guard
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add validateMediaUrl() utility to block private IPs, localhost, and
non-HTTP protocols before server-side fetches (with tests)
- URL-encode Kie taskId in poll URL to prevent injection
- Validate WaveSpeed modelId against path traversal in both route.ts
and wavespeed.ts provider
- Add 500MB Content-Length check before downloading media at all 3
fetch sites (Kie, WaveSpeed route, WaveSpeed provider)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- AudioInputNode: use named event handlers with removeEventListener in cleanup
- deduplicatedFetch: track setTimeout IDs and clear them in clearFetchCache()
- waitForPendingImageSyncs: clear timeout in finally block after Promise.race
- decodeWithMediaBunny: wrap in try/finally to close sink, input, blobSource
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update stale test mocks from currentNodeId to currentNodeIds in
AudioInputNode, EaseCurveNode, and VideoStitchNode tests. Replace
hard 401 return for missing FAL API key with console.warn, allowing
requests to proceed without auth (rate-limited) since
generateWithFal() already handles null keys gracefully.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The presets overlay was being clipped by BaseNode's overflow-hidden container.
Render it through createPortal to document.body with position tracking via
requestAnimationFrame, matching the existing pattern used for comment tooltips.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add nano-banana-pro model to Kie provider with schema and image input key
- Reorder Kie generation to process dynamicInputs before fallback image
uploads, preventing double-uploads when schema-mapped connections exist
- Update test mocks for deduplicatedFetch, useProviderApiKeys, and static
handle changes across GenerateImageNode, GenerateVideoNode,
ModelParameters, and ModelSearchDialog tests
- Add test commands to CLAUDE.md
- Fix SplitGridSettingsModal grid preview count (5 → 6 options)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
handleNodeDragStop used a hardcoded 300x280 fallback for node dimensions,
causing miscalculated centers for non-standard nodes (easeCurve 340x480,
videoStitch 400x280, audioInput 300x200). Now uses the same 3-level
fallback (measured → style → defaultNodeDimensions) as createGroup.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use fixed-width editor, absolute-positioned video to fill node, and
uniform gap-based spacing for controls below the curve editor.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Offset segmentBaseTime by frameInterval so the first frame starts at
timestamp 0 instead of -frameInterval, which the encoder rejects.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Split AudioInputNode waveform effect to avoid ResizeObserver churn on every animation tick
- Add missing kieApiKey/wavespeedApiKey deps to ModelParameters useEffect
- Clean up VideoSampleSource/Output on error in useApplySpeedCurve
- Fix off-by-one in useStitchVideos duplicate-frame skip (<= to <) and add try/finally for resource cleanup
- Replace leftover currentNodeId: null with currentNodeIds: [] in workflowStore
- Store full response metadata (status, headers, body) in deduplicatedFetch cache
- Add in-flight guard to imageStorage to prevent duplicate concurrent saves
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>