Repository navigation
fix(images): transferStyle sends the source and the style reference - #322
Conversation
|
Warning Review limit reached
This review includes 14 billable files and costs up to $3.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 3 minutes for your next included review. View limit details
Comment |
Reviewer's GuideThis breaking change makes Sequence diagram for two-image style transfer routingsequenceDiagram
participant Caller
participant transferStyle
participant Provider
participant VendorAPI
Caller->>transferStyle: transferStyle(image, styleReference, prompt)
transferStyle->>Provider: initialize()
transferStyle->>Provider: styleTransferModel(modelId)
Provider-->>transferStyle: resolved model
transferStyle->>transferStyle: imageToBuffer(image)
transferStyle->>transferStyle: imageToBuffer(styleReference)
transferStyle->>Provider: transferStyle(image, styleImage, prompt, strength)
Provider->>VendorAPI: Send source and reference images
VendorAPI-->>Provider: Image result
Provider-->>transferStyle: ImageGenerationResult
transferStyle-->>Caller: Restyled image
Flow diagram for style transfer preflight and executionflowchart TD
A[Resolve provider and style-transfer model] --> B{Provider supports transferStyle?}
B -- No --> Z[Refuse before reading images]
B -- Yes --> C[Validate model and options]
C --> D[Read source and style reference]
D --> E[Validate image formats and provider limits]
E --> F[Build provider-native two-image request]
F --> G{Provider response contains an image?}
G -- No --> H[Raise error]
G -- Yes --> I[Return restyled image]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Summary by QodoSend both images to supported style-transfer providers
AI Description
Diagram
High-Level Assessment
Files changed (14)
|
transferStyle took two images and sent one: Replicate's Flux Redux route sent the reference alone, and the img2img routes sent the source alone. Each provider with a call that takes both now has transferStyle and styleTransferModel: Replicate and Fal on FLUX.2 (input_images and image_urls, with an instruction that names image 1 and image 2), Stability on its style-transfer endpoint (init_image and style_image), and OpenAI on two image[] parts of the edits endpoint. Each one checks the model against its verified list before either image is read, then the images' formats, the provider's documented limits, and an answer with no image. Fal reads a failure's detail at the submit answer's response_url, which every Fal call now passes. What changes for a caller: every route reads both images. The auto order is the same, and its models are black-forest-labs/flux-2-pro (Replicate), fal-ai/flux-2-pro/edit (Fal), stable-image-style-transfer (Stability) and gpt-image-2.5-sunburst (OpenAI). A call that produced the wrong image now fails with the reason: providers without a two-image call (BFL, MiniMax, OpenRouter, local Stable Diffusion), and models outside a provider's list unless its base URL is custom. The global default's model no longer applies to a style transfer. On Replicate, providerOptions.input may not set the prompt or the images, extraBody is refused, and negativePrompt, aspectRatio, numOutputs, goFast, megapixels and disableSafetyChecker are no longer sent.
ea783cc to
65dfe43
Compare
Code Review by Qodo
1. Replicate users select a rejected model
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
## [0.13.59](v0.13.58...v0.13.59) (2026-10-12) ### fix * **images:** transferStyle sends the source and the style reference (#322) ([32761ce](32761ce)) ### docs * **providers:** a Gemini CLI tool-call block whose body is not JSON streams as text (#320) ([76c0fe7](76c0fe7)) * thirteenth round of audit follow-ups (diagram alt texts, the PII page, HITL gaps) (#319) ([01dfe54](01dfe54))
A provider with no two-image call is refused before its credentials are looked for. A baseUrl needs a named provider, as an apiKey does; FAL_BASE_URL sets Fal's. A completed Fal status that carries an error fails with it. The model lists name the FLUX.2 models and edit endpoints, the custom-endpoint rule is stated per provider, and the tests cover the paths the cold read found untested.
## [0.13.62](v0.13.61...v0.13.62) (2026-10-12) ### fix * **images:** style transfer follow-ups from the cold read of #322 (#328) ([dc7fb4c](dc7fb4c))
Summary
transferStyle({ image, styleReference, prompt })took two images and sent one (src/api/transferStyle.tsat 76c0fe7):editImageroutes (Fal, Stability, OpenAI, Replicate's other models) sent the source alone, so the style came from the prompt.editImagegenerated from text.Every route now sends both images. The four providers with a call that takes both get
transferStyleandstyleTransferModel:black-forest-labs/flux-2-pro(alsoflux-2-max,flux-2-flex,flux-2-dev)POST /models/{owner}/{name}/predictionsinput_images[source, reference],aspect_ratio: match_input_imagefal-ai/flux-2-pro/edit(also the max, flex andflux-2edit endpoints)image_urls[source, reference]stable-image-style-transfer(reported; the endpoint takes no model)POST /v2beta/stable-image/control/style-transferinit_image,style_image;strengthasstyle_strengthgpt-image-2.5-sunburst(and the other GPT Image models)POST /images/editsimage[]parts, the source firstFLUX.2 and OpenAI edit by instruction and take no strength. They are sent an instruction that names the two images (by index for FLUX.2, as its documentation does: "The person from image 1 is petting the cat from image 2"), then the caller's prompt. A strength below 0.5 picks the light instruction, otherwise the full one.
Each provider checks these before its request:
baseUrltakes any name);Replicate also refuses a
providerOptions.inputthat would replace the prompt or the images, and anyextraBody. A prediction must endsucceeded.Fal's queue reads a failure's detail at the submit answer's
response_url, for every Fal call. The rebuilt path can answer 405 on a multi-segment endpoint, as the file itself notes.The vendor facts, each read from its source:
src/resources/images.ts(ImageEditParamsBase: "You can provide up to 16 images") andsrc/internal/uploads.ts(arrays sent asimage[]).Linked issues
None.
Type of change
How this was verified
CI only; nothing was run on a workstation.
src/api/__tests__/transferStyle.http.test.ts(new) runstransferStyle()through the real provider classes andfetchagainst a localnode:httpserver. Every request is recorded, a request no case expects fails the case, and a URL outside the server is refused. Multipart bodies are read with the platform's own parser. It covers:image-operation-default-models.e2e.test.ts: the Stability style case is on the style-transfer endpoint, and the OpenAI style calls send twoimage[]parts.transferStyle.test.ts: its three cases are unchanged and still hold.gpt-6.1-sol, high: 7 P1 and 8 P2, all folded in) and a fold check (gpt-6-luna, high: 3 P2, folded in) before the code was written.Migration notes
Released as a fix (a patch), not a new minor. Every path that is now refused was returning the wrong image, no package in the monorepo calls
transferStyle(), and a new minor would leave every consumer pinned to^0.13without AgentOS's later fixes until it is moved by hand (the breaking-change gate's reason). What changes for a caller:baseUrlis custom;providerOptions.inputthat setsprompt,input_images,imageorinput_image, and anyextraBody.negativePromptreaches Stability only, andsizereaches OpenAI only.seed,outputFormatandoutputQualitystill apply, whilenegativePrompt,aspectRatio,numOutputs,goFast,megapixelsanddisableSafetyCheckerare no longer sent.For a variation of the reference use
variateImage(); to change the source by a prompt useeditImage().Checklist
STYLE_TRANSFER.md,IMAGE_EDITING.md,HIGH_LEVEL_API.md).Summary by Sourcery
Send both the source and style reference through supported provider-specific style-transfer APIs, replacing the previous single-image and text-only fallbacks.
Bug Fixes:
transferStyle()send both the source image and style reference to the provider instead of sending only one image or falling back to text generation.Enhancements:
Documentation:
Tests:
Chores: