Repository navigation
fix(preview): keep previews alive across switches and cache browser links - #118
Merged
Merged
Conversation
…inks - Add bounded in-memory SessionPreviewCache (max 4 device previews, max 4 browser previews) keeping SessionSimulator, live SimulatorStreamView, and BrowserPreviewController alive across conversation switches until explicit Stop, LRU eviction, workspace switch, logout, or memory warning. - Update SimulatorPreview and SimulatorStreamView so cached streams survive view detachment while still disconnecting when backgrounded. - Extend cloud-runtime sessionPreview contract with status action, restart flag, expiresAt, and active status, and regenerate RuntimeContract.generated.swift. - Cache browser preview links in memory for instant open and instant copy, verify link liveness in the background while keeping WKWebView visible, show unconfirmed warning on transient check failure, and expose an on-demand regenerate button that restores the last browsed path, query, and fragment. Model: gemini-4-neon-medium
…te server/simulator - Extend cloud-runtime preview contract, runtime revokePreview, and sharing handlers with capability-gated stopProcess (previewStopProcess) and shutdownDevice (iosSimulatorShutdown / androidEmulatorShutdown), omitting optional flags on normal disconnect for backward compatibility. - Expose numeric per-machine protocolCapabilities in Catalog and SessionCatalog. - Add disconnect menu options in BrowserPreviewController, SimulatorController, and session action bar chips offering safe preview-only disconnect and destructive process/device termination when supported by the host CLI. - Update Localizable.xcstrings (EN & zh-Hans) and add revoke stopProcess unit test. Model: gemini-4-neon-medium
Leeeon233
added a commit
to LodyAI/Lody
that referenced
this pull request
Nov 20, 2026
…rminate server/simulator - Add optional capability-gated `stopProcess` (Web preview) and `shutdownDevice` (iOS Simulator / Android Emulator) parameters to preview stop RPCs and advertise `previewStopProcess`, `iosSimulatorShutdown`, and `androidEmulatorShutdown` machine protocol capabilities. - Implement guarded CLI termination for loopback dev-server processes (current UID only, excluding Lody ancestor PIDs) and exact-target simulator/emulator shutdown (never killing adb server or physical devices, and denying agent-initiated shutdown). - Replace single disconnect buttons in Web/Desktop browser and device preview toolbars with `PreviewDisconnectButton` (safe default primary click + downward arrow menu offering preview-only vs. close-and-terminate/shutdown). - Update `apps/mobile/ios` (LodyAI/lody-ios#118) and `apps/mobile/android` (LodyAI/lody-android#15) submodule pointers with matching disconnect menus and split buttons. Model: gemini-4-neon-medium
Leeeon233
added a commit
to LodyAI/Lody
that referenced
this pull request
Nov 20, 2026
- Merge origin/main into fix/keep-preview-alive-on-switch. - Update apps/mobile/ios to 5b42e153 (LodyAI/lody-ios#118 on main). - Update apps/mobile/android to a15bb94 (LodyAI/lody-android#15 on main). Model: gemini-4-neon-medium
Leeeon233
added a commit
to LodyAI/Lody
that referenced
this pull request
Nov 20, 2026
…che browser links (#2973) * fix(preview): keep previews alive across conversation switches and cache browser links - Keep live Web/Desktop Managed Preview iframes and device preview viewers (iOS Simulator & Android Emulator) parked in bounded in-memory LRU caches across conversation switches, only tearing down on explicit Stop, eviction, logout, or non-ready transition. - Keep opened SessionDetail sidebar tabs mounted while hidden so switching between sidebar tabs does not unmount preview panels. - Cache remote browser preview connection and expiresAt in memory so reopening or copying a valid link is instant without blocking on resolving-machine or RPC. - Verify cached browser links in the background while keeping the preview page visible, show an unconfirmed warning on timeout/transient failure, and expose an on-demand regenerate button in the address bar that recreates the link and restores the last browsed page. - Update apps/mobile/ios (LodyAI/lody-ios#118) and apps/mobile/android (LodyAI/lody-android#15) submodule pointers with matching native mobile preview retention and link caching UX. Model: gemini-4-neon-medium * feat(preview): add split disconnect button to stop preview only or terminate server/simulator - Add optional capability-gated `stopProcess` (Web preview) and `shutdownDevice` (iOS Simulator / Android Emulator) parameters to preview stop RPCs and advertise `previewStopProcess`, `iosSimulatorShutdown`, and `androidEmulatorShutdown` machine protocol capabilities. - Implement guarded CLI termination for loopback dev-server processes (current UID only, excluding Lody ancestor PIDs) and exact-target simulator/emulator shutdown (never killing adb server or physical devices, and denying agent-initiated shutdown). - Replace single disconnect buttons in Web/Desktop browser and device preview toolbars with `PreviewDisconnectButton` (safe default primary click + downward arrow menu offering preview-only vs. close-and-terminate/shutdown). - Update `apps/mobile/ios` (LodyAI/lody-ios#118) and `apps/mobile/android` (LodyAI/lody-android#15) submodule pointers with matching disconnect menus and split buttons. Model: gemini-4-neon-medium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Keep remote previews (managed browser, iOS Simulator, and Android Emulator) alive in memory across conversation switches instead of tearing down or reconnecting on every switch, and optimize the browser preview UX with cached links, background verification, and on-demand regeneration.
Key Changes
SessionPreviewCache):SessionPreviewCache(max 4 device previews, max 4 browser previews) retainingSessionSimulator, liveSimulatorStreamView(isRetainedByCache = true), andBrowserPreviewController(WKWebView) across conversation switches.SimulatorPreviewandSimulatorStreamViewso detaching a cached stream from a view does not disconnect it, while still disconnecting when backgrounded and tearing down cleanly on explicit Stop, LRU eviction, workspace switch, logout (LodyApplication), or memory warning.UserDefaultsor disk).sessionPreview):statusaction, optionalrestartflag, andexpiresAt/activeresponse fields topackages/cloud-runtime, regeneratedRuntimeContract.generated.swift, and updated runtime unit tests.BrowserPreviewController,SessionController+Tools):statuscheck with a right-side navigation spinner + non-blocking"Checking preview link…"banner while keeping the page visible.active === false), shows an on-demand"Regenerate preview link"icon button that generates a new link (restart: true) and navigates back to the last browsed path, query, and fragment."Unable to confirm connection right now"while keeping the current page visible.Testing
pnpm check(typecheck,contract:check,i18n:check,native:sources,licenses:check,format:check) — passedpnpm test— 300/300 JS tests + 62/62 Python tests passedxcrun --sdk iphonesimulator swiftc -parseon all modified/added Swift files — passedswift build --package-path packages/lody-core— passed