Skip to content

feat(mobile): open PDF and media files through the OS share sheet - #21839

Closed
dudupii wants to merge 2 commits into
stablyai:mainfrom
dudupii:feat/mobile-media-handoff
Closed

dudupii wants to merge 2 commits into
stablyai:mainfrom
dudupii:feat/mobile-media-handoff

Conversation

@dudupii

@dudupii dudupii commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

ELI5

On the phone app, tapping a PDF or video in a repository's file list used to just say "Binary preview unavailable". Now a button downloads the file from the paired computer and offers it to whatever app on the phone opens that kind of file.

What Changed

Before: the mobile file preview renders text, markdown, HTML and images itself. The host deliberately refuses to send other binaries to mobile clients (binary_file), so a .pdf or .mp4 — files the phone has no in-app renderer for anyway — dead-ended in an error.

After: the preview screen recognizes the documents and media Android/iOS themselves can open (pdf; mp4/m4v/mov; mp3/m4a/wav), skips the preview pipeline, and renders an Open button instead. Pressing it downloads the file from the paired host in 512KB files.readChunk slices (the host's per-request cap; each slice is appended to the cache file as base64), shows download progress, and then hands the cached file to the system share sheet with the right MIME type — the mobile counterpart of the desktop's "open in external browser/viewer". Any app registered for that type opens it.

Mechanism, all mobile-side (no host change; files.readChunk is already mobile-allowlisted and already serves SSH-hosted worktrees):

  • mobile-file-media-handoff.ts — MIME map, chunk loop over a sink seam, 128MB cap, refusal surfacing.
  • mobile-file-media-handoff-device.ts — the expo-file-system sink (the only module importing it, mirroring the native-media device split).
  • MobileFileMediaHandoff.tsx — Open button / progress / error-retry UI, reusing the preview screen's tokens.
  • Preview screen wiring: a media-handoff path skips loadPreview and renders the handoff body.

Terminal artifacts (absolute-path grants) keep the existing refusal — only worktree-relative paths hand off.

Why

No PDF/video renderer is bundled in the mobile app, and adding one is a large dependency for a file-viewing side feature. Every phone already ships viewers for these types; the share-sheet handoff reaches them with a few hundred lines over an RPC the host already exposes. Chunked files.readChunk keeps each reply far under the mobile JSON budget and works identically over SSH hosts, where the whole file is not locally readable. The alternative — a host-side "read any binary for mobile" flag — would widen the mobile attack surface for every file type just to serve a handful.

Linked Issue

Fixes #

Visual Proof

N/A — Android device UI (share sheet interaction); captured during personal-build E2E. The rendered states (Open button, progress, error+retry) are covered by component tests below.

Testing

  • New mobile-file-media-handoff.test.ts: MIME mapping, multi-chunk assembly with offset/length params, empty file, refusal copy + partial-download discard, code fallback, over-cap refusal.

  • New MobileFileMediaHandoff.test.tsx: open→download→share with MIME and dialog title; failed read keeps the Open button and shows the host's message; disconnected waits instead of offering an Open it cannot serve; cache naming/sanitization; stale-copy overwrite and append-mode writes.

  • Existing preview suites re-run green; tsc, tests-typecheck ratchet, and oxlint pass on this branch.

  • I manually tested these changes locally (device E2E pending a personal APK build; will report)

  • Automated tests added/updated, or explained why not below

AI Disclosure

Claude Code (Anthropic) implemented this change under the author's direction; the author reviewed and tested it.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: mobile-only; no desktop/host code paths touched. SSH-hosted files work over the same chunk RPC.
  • Backward compatibility: no wire change — uses the existing files.readChunk method and reply shape; older hosts already serving it behave identically.
  • Performance: 512KB requests serialize under the existing mobile reply budget; the 128MB cap bounds cache use and share-sheet handoff latency.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Understand this PR’s impact

Explore downstream dependencies and potential security impact with Blast Radius.

View blast radius →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⛔ Files ignored due to path filters (1)
  • mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 70d0785f-ec08-4eb4-9ba2-69df4a90ce7e

📥 Commits

Reviewing files that changed from the base of the PR and between 0105a91 and 029e241.

⛔ Files ignored due to path filters (1)
  • mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6f4e744d-b357-4cfd-a9ab-c8a93af5d435

📥 Commits

Reviewing files that changed from the base of the PR and between 40a25fc and 0105a91.

📒 Files selected for processing (3)
  • mobile/src/files/mobile-file-explorer-row.tsx
  • mobile/src/files/mobile-file-preview-navigation.test.ts
  • mobile/src/files/mobile-file-preview-navigation.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Adds mobile media handoff support for PDF, video, and audio files. The feature reads files in 512 KB RPC chunks, validates responses, enforces a 128 MB limit, caches data through Expo filesystem, and shares the cached URI with the operating system. The preview screen routes supported worktree media to the new handoff component. Tests cover download, cache, sharing, refusal, size-limit, and disconnected states.

Priority: ➖ Normal

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the user-facing change, implementation, rationale, testing, and compatibility considerations. However, the mandatory Linked Issue field is empty, the Visual Proof section mark… Add the linked issue number after “Fixes #”. Provide valid before-and-after screenshots or a video for the mobile UI interaction, or explain why the required visual proof cannot be provided. Complete and report the manual device test before…
Docstring Coverage ⚠️ Warning Docstring coverage is 15.79% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: enabling mobile users to open PDF and media files through the operating system share sheet.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the user-facing change, implementation, rationale, testing, and compatibility considerations. However, the mandatory Linked Issue field is empty, the Visual Proof section marks an interaction change as N/A, and manual device testing remains pending.

Resolution

Add the linked issue number after “Fixes #”. Provide valid before-and-after screenshots or a video for the mobile UI interaction, or explain why the required visual proof cannot be provided. Complete and report the manual device test before merging.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 811df770-fda5-45ac-b09d-b08236c483ab

📥 Commits

Reviewing files that changed from the base of the PR and between 3cadcab and 40a25fc.

⛔ Files ignored due to path filters (1)
  • mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • mobile/package.json
  • mobile/src/files/MobileFileMediaHandoff.test.tsx
  • mobile/src/files/MobileFileMediaHandoff.tsx
  • mobile/src/files/MobileFilePreviewScreen.tsx
  • mobile/src/files/file-preview-reply-schema.ts
  • mobile/src/files/mobile-file-media-handoff-device.ts
  • mobile/src/files/mobile-file-media-handoff.test.ts
  • mobile/src/files/mobile-file-media-handoff.ts
  • mobile/src/files/mobile-file-preview-operations.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment on lines +75 to +76
if (chunk.bytesRead === 0) {
break

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n "files\.readChunk|FileReadChunk|bytesRead|contentBase64" mobile cloud packages . --glob '!**/node_modules/**'
sed -n '51,94p' mobile/src/files/mobile-file-media-handoff.ts

Repository: stablyai/orca

Length of output: 45543


🏁 Script executed:

set -eu
printf '%s\n' '--- files RPC method ---'
cat -n src/main/runtime/rpc/methods/files.ts | sed -n '1,145p'
printf '%s\n' '--- host implementation ---'
cat -n src/main/runtime/runtime-file-commands-read-file-explorer-preview.ts | sed -n '130,195p'
printf '%s\n' '--- shared types ---'
rg -n -A12 -B8 "RuntimeFileReadChunkResult|FileReadChunk" src mobile packages shared . --glob '!**/node_modules/**' --glob '!**/*.map' | head -240
printf '%s\n' '--- provider contract and range reader ---'
cat -n src/main/providers/filesystem-provider-contract.ts | sed -n '20,65p'
cat -n src/main/runtime/ssh-file-explorer-chunk-read.ts | sed -n '1,65p'
printf '%s\n' '--- relevant tests ---'
cat -n src/main/runtime/rpc/methods/files.test.ts | sed -n '390,455p'
rg -n -A12 -B12 "downloadMobileFileMedia|bytesRead: 0|eof: false" mobile/src --glob '*test*' --glob '*.ts' --glob '*.tsx' | head -240

Repository: stablyai/orca

Length of output: 45541


🏁 Script executed:

set -eu
printf '%s\n' '--- exact local host branch ---'
cat -n src/main/runtime/runtime-file-commands-read-file-explorer-preview.ts | sed -n '147,190p'
printf '%s\n' '--- exact RPC binding ---'
cat -n src/main/runtime/rpc/methods/files.ts | sed -n '100,125p'
printf '%s\n' '--- provider contract continuation ---'
cat -n src/main/providers/filesystem-provider-contract.ts | sed -n '53,82p'
printf '%s\n' '--- range reader implementations ---'
rg -n -A55 -B8 "async readFileRange|readFileRange\\s*[:=]|readFileRange\\(" src/main --glob '*.ts' --glob '!**/*.test.ts' | head -320
printf '%s\n' '--- mobile response interpretation and test helper ---'
cat -n mobile/src/files/mobile-file-media-handoff.ts | sed -n '1,95p'
rg -n -A35 -B15 "fileMediaChunkRead|interpret\\(" mobile/src/files mobile/src/transport --glob '*.ts' --glob '*.tsx' | head -260

Repository: stablyai/orca

Length of output: 40109


Reject a zero-byte chunk unless eof is true.

files.readChunk can return { bytesRead: 0, eof: false } when the file shrinks after the host records its size. The current branch treats that response as successful completion, so the app can share a truncated file.

Require eof or throw an error so the catch block discards the partial file.

Proposed fix
       if (chunk.bytesRead === 0) {
-        break
+        if (chunk.eof) {
+          break
+        }
+        throw new Error('Host returned an incomplete file chunk')
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (chunk.bytesRead === 0) {
break
if (chunk.bytesRead === 0) {
if (chunk.eof) {
break
}
throw new Error('Host returned an incomplete file chunk')

try {
const sink = mediaHandoffSinkFor(relativePath)
await downloadMobileFileMedia(client, { worktreeId, relativePath }, sink, setProgressBytes)
await Sharing.shareAsync(sink.uri, { mimeType, dialogTitle: `Open ${title}` })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,110p' mobile/src/files/MobileFileMediaHandoff.tsx
sed -n '130,320p' mobile/src/files/MobileFilePreviewScreen.tsx
sed -n '1,80p' mobile/src/files/mobile-file-media-handoff-device.ts
rg -n "MobileFilePreviewScreen|MobileFileMediaHandoff" mobile/src --glob '!**/*.test.*'

Repository: stablyai/orca

Length of output: 10770


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- media handoff definitions and callers ---'
rg -n -A80 -B20 "downloadMobileFileMedia|type MobileFileMediaSink|interface MobileFileMediaSink|mediaHandoffSinkFor" mobile/src
printf '%s\n' '--- preview screen beginning and route identity logic ---'
sed -n '1,180p' mobile/src/files/MobileFilePreviewScreen.tsx
printf '%s\n' '--- preview route registration and navigation calls ---'
rg -n -A12 -B12 "MobileFilePreviewScreen|FilePreview|preview" mobile/src --glob '!**/*.test.*' | head -n 260
printf '%s\n' '--- relevant tests ---'
rg -n -A30 -B20 "MobileFileMediaHandoff|mediaHandoff|MobileFilePreviewScreen|shareAsync" mobile --glob '*test*' --glob '*spec*' || true

Repository: stablyai/orca

Length of output: 45540


🏁 Script executed:

set -eu
printf '%s\n' '--- media handoff definitions and callers ---'
rg -n -A80 -B20 "downloadMobileFileMedia|type MobileFileMediaSink|interface MobileFileMediaSink|mediaHandoffSinkFor" mobile/src
printf '%s\n' '--- preview screen beginning and route identity logic ---'
sed -n '1,180p' mobile/src/files/MobileFilePreviewScreen.tsx
printf '%s\n' '--- preview route registration and navigation calls ---'
rg -n -A12 -B12 "MobileFilePreviewScreen|FilePreview|preview" mobile/src --glob '!**/*.test.*' | head -n 260
printf '%s\n' '--- relevant tests ---'
rg -n -A30 -B20 "MobileFileMediaHandoff|mediaHandoff|MobileFilePreviewScreen|shareAsync" mobile --glob '*test*' --glob '*spec*' || true

Repository: stablyai/orca

Length of output: 45542


🏁 Script executed:

set -eu
rg -n -A100 -B20 "downloadMobileFileMedia|MobileFileMediaSink|mediaHandoffSinkFor" mobile/src
sed -n '1,180p' mobile/src/files/MobileFilePreviewScreen.tsx
rg -n -A15 -B15 "MobileFilePreviewScreen|FilePreview" mobile --glob '!**/*.test.*' | head -n 300
rg -n -A40 -B20 "MobileFileMediaHandoff|mediaHandoff|shareAsync" mobile --glob '*test*' --glob '*spec*' || true

Repository: stablyai/orca

Length of output: 45535


🏁 Script executed:

set -eu
printf '%s\n' '--- downloader ---'
sed -n '1,180p' mobile/src/files/mobile-file-media-handoff.ts
printf '%s\n' '--- sink ---'
sed -n '1,120p' mobile/src/files/mobile-file-media-handoff-device.ts
printf '%s\n' '--- route key and shell rendering ---'
sed -n '43,95p' 'mobile/app/h/[hostId]/files/preview/[worktreeId].tsx'
rg -n -A35 -B15 "function shellScreenRouteKey|export.*shellScreenRouteKey|shellScreenRouteKey" mobile/src/mobile-web-shell
printf '%s\n' '--- handoff tests after normal flow ---'
sed -n '130,360p' mobile/src/files/MobileFileMediaHandoff.test.tsx

Repository: stablyai/orca

Length of output: 15724


Invalidate stale handoff operations before sharing.

If Back unmounts the preview or the route changes while downloadMobileFileMedia awaits its RPC reads, the old open closure still reaches Sharing.shareAsync with the old sink and metadata. The route key remounts the screen, but it does not cancel the old promise.

Track an operation token, invalidate it on unmount and identity changes, and check it after the download before sharing. Do not discard a stale sink until each operation has a unique cache URI. The current sink derives its URI from only the basename, so open() and discard() can delete another concurrent operation's file.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Two things to look at before merge: the handoff is reachable on the mobile web page but cannot work there, and the download loop reads a zero-byte pre-EOF reply as a successful EOF.

Reviewed changes

  • Media handoff for the mobile preview — worktree PDFs and phone-openable media skip loadPreview and render an Open button that downloads the file and hands the cached copy to expo-sharing, mirroring the desktop's "open externally".
  • Chunked download + sink seam — downloadMobileFileMedia pages 512 KiB files.readChunk slices through a MobileFileMediaSink, caps at 128 MiB, and surfaces host refusals; the expo-file-system device half is split out so the loop stays testable.
  • New RPC op + reply schema — fileMediaChunkRead (files.readChunk, success-result-or-skip) with a required contentBase64/bytesRead/eof schema.
  • Tests — unit coverage of MIME mapping, chunk assembly, refusal, cap, and code fallback; component coverage of open→download→share, failed read, disconnected, and cache naming.

ℹ️ Nitpicks

  • mediaHandoffCacheName keys the cache file on the basename alone, so a/report.pdf and b/report.pdf share orca-media-handoff-report.pdf. Sequential opens overwrite each other's bytes; a short hash of the full relative path would make the name unique per file.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +75 to +77
if (chunk.bytesRead === 0) {
break
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop breaks on bytesRead === 0 before it ever consults eof, so a zero-byte reply that is not EOF is treated as a completed transfer. The host can emit { bytesRead: 0, eof: false } when a file shrinks between its stat and the read — src/main/runtime/ssh-file-explorer-chunk-read.ts:40-45 documents exactly that path — and the desktop download loop guards the same reply as a stall (src/renderer/src/runtime/runtime-file-read-client.ts:150-155). Here it silently hands a truncated prefix to the share sheet as if it were the whole file.

Technical details
# A zero-byte pre-EOF reply must not be read as EOF

## Affected sites
- `mobile/src/files/mobile-file-media-handoff.ts:75-77` — `if (chunk.bytesRead === 0) break` runs before the `eof` check at `:85`.
- `mobile/src/files/mobile-file-media-handoff.test.ts:95-104` — "keeps an empty file byte-exact" uses `{ contentBase64: '', bytesRead: 0, eof: false }`, which is the stall fixture the browser suite uses to assert a throw; the real host's empty-file reply is `{ '', 0, eof: true }` (`src/main/runtime/runtime-file-commands-read-file-explorer-preview.ts:173-177`).

## Required outcome
- Break only on `eof`; treat `bytesRead <= 0 && !eof` as a stalled download, `discard()` the partial file, and surface it as an error.
- Change the empty-file fixture to `eof: true` so the test distinguishes "empty file" from "stall".

## Suggested approach
- Append, advance `offset`, then `if (chunk.eof) break`, then throw on a zero-byte non-EOF read — the desktop loop's order.

## Open questions for the human
- A real 0-byte PDF/media still writes no cache file (the sink only creates it in `appendBase64`), so `Sharing.shareAsync` is handed a URI that does not exist. Worth an explicit branch?

try {
const sink = mediaHandoffSinkFor(relativePath)
await downloadMobileFileMedia(client, { worktreeId, relativePath }, sink, setProgressBytes)
await Sharing.shareAsync(sink.uri, { mimeType, dialogTitle: `Open ${title}` })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file-preview route is also served on the mobile web page: mobile/app/h/[hostId]/files/preview/[worktreeId].web.tsx renders this same MobileFilePreviewScreen, and mediaHandoffMimeFor is platform-independent, so a worktree PDF/media renders this Open button on the page too. On web, mediaHandoffSinkFor throws (Paths.cache on expo-file-system's web stub has no validatePath) and Sharing.shareAsync needs navigator.share, so the tap surfaces a raw internal error string. There is no .web seam for the handoff, and no existing census catches native imports in this closure.

Technical details
# The handoff has no web seam

## Affected sites
- `mobile/src/files/MobileFileMediaHandoff.tsx:4,44` — imports `expo-sharing` and calls `shareAsync`; no `.web` sibling for the component or the device sink.
- `mobile/src/files/mobile-file-media-handoff-device.ts:15` — `new File(Paths.cache, ...)`; on web `Paths.cache` evaluates `new Directory('')`, whose constructor calls the native-only `validatePath()` (`[email protected]/src/ExpoFileSystem.web.ts` is a stub class).
- `mobile/src/files/MobileFilePreviewScreen.tsx:159-160` — the media branch is chosen with no platform check.

## Required outcome
- The page must not offer a control it cannot serve, or must serve it through the shell.

## Suggested approach
- Gate the branch the way `mobile/src/files/use-mobile-file-preview-back.ts:79` gates web (`Platform.OS !== 'web'`), or add a `.web` device sink plus a web share path so the page keeps its existing host-refusal copy.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found in the follow-up commit.

Reviewed changes

  • Made PDF/media rows tappable in the file explorer — canPreviewMobileFileRow now also admits mediaHandoffMimeFor(...) !== null, so the row gate matches the preview screen's handoff branch (explorer navigation is worktree-sourced, so the tap lands on the handoff).
  • Decoupled the row's image icon from previewability — isImage is now kind === 'binary' && classifyMobileArtifact(path) === 'image', so a PDF/media row no longer shows the image icon it inherited from the old previewable-based derivation.
  • Extended the row-predicate test — text, raster image, .mp4, .mp3, and a non-ASCII .pdf are asserted openable; .zip stays disabled.

The two [!IMPORTANT] items from the previous review — zero-byte pre-EOF handling in the download loop and the mobile web page offering a handoff it cannot serve — are untouched by this commit and remain open.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

dudupii and others added 2 commits September 21, 2026 12:46
Markdown, HTML and images preview in the app, but the phone has no PDF or
video renderer and the host refuses those binaries, so tapping a .pdf or
.mp4 in the file explorer showed "Binary preview unavailable". The desktop
answers the same file with a choice of built-in or external viewer.

This adds the mobile counterpart of "open externally": the preview screen
detects the OS-openable documents and media (pdf, mp4/m4v/mov,
mp3/m4a/wav), downloads the file from the paired host in host-capped 512KB
files.readChunk slices into the app cache — each slice appended as base64,
so SSH-hosted files work over the same path — and hands the cached file to
the system share sheet with its MIME type, which offers the device's
viewer. A 128MB cap keeps the handoff responsive, a failed or oversized
download discards the partial file and shows the host's refusal, and
terminal artifacts (absolute-path grants) keep the existing refusal.

files.readChunk is already mobile-allowlisted; no host change.

Co-Authored-By: Claude Code <[email protected]>
The OS handoff shipped the preview screen but the file explorer's row
gate still classified PDF/media binaries as unavailable, so the rows
stayed disabled and the handoff screen was unreachable. The gate now
admits the handoff extensions, and the row's image-icon derivation no
longer leans on previewability (a PDF row would have shown the image
icon).

Co-Authored-By: Claude Code <[email protected]>
@nwparker

nwparker commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Closing this competing media proposal after merging desktop playback #26120 and mobile playback #26148. PDF opening and external-app/system-share-sheet handoff are distinct from the merged in-app player and remain tracked in #25871 with PR #25882; they are not claimed as implemented here. ChangJun Park, Lirone Levy, dupi, and John Cusack are credited with Co-authored-by trailers in both merge commits.

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.

2 participants