templates: upgrade Yutori templates from n1.5 to n2 - #237
Open
dprevoznik wants to merge 2 commits into
Open
Conversation
n2 is a computer-use model, not a browser-use model, so this is more than a model id swap. The API surface changed in ways that break the n1.5 loop: - GUI actions now arrive as a single `computer_batch` call carrying an action list instead of one tool call per action. The loop unpacks the batch, runs it in order, stops at the first error, and answers with one tool result and one screenshot taken after the last action that ran. - `disable_tools` is rejected with a 400, so `bash`, `read`, `write`, and `edit` are always served. New system tool module backs them with Kernel's process and filesystem APIs. - `goto_url`, `go_back`, `go_forward`, `refresh`, and horizontal scroll are gone — n2 drives the address bar and browser buttons directly. Kiosk mode is removed with them: it hides the address bar n2 needs, and n2 wants a whole-screen capture rather than a cropped one. - `scroll` `amount` is now a wheel notch count, matching Kernel's delta_y 1:1. - `mouse_down` / `mouse_up` take optional coordinates for manual drags. - Key space gained punctuation word forms. - `reasoning_content` is echoed back on each turn, `reasoning_effort` is exposed on the payload, and `max_completion_tokens` is raised to 16384 since the reasoning trace shares that budget. - Screenshot trimming now matches n2's server-side retention: images are kept only on the last 2 image-bearing messages, with the 10 MB cap as a backstop. - `prev_request_id` threads through so a trajectory groups into one conversation for usage reporting. Verified end-to-end against the live n2 API and a Kernel browser in both languages, including a `bash` call executed on the browser VM. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e2b3ba2. Configure here.
String.prototype.replace with a string replacement expands $$, $&, $\` and $' inside the model's new_string, corrupting shell and script edits. Use the replacer function form. Python's str.replace has no such behavior. Also pass cwd explicitly in the TypeScript bash tool so both adapters send the same field; the Kernel API types it as nullable and accepts null. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
Upgrades the TypeScript and Python Yutori templates from Navigator n1.5 to n2.
n2 is a computer-use model where n1.5 was a browser-use model, so this is more than a model id swap — the tool surface, the action space, and the screenshot contract all changed. Adapter changes below.
What changed
Tool call shape. n1.5 returned one tool call per action. n2 returns a single
computer_batchcall carrying an ordered action list. The loop unpacks it, runs the actions in order, stops at the first error, and answers with one tool result carrying one screenshot taken after the last action that ran. Every coordinate in a batch refers to the pre-batch screenshot. This also cuts a screenshot round-trip per action.disable_toolsis now rejected (HTTP 400). The old templates used it to exclude the DOM/Playwright tools. n2 serves its tool set whole, sobash,read,write, andeditalways reach the loop and have to be answered. Newtools/system.{ts,py}backs them:bashbrowsers.process.exec— working directory persists across calls,run_in_backgrounddetaches and reports pid + log pathreadbrowsers.fs.readFile—cat -noutput withoffset/limitpagingwritebrowsers.fs.writeFileeditRemoved actions.
goto_url,go_back,go_forward,refresh, and horizontal scroll are gone; n2 drives the address bar and browser buttons itself. Addedscreenshotas a no-op batch member.Kiosk mode removed. It hides the address bar n2 now depends on for navigation, and n2 explicitly wants a whole-screen capture — cropping chrome away removes click targets. Kernel's Computer Controls screenshot already captures the window with its chrome, which is what n2 wants, so the template just uses it directly.
viewportWidth/Heightare renamed toscreenWidth/Heightin the loop to reflect that they are the screen, not a page viewport.Other adapter changes:
scrollamountis a wheel notch count, mapping 1:1 to Kernel'sdelta_y(previously multiplied by 4 for n1.5's ~10%-of-viewport unit).mouse_down/mouse_upcoordinates are optional — without them the button acts at the current cursor position, which is what a manual drag needs. Previously a missing coordinate silently fell back to screen center.slash,quote,backquote, …), mapped to XKeysym.reasoning_contentis echoed back on every turn;reasoning_effortis exposed as a payload field;max_completion_tokensraised 4096 → 16384 since the reasoning trace shares that budget.temperature0.3 → 0.6 (n2's server default; 0 is not recommended for a reasoning model).computer_use_tools-20260825.parallel_tool_callsis pinned true server-side, so a turn can carry several calls. The loop runs the first and answers the rest with an error telling the model to re-plan, since they were planned against a screenshot the first call already changed.prev_request_idthreads through so a trajectory groups into one conversation for usage reporting.Testing
Both templates were run end-to-end against the live n2 API and a real Kernel browser:
bashtool (curl -s https://example.com | cat -A), exercising theprocess.execpath on the browser VM.Also unit-exercised against a fake Kernel client in both languages: batch ordering, stop-at-first-error with correct action attribution, coordinate denormalization and clamping, key expression parsing,
bashworking-directory persistence,edit-before-readguard, and screenshot trimming.tsc --noEmitandpyflakesare clean;go build ./...andgo test ./pkg/...pass.🤖 Generated with Claude Code
Note
Medium Risk
Large changes to reference agent loops and new VM shell/filesystem tooling on browser sessions, though scoped to sample templates rather than core platform services.
Overview
Upgrades the Python and TypeScript Yutori sample apps (and the create-template metadata) from Navigator n1.5 to n2, including default model
n2, tool setcomputer_use_tools-20260825, and updated docs.The agent loop is reworked for n2’s contract: GUI steps arrive as one
computer_batch(run in order, stop on first error, one post-batch screenshot per result),bash/read/write/editare handled via newSystemToolson Kernel process/filesystem APIs, and extradisable_tools/ per-action navigation tools are dropped. Kiosk mode and thekioskpayload field are removed;reasoning_effort,prev_request_id, echoedreasoning_content, highermax_completion_tokens, and screenshot trimming aligned to n2’s last-two-image rule replace the old n1.5 behavior.ComputerToolnow batches actions, denormalizes coordinates internally, and no longer implementsgoto_url/ history / refresh or horizontal scroll; viewport sizing is treated as screen dimensions with full-window captures.Reviewed by Cursor Bugbot for commit cf32041. Bugbot is set up for automated code reviews on this repo. Configure here.