Skip to content

Play videos inline in chat and add browser and Finder link actions - #297

Merged
R44VC0RP merged 3 commits into
devfrom
vogel/chat-links-video
Nov 20, 2026
Merged

R44VC0RP merged 3 commits into
devfrom
vogel/chat-links-video

Conversation

@R44VC0RP

@R44VC0RP R44VC0RP commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Standalone video links in a finished assistant reply now have an inline player. Each starts paused and has independent play/pause controls. The original link stays available. Direct HTTP(S) videos, local paths, and files in a remote workspace are supported; links inside prose or code do not expand.

Click the picture to play or pause. The timeline sits above the 15-second skip and playback buttons, fades during uninterrupted playback, and stays visible for keyboard focus. Hover to see a time without seeking; drag to preview the frame. A release continues from that frame if the clip was playing, or holds it if paused.

Right-click a web link for Open link in default browser. For local files, the menu offers Open file and Reveal in Finder; for a directory, Open in Finder. Remote workspace paths do not offer local Finder actions. Settings → Browser → Open links in OpenCode remains the single browser preference, with clearer copy.

Verified on Mac Studio

  • Built the default-feature desktop binary, checked the standalone session-view examples, and passed all five repository guardrails.
  • Rendered a reply with local and HTTPS movies. Played both, then paused the local movie at 0.58 s while the HTTPS movie kept playing. Checked absolute paths, workspace file URLs, prose, fenced code, and a missing movie's fallback.
  • Exercised the desktop against an isolated HTTP fixture: the remote workspace clip decoded via byte-range requests, and its file link had no Finder action.
  • Inspected all three right-click menus and dispatched the native actions. Toggled the browser setting through the real Settings UI; ordinary clicks dispatched to the external opener on two successive fresh launches.
  • Recorded the native player scrubbing forward to 26.90 s, reversing to 19.50 s, and continuing from release. Checked both timeline edges, paused scrubbing, keyboard focus during idle playback, and portrait controls.

To try it, have an agent send [Watch the demo](./demo.mp4) on a line by itself.

Give each movie link in a finished reply its own paused Rune player, using the Files pane's local and remote streaming sources. Preserve links in prose and the original caption on decode failure.

Replace session-chip-only secondary handling with target-specific menus for ordinary web links, local files and directories. Keep the browser policy and existing persistent preference, and clarify its off behavior.

Verified on macOS with the desktop build, session-view examples, guardrails, and headless chat input: local, remote workspace and HTTPS playback, independent pause, file/folder actions and external link dispatch across restarts.
Replace the standalone play button with a live timeline, elapsed time and playback controls. Paint the thumb independently of message layout and restore the previous play state when scrubbing finishes.

Built the desktop app, checked session-view examples and passed all five guardrails. Verified play/pause, both skips and scrubbing while paused and playing in a 780-frame real-time Studio capture.
Replace the separately sized, always-visible toolbar with an aspect-fit stage. A picture click toggles playback; the full-width timeline and grouped 15-second skips share the Files viewer's idle policy and stay visible for keyboard input.

Show the pointed time without seeking. During a drag, paint the thumb from the pointer and sample the existing decoded frame at most once per refresh. Land the final seek before restoring playback and keep message-row layout motion off the timeline.

Verified the desktop build, standalone session-view examples and all five guardrails on Mac Studio. Recorded a native drag to 26.90 s, reversal to 19.50 s and playback from release. Checked paused and end-of-clip scrubs, keyboard focus, portrait layout and frame-by-frame thumb alignment.
@R44VC0RP
R44VC0RP merged commit 918d24f into dev Nov 20, 2026
6 checks passed
@R44VC0RP
R44VC0RP deleted the vogel/chat-links-video branch November 20, 2026 15:26
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR test build retired — merged into dev. Install or auto-update OpenCode (Rune) from https://anoma.ly/release/opencode/desktop-rune/dev/macos-arm64-dmg.

Hona added a commit that referenced this pull request Nov 20, 2026
… local-path confinement

Merges origin/dev (5fed7fc, including #297 918d24f) into browser-ui/sec-a1-file-links:
- apps/desktop/src/surfaces/files/reply.rs: reject raw UNC hrefs in target(), replace
  std::fs::metadata(&path) with browser_policy::verify_local_path(&path) before building the
  right-click menu, remove OS open_default ("Open file") for outside-workspace files (outside
  files offer safe Reveal only; inside-workspace files open in the built-in viewer), and guard
  local video paths with verify_local_path / verify_within_root.
- features/files/src/{ops,video}.rs: route local video playback through
  browser_policy::verify_within_root before handing a local path to rune::Player.
- apps/desktop/src/shell/view/session/host.rs & crates/session-view/Cargo.toml: preserve both
  sides' TimelineHost methods and dependencies.
Hona added a commit that referenced this pull request Nov 20, 2026
…304)

- Fold verified merged PRs #280 (WS-9 crates/browser-extensions, confirmed),
  #281 (PREVIEWS oc-preview:// + ContextPool::is_tab_ready, confirmed third
  read + merge check), #297 (inline chat video + reply link menu, not
  reviewed before merge), #299 (WS-1 close_all_connections crash fix), and
  #300 (Rune eff95e80: #1304 roving-group rescue + #1291 monochrome SMIL
  animated icons completing UP-069 / WS-6)
- Update browser Reviewed column and note #287 eager-attach time_updated
  regression on UP-095-TOOLS
- Audit upstream anomalyco/opencode 2002222d13..fe8def6854 (+19 commits:
  7 skipped, 12 added: UP-123..UP-134)
Hona added a commit that referenced this pull request Nov 20, 2026
…ideo::Auto)

Per READER-12's in-workspace video ruling on dev (Rune eff95e80 with live Windows Media Foundation
and macOS AVFoundation backends):
- Remove `ReplyVideo::Auto` completely; NO video in an assistant reply ever opens or decodes
  without an explicit user click (neither inside-workspace nor outside-workspace).
- On display, `reply::video` performs zero disk or network I/O and returns only the real
  sanitized path shown on the Play control (middle-truncated on the button, full path in tooltip
  and accessibility label; consistent native separators on Windows).
- On click, `reply::load_video` verifies inside-workspace files via `verify_within_root` (or
  remote `/api/fs/read/...`) and outside-workspace local files (local sessions only) via
  `verify_local_path`, then mounts `#297`'s unchanged player and controls.
- `http(s)` web video links stay ordinary links that open in the embedded browser pane.
Hona added a commit that referenced this pull request Nov 20, 2026
* feat(files): click-to-load control and remote-server address policy for inline reply videos

- `crates/browser-policy/src/remote_url.rs` & `lib.rs`: add `is_public_http_url` (refusing
  credentials, percent/non-ASCII host obfuscation, single-label hosts, local/internal/metadata
  DNS suffixes, alternate IPv4 notations, and all non-globally-routable IPv4/IPv6 ranges
  including loopback, RFC 1918, CGNAT, link-local/IMDS `169.254.0.0/16`, and ULA `fc00::/7` /
  `fd00:ec2::254`) and `sanitized_http_host`.
- `crates/session-view/src/video.rs`, `video/transport.rs`, `lib.rs`: add `ReplyVideo::{Auto,
  OnClick}` and explicit `Slot::{Starting, Active}` state machine in `Clips`; verified
  in-workspace clips keep auto-loading while outside-workspace local clips and `http(s)` URLs
  render a click-to-load Play control under the link and construct `Player` (with `#297`'s
  unchanged player stage and controls) only after user click and host verification.
- `apps/desktop/src/surfaces/files/reply.rs` & `shell/view/session/host.rs`: perform zero
  outside-disk or network I/O on display; verify outside local paths via `verify_local_path`
  and remote-server `http(s)` URLs via `is_public_http_url` on click (reporting refusals via
  toast).
- `crates/opencode-i18n/locales/rune/en.json`: add `rune.video.localFile`,
  `rune.video.playInline`, and `rune.video.remoteBlocked`.

* fix(files): drop OS-stack web video click-to-load, disclose real local path on Play control, and keep reference-link controls inline

Per READER-12's review of #307:
- Remove `crates/browser-policy/src/remote_url.rs` (and its exports), `web_video_url` / `Link::Web`
  inline video handling in `apps/desktop/src/surfaces/files/reply.rs`, and `rune.video.remoteBlocked`
  / `rune.video.localFile` strings. `http(s)` video links stay ordinary links and open in the
  embedded browser pane (enforcing `browser_policy`, remote `TunnelProxy`, isolated storage, and
  sandboxed decoders).
- Disclose the real sanitized local path on `ReplyVideo::OnClick { path }` before click: middle-
  truncated on the Play button (preserving both root and filename), full path in `.help(...)`
  tooltip and accessibility `.label(...)` (never using model-controlled link text).
- Gate `Link::Outside` click-to-load strictly on `app.can_open_in() && !is_remote_session(app)` so
  remote-server sessions never offer a local player for server paths.
- Keep reference-style Markdown links' Play controls inline beside their links by appending
  document reference definitions invisibly to each Markdown slice instead of detaching controls to
  the bottom of the message; also drop mismatched `Slot::Starting` entries cleanly.

* fix(files): require click-to-load for all reply videos (remove ReplyVideo::Auto)

Per READER-12's in-workspace video ruling on dev (Rune eff95e80 with live Windows Media Foundation
and macOS AVFoundation backends):
- Remove `ReplyVideo::Auto` completely; NO video in an assistant reply ever opens or decodes
  without an explicit user click (neither inside-workspace nor outside-workspace).
- On display, `reply::video` performs zero disk or network I/O and returns only the real
  sanitized path shown on the Play control (middle-truncated on the button, full path in tooltip
  and accessibility label; consistent native separators on Windows).
- On click, `reply::load_video` verifies inside-workspace files via `verify_within_root` (or
  remote `/api/fs/read/...`) and outside-workspace local files (local sessions only) via
  `verify_local_path`, then mounts `#297`'s unchanged player and controls.
- `http(s)` web video links stay ordinary links that open in the embedded browser pane.
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