Repository navigation
feat(local): let the agent draw pictures #2419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AnishSarkar22
merged 11 commits into
MODSetter:dev
from
AnishSarkar22:feat/agent-image-generation
Nov 7, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1747b62
feat(local): let the agent draw and edit pictures
AnishSarkar22 03fe579
feat(local): place the agent's pictures in documents
AnishSarkar22 b4aba14
feat(local): make images inline when the agent saves a page
AnishSarkar22 f72182c
feat(local): name the picture step in an agent thread
AnishSarkar22 d444f40
docs(agent): describe the agent's pictures and why it has its own tool
AnishSarkar22 c4a036c
Merge remote-tracking branch 'upstream/dev' into feat/agent-image-gen…
AnishSarkar22 71e8659
fix(local): drop the Plugins badge and give Jobs a line icon
AnishSarkar22 9376dcf
fix(local): stop refusing picture prompts for length or offering edit…
AnishSarkar22 da23783
fix(local): close the gaps review found in the agent's pictures
AnishSarkar22 f2eef67
test(local): lint the desktop frontend on commit and stop the approva…
AnishSarkar22 c124a35
Merge remote-tracking branch 'upstream/dev' into feat/agent-image-gen…
AnishSarkar22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
docs/adr/0087-the-agent-makes-pictures-with-its-own-surfsense-tool.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # ADR 0087: The agent makes pictures with its own SurfSense tool, not opencode's | ||
|
|
||
| - **Status:** Accepted | ||
| - **Date:** 2026-11-07 | ||
| - **Amends:** [ADR 0066](0066-web-pages-are-html-the-model-writes-without-network.md), in part: its rule that nothing is written into a page but the policy | ||
| - **Source:** maintainer decision, 7 Nov 2026 (no permalink) | ||
|
|
||
| ## Context | ||
|
|
||
| The agent could start Studio's image job only from ticked sources, with a chat model rewriting its request, and got nothing back to look at or place. Documents could place only source figures and analysis charts. | ||
|
|
||
| opencode 2.2 added `experimental_image_generate`. A spike on 2.2.5 with SurfSense's configuration found it writes files and edits through `/images/generations` and `/images/edits`, but runs in the background: the turn goes idle before the picture is ready, and a second run brings the notice. It is listed only when a provider has an image model. | ||
|
|
||
| ## Decision | ||
|
|
||
| - The agent draws through `surfsense_make_image`, a SurfSense tool over Studio's job, not opencode's tool. | ||
| - A picture is a normal Studio artifact, with versions, the viewer and the Edit box, and needs only an image model: the agent writes the prompt, and no chat model rewrites it. | ||
| - `image-<artifact id>` names one version, and only the chat that made it can place or edit it. | ||
| - A tool call keeps its limit. A picture past it answers as queued, and no tool polls. | ||
| - A page names an image as `surfsense-image:<name>`, and saving makes it a `data:` URL. The agent has no shell, and typing base64 through a model is not practical. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - opencode threads and Claude plan threads get the same tool, which opencode's would not reach. The pinned opencode stays at 2.1.2, with no new model routes or second-run handling. | ||
| - Local pictures run through the existing sd-server and text-runtime hold. | ||
| - A stored page is what the model wrote, its images inline, plus the policy. Its working file keeps the names. | ||
| - A document needing a picture still being drawn waits for the user's next message. | ||
| - Studio's own buttons keep drafting from sources through a chat model, and Studio's drafts cannot place these pictures. | ||
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.