Repository navigation
Conversation
There was a problem hiding this comment.
Looks sound. On the base, a reply naming clip.mp4 shows only text. With this change the same reply gets an inline video tile (screenshots below). The TUI tests closest to the change and the core and Bedrock tests (model-request, generate, compaction, runner-message, bedrock-converse) pass. I couldn't run the typecheck scripts here: bun check is missing from this Bun version.
Public API changes, all backwards compatible:
- New config key
experimental.rich_media(boolean), added toopenapi.jsonand the generated clientConfigEntrytype. It can also be set throughOPENCODE_FLAGS. - New keybinds:
session.media.view(<leader>v),media.pip.toggle(<leader>p),media.pip.expand(<leader>o) andmedia.pip.close(none). - Bedrock Converse now sends
videoblocks for the supported MIME types. - The TUI writes a new
prompt-media/directory under its state directory for videos kept in history and the stash.
With the flag off, which is the default in release builds, core still leaves video attachments out of the request without telling the user. The TUI and the server also read the flag from their own configs, so the TUI can accept a video that the server then drops.
One inline note on a size-limit mismatch for restored videos.
The tests add about 3.4k lines, much of it end-to-end app tests with 20 s timeouts. Several check that something does not happen after a fixed Bun.sleep(50–100). Those checks pass by default when the machine is slow, so they say little. Trimming them to the core cases (media-viewer, session-inline-media, context/media) would make them easier to maintain.
Related: #54600
| } | ||
|
|
||
| // Reads again the files a draft, history, or the stash kept as local paths. `unreadable` names the ones left out. | ||
| // The paste cap for videos does not apply: a restored video may be as large as core accepts. |
There was a problem hiding this comment.
This reads kept files up to MAX_LOCAL_ATTACHMENT_BYTES (20 MiB). Core only sends a video up to 18 MiB of base64, which is about 13.5 MiB of file (MAX_LOCAL_VIDEO_BYTES). So a restored video between 13.5 and 20 MiB is read, encoded and uploaded here. Then boundVideos replaces it with the "too large" text on the first turn, and the user gets no toast. Capping videos at MAX_LOCAL_VIDEO_BYTES here, and adding them to unreadable (or giving them their own warning), would match what the comment says.
There was a problem hiding this comment.
The new commits look fine. I re-ran the same check as before: on the base, a reply naming clip.mp4 shows only text. Now it gets an inline tile, and <leader>v opens the redesigned viewer on it (screenshots below). The media, prompt, gallery and diff-viewer image tests pass (228). The sleeps and long timeouts are gone from the rich media tests, except one 50 ms sleep in session-media-refs.test.tsx. The path menu offers "Open folder" only when the file is on this machine. The new commits don't change the public API.
The earlier point about restored videos between 13.5 and 20 MiB in local-attachment.ts isn't addressed yet.
There was a problem hiding this comment.
The two new commits look fine. I ran the same reply as before: on the base it shows text only, here it shows an inline tile, <leader>v opens the viewer, and c shows "Path copied to clipboard" (screenshots below). The viewer, tile, picture-in-picture, media context, prompt, diff-viewer and mini transport tests pass (377).
The viewer and picture-in-picture are now rendered directly instead of being registered at import time. That works, and the diff viewer's video click still stops the click from reaching anything underneath through the shared click handler. These commits don't change the public API.
The earlier point about the size limit for restored videos in local-attachment.ts is still open.
There was a problem hiding this comment.
The two new commits look fine. I ran the same check as before: on the base, a reply naming clip.mp4 shows only text; here it gets an inline tile, and the viewer and c still work (screenshots below). The tests closest to these commits pass, apart from two failures in dialog-shell-output.test.tsx that happen the same way on the base.
History and the stash now record which server a file:// attachment came from. An entry written before this change, or recorded from another server, is left out on a remote server with the existing "Could not read" warning, which is the safe choice. The media cache is now pruned (7 days unused, then down to 2 GiB), which skips files another TUI has already removed. These commits don't change the public API.
The earlier point about the size limit for restored videos in local-attachment.ts is still open: readKeptAttachments still reads up to 20 MiB.
There was a problem hiding this comment.
The new commit works. The Experiments dialog now lists "Rich media" and shows its resolved value (on in a local build; screenshots below), and the new tests pass. This commit doesn't change the public API.
One concern, inline: the toggle only writes the TUI's config, so in a release build the server still leaves videos out of the request. A smaller point: when OPENCODE_FLAGS sets rich_media, toggling writes the config but the entry's value doesn't change, because the environment variable takes priority.
The earlier point about the size limit for restored videos in local-attachment.ts is still open.
| description: "Let the agent open terminals in this TUI (requires server support)", | ||
| }, | ||
| { | ||
| id: "rich_media", |
There was a problem hiding this comment.
This writes experimental.rich_media only to the TUI's config. The server reads the flag from its own config (packages/core/src/flag.ts), and in release builds it defaults to off. So on a release build, turning on "Rich media" lets you attach and play videos in the TUI, but core still leaves them out of the request without telling the user. That is the problem the description sets out to fix. Could the toggle also write the server's experimental.rich_media? Or the entry could say it only covers the TUI, and the composer could warn when the server's flag is off.
…ure-in-picture OpenTUI 0.8 can play H.264 video natively through Kitty graphics, Sixel, or quadrant blocks, but the TUI only showed small image thumbnails and refused video everywhere: the composer would not attach it, the transcript could not show it, and core silently dropped video attachments before they reached the model. Behind the new "rich-media" experiment, images and videos now render as tiles in the transcript, the composer, and the diff viewer. A video tile shows a poster frame from 10% into the clip and plays silently while hovered, one tile at a time. Clicking a tile opens a fullscreen viewer over every image and video in the session, with sound, seeking, a live scrub preview on the seek bar, frame stepping, crop-based zoom and pan, and an info overlay. A video can move into a draggable picture-in-picture player that keeps playing over the session. Composer drafts accept .mp4/.mov/.m4v paths as [Video N] attachments without bloating prompt history, and mini mode writes a one-line caption for videos. The core change is unconditional because the old behavior was a silent data loss: user video attachments are now lowered to models with video input, others get the existing "does not support video input" text, Bedrock Converse receives proper video blocks, compaction estimates video tokens, and only the newest video under an inline size cap is resent so an oversized clip cannot fail every later request. The media-viewer and inline-media stories render the real components; OPENCODE_STORY_MEDIA points them at a directory or list of local files.
The first rich-media commit grew to 5,200 lines, more than half of them tests that walked one example per renderer case. This pass shrinks the change to about 3,800 lines against the original base while keeping a mutation-checked assertion for every earlier review finding. The viewer and picture-in-picture now share one transport (player state, play and pause, seeking, start position) and one set of controls, so the viewer drops from 661 to under 500 lines and the PiP from 237 to under 200. The two media stories become one `media` story. Tests move to table tests for pure logic (classification, poster time, zoom geometry, paste size checks, video bounding, Bedrock formats) and a set of focused renderer tests with short titles. Review of the pass found and this commit fixes: a PiP that became ready under an open viewer played behind it; the composer previewed bare file URIs that a remote server cannot read; restored remote videos were persisted into prompt history as full base64 again; the diff viewer showed a Windows server path instead of the file name; Bedrock rejected video/mpg and video/wmv; and loading video tiles looked like failed ones. Removed viewer bindings: alt+arrow pan (drag pans), home and end (0 jumps to the start).
…ders A perf run with 1080p clips found the viewer's seek bar could freeze the TUI: a paused seek decodes synchronously on the JS thread (24-134 ms for 1080p, from the previous keyframe), the hover preview seeked every 30 ms, and while dragging both the main player and the preview seeked on every move. Sweeping the bar used about 650% CPU with multi-second stalls. Seeks now go through a throttle that waits at least 120 ms, or twice the last measured seek, between seeks. The preview seeks only once the pointer rests for 80 ms and stays hidden while dragging, since the main player already shows the frame; a drag still lands on the exact position when released. The bar rebuilds its text only when the playhead or hover column changes rather than on every time update. Opening the viewer used to mount a live decoder (about 55 MB and ten threads) for every video in the filmstrip. Filmstrip videos are now labels; only the stage plays. With the experiment on, the renderer asks OpenTUI for Kitty file transport, which OpenTUI probes and only uses for local terminals outside multiplexers; otherwise it keeps sending inline. The info overlay shows which transport is in use.
Review of the seek throttle found that nothing on the seek bar followed the pointer while dragging: the preview and hover marker are hidden during a drag, and the playhead and time only moved when a throttled seek ran, up to about 270 ms apart for 1080p. The transport now holds the time under the pointer while scrubbing, so the playhead and time label follow the pointer immediately while the video seeks stay throttled. A paused seek decodes synchronously and OpenTUI never skips an identical target, so a click on the bar decoded the same frame twice, and a release after the throttle had already landed decoded it again. The release now flushes through the throttle, which skips a repeated time and restarts its cooldown, and the preview no longer re-seeks the frame it already shows when a drag ends. The info overlay read OpenTUI's last-transmission status once, so it could show the wrong Kitty transport; it now shows the session's file transport state and refreshes it while open.
A second perf run and whole-branch reviews found costs and gaps that the earlier rounds missed. Every transcript video poster kept its own decoder open, about 86 MB and a dozen threads each whether or not it was on screen, so a session with eight clips held some 600 MB. Posters now keep a player only while they are on screen, at most four at a time; the rest show a label or nothing. Hovering starts playback only after the pointer rests for 300 ms. Kitty frame files go to XDG_RUNTIME_DIR, a tmpfs, instead of TMPDIR when it is set. Pasting a video stalled typing because the whole file was base64 encoded into the draft. Local video drafts are now a path that is read on submit. Prompt history and stash write any inline video to a file before persisting, whether or not the experiment is on, so restored prompts can no longer put megabytes of base64 into the jsonl files. The composer caps videos at the size core can send inline, so a clip core would drop gets the oversize warning instead. Core sent video to protocols that cannot carry it whenever the catalog claimed video input, which failed every later turn of the session. Mistral and Cohere chat, and Bedrock video types outside its list, now get the existing "does not support video input" text. Keyboard seeks on a paused video now share the seek throttle, mute, volume and loop survive the move between the viewer and picture-in-picture, a drag released over a control no longer clicks it, collapsed activity groups stop rebuilding their media strip, and the session gallery is cached per message.
Trims the round-two fixes by about a sixth of their source and a third of their tests: the visibility tracker takes a tile's box directly and lets the next frame prune departed tiles, the tile merges its disarm and release paths, the seek preview derives its 'behind' state instead of keeping a flag, and tests that repeated one scenario become tables or fold into the scenario they extend. Behavior is unchanged.
Review of the round-two fixes found that the four-decoder cap traded memory for scrolling jank: every time a video tile came into view it reopened its decoder and re-seeked its poster on the JS thread, about 75 ms per tile for 1080p, and wheel jitter at an edge repeated it. Decoders now go to the tiles showing most of themselves, a tile that drops out keeps its decoder for two seconds, and tiles within half a viewport of the screen draw their label before they scroll in. A jittery scroll over twelve tiles now opens 20 decoders instead of 36. Visibility is recomputed only on scroll, resize, tile changes and the viewer opening or closing, instead of on every frame, and tiles under the viewer give their decoders back after the grace period. On the prompt side, a restored local-server video got its path in a microtask and only for three extensions, so a stash or history entry could keep a bare file:// uri that a TUI attached to a remote server then sent as is. The path is now set synchronously for any video, and submit never forwards such a uri to a remote server. Kept files are read up to the 20 MiB core accepts rather than the paste cap, files in prompt-media are sent inline so their cache path never reaches the model, prompt-media is pruned of files no history or stash entry names, and history writes are atomic so pruning never sees a half-written file. Compaction estimates now apply the same protocol-aware video gating as requests, so a video a protocol cannot carry no longer counts as thousands of tokens.
…rompt writes Review of the previous fix found that its submit guard dropped real attachments: undo, revert or fork in a TUI attached to a remote server restored a pasted file as its server-side file:// source, which the guard then refused, so the rewind committed without the file even with rich media off. Restore now uses the stored copy unless the server is local or the file is an @ mention. Prompt-media pruning could delete a file a draft still needed, because popping an old stash entry or reusing an existing file left its mtime more than a day old. Loading a prompt into the composer and reusing a file now refresh it. The atomic writeText added last time let an appendText to the same file land on the replaced inode and vanish, so writes and appends are now queued per file. Kept videos get their real MIME type instead of video/<extension>. Tiles under an ancestor hidden with visible=false, such as the session pane behind a fullscreen panel, are re-measured every frame until they are visible again, so they no longer stay blank after the panel closes. The scroll content, viewport and terminal resize triggers now each have a test.
… hidden panes The previous commit made remote undo, revert and fork inline every server-side file: attachment that was not an @ mention, so directories became text and line-ranged context files froze at their old content, even with rich media off. A bare file: uri only means something to the server that produced it, so prompts restored from the current server send it back as before, and only entries loaded from client-side prompt history or stash are marked so the submit guard can keep a path-less file: uri from another server away from a remote one. Hiding the session pane behind a fullscreen panel keeps its width, so no resize or scroll fires and idle posters held their decoders the whole time. While any poster has a player, each rendered frame now checks whether a tile was hidden or shown by an ancestor and places again if so; an idle TUI renders no frames, so this costs nothing at rest. Adds tests for the write queue recovering after a failed write and resolving relative paths, and for keepPromptMedia leaving files outside prompt-media untouched.
Sending attached videos to the model changes requests for every provider, yet it ran for everyone, while the TUI side sat behind a TUI-only experiment. Both now follow one feature flag, rich_media, on in local and dev builds and off in releases. Core reads the flag in SessionContext, and toLLMMessages leaves attached videos out unless it is on, so with the flag off requests are the same as before video support. The video size bound and protocol checks stay ungated: with the flag off they only see videos returned by tools, which reached providers before too, and for those they are fixes. Showing media needs nothing from the server, and clients cannot read the server's flags, so the TUI and mini mode resolve the same key from their own settings with the same rules: OPENCODE_FLAGS, then experimental.rich_media and all_flags in the TUI config, then the build channel. The entry leaves the Experiments dialog. A TUI with the flag on against a server with it off shows a pasted video, but the model does not receive it, as before.
Reviews of the flag gate found that no test ran it where it matters: the runner and SessionContext could ignore the flag, or the TUI its build channel, and every test still passed. A runner test now sends a video with the flag off and then on, a TUI test reads rich media under local and release channels and from config, and the mini host test checks the channel it passes. The TUI copied core's OPENCODE_FLAGS parsing and channel default, so both now come from ConfigFlag in schema and cannot drift apart. The flag rides on SessionContext's selection instead of a separate accessor, since every caller selects first, and recentUserMessages takes it without a default so a new caller cannot forget it. TUI tests set flags through the TUI config, so the preload clears OPENCODE_FLAGS; with OPENCODE_FLAGS=all in a developer's shell, the media tests failed or hung.
A model that renders or downloads a clip usually just says where it put it, as in "Saved to `out/demo.mp4`", and watching it meant leaving the TUI. A finished reply that names a playable video now shows it as a tile under that text, and the viewer steps through it with the session's other media. Nothing is sent to the model. Absolute paths, paths relative to the session's directory, file:// URLs, markdown link targets and paths in backticks or quotes count, in the server's path flavor; ~/ only when the server runs here. A tile appears only for a file that exists: a local server checks this machine, a remote one lists the parent directory, and only inside the session's directory, the one place this terminal can read from. Each path is checked once while found; a missing one again only when a later reply names it, as when a reply plans an output a later step renders. Replies that name no video skip parsing after one extension test. Like the rest of rich media, it follows the rich_media flag.
Reviews of the previous commit found that reply text could crash or stall the TUI and probe the wrong files. A file: URL with a fragment, or an escaped separator, passed the extension check on its raw text but resolved to another file, so an existing README.md became a video with no mime type and the session crashed on every open. The mime type now comes from the resolved path in the server's path flavor, and anything that is not a playable video is dropped. Link targets matched in quadratic time, so one long line of unclosed links blocked the TUI for seconds; matching is now linear and only lines naming a video are read. Mentions of //host or \\host paths are ignored, so a Windows server never contacts a share they name, and UNC paths get no tiles. On a POSIX server, backslash .. segments slipped past the check that keeps remote listings inside the session's directory. A failed check no longer counts as an answer, a reply that names a file while another reply's check is running checks again if that one found nothing, a missing remote directory counts as missing, and concurrent listings of one directory are shared. Commands in backticks now yield their file arguments, link labels and globs no longer count as paths, link targets are percent-decoded, and parentheses inside names, key=value flags, Unicode quotes and full-width punctuation are handled.
A re-review of the previous fix found that spans were tokenized again recursively after their link targets were percent-decoded, so nested encoded links made parsing super-linear. Span words are now found in one pass, and nothing inside a span is decoded or read as a link. Link targets are trimmed before the file: test and never split into words, so an escaped https: target no longer leaves a bare path behind. A check that failed for a transport reason was only retried when its reply was collected again, which a finished reply never is after a reconnect, so an existing video stayed missing for the whole view. Unanswered asks now follow the client's connection and retry once it is back; a file answered as missing is not checked again. Asks made before a check starts share it, and later ones share one follow-up, so opening a session checks each file once. A leading `*` was stripped before the glob check, turning **/tmp/a.mp4 into /tmp/a.mp4; emphasis is now stripped unless a glob's `*/` or `*.` follows, also when it opens or closes on another word. POSIX names with a backslash keep it in their file URL and in remote name matching.
The rich media tests waited with fixed sleeps and carried 20 second per-test timeouts. Several asserted that something did not happen after Bun.sleep(50-100), which passes by default on a slow machine and so proves little, and the app-level tests booted the whole app thirteen times. Every negative check now waits on a positive signal first: a deferred response, a settled check, a write queued behind the app's own, or a later event ordered after it. The viewer, tile, picture-in-picture and media context tests run on a ManualClock, so hover rests, grace periods and seek throttling advance by clock instead of wall time. The app-level tests are three boots, remote, local and with rich media off, and the reply-video tests are folded into them. Two small seams make that possible: the seek throttle and the pixel size poll take the renderer's clock, and the prompt history and stash providers expose when their entries are loaded and return their write promises. No test in these files sleeps or sets its own timeout, and every fix commit's primary change still fails a test when reverted.
The viewer opened over every gallery item, so a file shown more than once in the transcript, as when a reply names the video the user attached or a tool returns the same screenshot twice, repeated in the filmstrip and in the count. The viewer now gets each file once, at its first appearance, and a tile for a repeated file opens it there. A file: URL counts as its server path whatever Location or encoding it came with; other URIs count as their content. The transcript still shows a tile under each message that names the file.
The viewer showed everything it could at the same weight: a header that read like a debug line, a transport row mixing colors and words, a permanent volume percentage, a filmstrip of grey label boxes with names cut to "Bi...B.mp4" and an underline for the current one, and a footer of nine key hints. It worked, but it was no fun to look at. The header is now the image viewer's: "Video 2 of 5" and esc. The name, resolution, duration and frame rate move to a Details card on i. The transport is one quiet row: play, elapsed time, a scrubber with the elapsed part in the accent, the total, and sound and loop toggles. The filmstrip shows evenly sized cards with the current one in an accent border, image thumbnails, durations for videos once known, and names that keep their extension. Volume, mute, loop, zoom, fit and seeks show a short message over the picture instead of permanent text. The key hints are gone; ? opens a grouped keys panel. A file that cannot play gets a centered card, and picture-in-picture uses the same controls, with loop now carried to and from the viewer.
The redesigned header said "Video 2 of 5", which names the kind but not the file. It now shows the file's name on the left, without the path a pasted file can carry as its name, and the position beside esc on the right. A long name is shortened in the middle, keeping its extension, and keeps a gap before the position, which it previously ran into.
A pasted file can carry its whole path as its name, so the filmstrip, tiles and picture-in-picture showed labels like "/home/…e.png". Every media label now shows the file's name, and the Details card shows the path, for server files too. Clicking the name in the viewer's header opens the menu the working directory uses, titled with the file's name: copy its path, and open its folder in the system file manager when the file is on this machine. A file known only by its content has no menu. The working directory menu is now one use of a path menu that takes a title, a path and a folder.
Copying a file's path meant opening the header's menu first. c now copies it directly, with the menu's "Path copied to clipboard" toast; media known only by its content shows "No file to copy". The keys panel lists it.
A pass over the whole branch for what its fix rounds left behind. The media host renders the viewer and picture-in-picture directly instead of having them register themselves through side-effect imports, the click helper has one implementation that the diff viewer's placeholder now uses too, the diff preview reuses pathFlavor and one open handler, writeText has one cleanup path for a failed write or rename, two comments that still named the experiment name the flag, and a line the branch had reformatted in the mini transport is back as on dev. The diff viewer's "Click to load" placeholder no longer opens the viewer when a drag that started elsewhere is released over it, like every other media control.
A whole-branch review of the media UI found that closing the viewer after its two second grace reopened every inline poster decoder in one frame, about 400 ms for four 1080p tiles. Tiles that rank together now get their players one per frame, best first, with their label until then; the cap and grace are unchanged. The seek bar's preview opened a decoder the moment the pointer crossed the bar; it now opens after the pointer rests, and seeks to the hovered time as it opens. The Details panel is bounded to the picture and shortens long names, the keys panel clamps its scroll after a resize, and durations are kept by file path or a hash of the uri instead of whole data: URIs. The on state of the sound and loop toggles uses the form field's selected token and the header the base surface's text. The story no longer names a directory that is gone, and tests now cover the keys panel's scrolling, a dialog with an input over the viewer, and the grace period's player cap.
A whole-branch review of the integration side found that recalling a prompt from history or the stash on a remote server dropped the server's own file: attachments, as undo, revert and fork restore them, even with rich media off. History and the stash now record which server such a file came from, by its URL's origin, and send it again only to that server; entries written before that stay guarded on a remote server. The transient recalled marker is gone, so it can no longer be written to disk. The video cache under ~/.cache/opencode/media is pruned when it is created: files unused for seven days, then the oldest until it fits in 2 GiB, and stale temporary files. A sent attachment keeps the file: URL it was read from, so the viewer merges it with a reply naming the file, shows its path and, on a local server, plays the file itself. Windows paths keep UNC hosts and backslashes, file matching ignores drive letter case, and POSIX names keep their backslashes. On a remote server, generated images saved outside the session's directory no longer show broken tiles. An explicit image_preview false is honored under rich media, and Settings shows the effective default. A file check that fails without an answer is retried with a growing delay. Core's removed-video note no longer assumes the user attached the video, and an upper-case video MIME type is no longer missed. Mini mode's subagent transcripts get video captions.
Moving rich media to the rich_media flag left release users only experimental.rich_media in the TUI config or OPENCODE_FLAGS to turn it on. It is back in the Experiments dialog, which writes that key. An entry backed by a feature flag shows the flag's resolved value, so in local and dev builds, where the flag is on by default, it reads on before anything is set, and a toggle writes the opposite.
dev now defaults transcript verbosity to low, which folds the fixture's screenshot tool into a collapsed group, so its old image previews are no longer on screen with rich media off. The test checks those previews, so it pins medium, as dev's own grouping-sensitive tests do.
dev added opt-in-only feature flags, such as full_codemode, which OPENCODE_FLAGS=all, experimental.all_flags and the local and dev build default all skip. The TUI resolves flags from its own settings with the same rules as core, so it now skips them too; otherwise it would turn such a flag on in a dev build that the server leaves off.
dev now drops the bytes of tool-result files from the transcript store unless session.image_preview is on, to save memory in sessions full of screenshots. Rich media shows those files as tiles unless the setting is false, so with it unset their bytes were gone and the tiles missing. The store now keeps them exactly while the transcript shows them, as one accessor shared with the tiles, and brings back dropped ones when that changes, as when rich media is switched on. An emptied payload is never collected as media.
…solver dev made todo the opt-in-only flag in place of full_codemode, and added local-only flags, such as opencode_api, that stay off outside local and dev builds whatever OPENCODE_FLAGS or config say. The TUI resolves flags from its own settings with core's rules, so it applies the local-only rule too, and its tests use todo and opencode_api.
TextPart now receives its row's part id, text:<n>, which is the number the gallery gives the videos a reply's text names, so the strip matches on it instead of finding the part's position in the message again. The inline media fixture's reply gains a text part before the one naming the videos, so a tile under the wrong part fails the test.












OpenTUI 0.8 can play H.264 video natively through Kitty graphics, Sixel, or quadrant blocks, but the TUI only showed small image thumbnails and refused video everywhere: the composer would not attach it, the transcript could not show it, and core silently dropped video attachments before they reached the model.
Core does three things: it can send video to the model, it guards that path so a video can't break a session, and it hides the new behaviour behind a flag.
Added by the opencode bot (AI-generated).
Related: #54600
Public API: adds experimental.rich_media config/flag key (OpenAPI + client types) and media keybinds; Bedrock now sends video blocks (backwards compatible)