Canvas
/canvas opens a local browser companion for the running interactive session. The terminal stays primary: the canvas adds per-hunk diff review, a clickable session tree, and cost charts, and everything it can decide also has a terminal fallback.
Commands
| Command | Description |
|---|---|
/canvas |
Start the canvas server (or reuse the running one) and open it in the browser. Prints the URL |
/canvas review [on|off] |
Turn the diff review gate on or off (toggles without an argument). Starts the server if needed |
/canvas url |
Print the URL again without opening a browser |
/canvas stop |
Stop the server and turn the review gate off |
The server also stops when the session ends. It follows /new, /resume, /fork and similar session swaps.
Views
Review
With the review gate off, the view shows a live diff of the working tree against the session baseline (the same diff as /diff --session), or uncommitted changes before the first checkpoint. It refreshes after edit, write and bash calls.
With the review gate on, every edit and write call waits before it touches the disk. The canvas shows the proposed change split into hunks (one per contiguous change, with three lines of context):
- Approve all runs the call unchanged, as long as the file is still the one that was reviewed.
- Approve selected applies only the checked hunks. The model's tool result says which hunks were approved, shows the rejected hunks as a diff, and asks it to re-read the file before editing it again.
- Reject blocks the call. The model gets an error result saying the change was rejected and that nothing was written.
The optional comment is sent to the model with any of the three decisions.
Nothing runs unreviewed while the gate is on:
- A call whose change cannot be computed (an
editwhoseoldTextdoes not match, a missing file) is not held for review; it is blocked with the error the tool would report. - The tool calls of one turn are all gated before any of them runs. A call on a file that already has a reviewed change waiting to be applied in the same turn (for example
writethenediton the same file, or aneditthat depends on the previous one) is blocked with an error asking the model to re-issue it in a separate turn, after the first change is applied. - Every approved change carries a content check: if the file changed between review and execution (another tool, an editor, a formatter), the call fails without writing and the model is told to re-read the file.
Fallbacks:
- No canvas tab connected when a review starts, or the last tab closed for more than 3 seconds: the terminal shows an approve / reject / reject-with-comment prompt. The canvas can still decide while that prompt is open; whichever answers first wins.
canvas.reviewTimeoutSeconds(default0, no timeout) moves a waiting review to the terminal prompt after that many seconds.- Esc in the terminal, including in the review prompt, aborts the run; the pending review is then rejected as cancelled.
Partial approval of an edit is executed as a single whole-file replacement of the reviewed content.
Session tree
The session tree with the current branch highlighted and the current position marked. Branch points are indented like /tree. Tool results and metadata entries are hidden by default. Clicking an entry moves the session there, the same as selecting it in /tree without a branch summary. Navigation is refused while the agent is working.
Costs
- Totals: session cost across all branches, cost of the current branch (matches the session stats), assistant turns, model usage reported by tools, background usage, cache-warming pings.
- Cumulative cost over turns and cost per turn (turns on other branches are faded). Model usage reported by tools (
details.modelUsage, for example subagents and the oracle) and background requests (compaction,/handoff,/learn,/race, ...) are separate points with their own colors. - Cost per model, with tool and background usage as separate rows.
- Routing ledger stats for the last 30 days from the local routing ledger (
/routing-stats): turns, success rate, failovers away, edit failures, latency and cost per model.
Security
- The server binds to
127.0.0.1on a random port. - The URL carries a random 256-bit token. Loading the page with it sets an
HttpOnly,SameSite=Strictcookie, and the token is removed from the address bar. Every request needs the cookie or thex-elyra-canvas-tokenheader; without it the server answers 401. - Requests whose
Hostis not127.0.0.1:<port>orlocalhost:<port>, or whoseOriginis another origin, are rejected with 403 (DNS rebinding and cross-site requests). - Commands must be
application/jsonPOSTs. - Responses carry a strict Content Security Policy (
default-src 'none', scripts, styles and connections only from the server itself),X-Frame-Options: DENY,no-referrerandno-store. The page loads no remote resources. - The canvas cannot send prompts or run commands. It can only read the session, navigate the tree, abort the run, toggle the review gate and decide reviews.
Protocol
The page talks to the session in-process through the server:
GET /api/eventsis a Server-Sent Events stream. Each event is a session event with the same shape as in RPC mode (minus the per-tokenmessage_updateandtool_execution_updateevents), plusreview_requested,review_resolved,review_fallback,review_gate_changedandcanvas_session_changed.POST /api/commandtakes{ "id"?, "type", ... }and returns{ "id", "type": "response", "command", "success", "data" | "error" }like RPC mode. Supported:get_state,get_session_stats,abort(RPC commands), andget_tree,navigate_tree { entryId },get_costs,get_diff,get_reviews,set_review_gate { enabled },review_decision { reviewId, decision }wheredecisionis{ "action": "approve" | "reject", "comment"? }or{ "action": "partial", "approvedHunks": [1, 3], "comment"? }.
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
canvas.reviewTimeoutSeconds |
number | 0 |
Seconds a review waits for the canvas before the terminal prompt appears. 0 waits indefinitely |