Prefetch iOS artifact tab content
AZ
2mo ago+626+626+012345678901234567890123456789-31-31-01234567890123456789
Problem
Opening several Mac-hosted artifact tabs or paging through terminal artifacts makes each file wait for its own transfer.
Change
- Warm inactive workspace file and Markdown tabs with bounded concurrency.
- Warm previous and next terminal gallery artifacts when the selected page changes.
- Add a shared memory and disk content cache with in-flight transfer deduplication.
- Namespace cached bytes by the active Mac connection generation so reconnects cannot replay stale content.
- Keep prefetch best effort, capped at the existing 64 MiB inline preview limit, with metadata, cancellation, and cache-write guards.
Validation
swift build --package-path Packages/iOS/CmuxAgentChatUI- Focused
ChatArtifactLoaderTestsandChatArtifactContentCacheTests: 17 passed. git diff --check
The complete test target is currently blocked by the existing ChatArtifactViewerErrorStateTests.swift call to the private/static ChatArtifactViewerModel.state helper. The full MobileShellUI package build is unavailable in this checkout because the local GhosttyKit.xcframework has no binary artifact.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Warms Mac-hosted artifact tabs ahead of opening so switching tabs or paging through terminal artifacts no longer waits for a fresh transfer.
- Prefetches inactive workspace file and Markdown tabs with bounded concurrency, plus adjacent terminal gallery artifacts as the selected page changes.
- Adds a shared memory and disk content cache that deduplicates in-flight transfers, so a viewer joining an active prefetch reuses the existing source stream.
- Namespaces cached bytes by the active Mac connection generation so a reconnect cannot replay stale content.
- Large Markdown panels that exceed the rendered-size cutoff now render as a native text view instead of a WebKit surface, keyed by UTF-8 byte count.
- Prefetch is best effort, respects the 64 MiB preview limit, and cancels stale work when the selection changes.
- Stops
reload.shfrom excludingInfo.plistand gives the notification extension a distinct bundle identifier inherited from the host app so it survives device and simulator builds.
Summary by CodeRabbit
-
New Features
- Artifact previews now preload nearby gallery items and inactive panel files.
- Added best-effort artifact prefetching with file-size limits.
- Cache entries are isolated across connection generations.
- Large Markdown content now falls back to readable plain-text display.
- Markdown documents now use stable identities to refresh correctly when content changes.
-
Bug Fixes
- Concurrent requests for the same artifact share a single transfer.
- Improved handling when cached artifact persistence is unavailable, with clear errors when required.
-
Tests
- Added coverage for transfers, cache warming, size limits, metadata validation, persistence failures, and Markdown rendering limits.