Skip to content

studio-agent: an agent edit flashes and scrolls to where it landed; the prompt box grows with the text - #255

Merged
petersalomonsen merged 1 commit into
masterfrom
studio-agent-edit-flash
Oct 10, 2026
Merged

petersalomonsen merged 1 commit into
masterfrom
studio-agent-edit-flash

Conversation

@petersalomonsen

Copy link
Copy Markdown
Owner

Problem

When the agent edits the code, nothing in the editor shows where. Each write called doc.setValue(), which replaces the whole document and loses the scroll position. Someone watching (on stage, or in a session video) sees the code change but not which part.

The prompt box was also a fixed 2 rows, so a longer instruction scrolled out of view while it was being typed.

Change

  • Agent edits flash and scroll into view. Every agent write to the song, synth and shader editors (set_*, edit_*, run_script writes, auto_master) goes through writeEditor() in client.js:

    • only the span that changed is replaced (replaceRange), so the editor keeps its scroll position and each agent edit is one undo step;
    • the editor scrolls to those lines (vertically only, so a long changed line doesn't scroll the code sideways);
    • the changed lines flash yellow and fade out over 1.6 s.

    The diff is a pure function, changedSpan() in tools-core.js, with unit tests. Faust edits are not covered: they reach the faust editor through the file list, not through these writes.

  • The prompt box grows with the text. It starts at its 2-row height, grows as you type up to 40vh, then scrolls, and goes back to 2 rows after a send.

Testing

  • npm run test-agent-tools: 160/160 pass, including the new changedSpan tests.
  • Studio-agent e2e specs in local repos (performance, kit, abort, nearai, and the run_script/render_shader tests in the mock spec): all pass.
  • Not run locally: the 4 mock-spec tests that need the NEAR sandbox (Docker wasn't running). CI covers them.
  • Checked on camera by re-recording a 21-prompt stage session with tools/session-video at phone width: the flash and scroll follow each edit down the song, and the long prompts wrap in the growing box.

🤖 Generated with Claude Code

…he prompt box grows with the text

Every agent write to the song, synth and shader editors (set_*, edit_*,
run_script, auto_master) now goes through writeEditor(): only the span that
changed is replaced (scroll position kept, one undo step per edit), the editor
scrolls to those lines and they flash, fading out over 1.6 s.

The prompt textarea grows with what is typed, from its 2-row height up to
40vh, then scrolls; it goes back to 2 rows after a send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying webassemblymusic with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3ba0b07
Status: ✅  Deploy successful!
Preview URL: https://556371ac.webassemblymusic.pages.dev
Branch Preview URL: https://studio-agent-edit-flash.webassemblymusic.pages.dev

View logs

@petersalomonsen
petersalomonsen merged commit 9aed461 into master Oct 10, 2026
9 checks passed
@petersalomonsen
petersalomonsen deleted the studio-agent-edit-flash branch October 10, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant