Repository navigation
fix: show SSH tmux mirror directories in Files #22744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dev-fennek
wants to merge
11
commits into
manaflow-ai:main
Choose a base branch
from
dev-fennek:fix/ssh-tmux-files-22053
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+351
−3
Open
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7035fea
test: cover Files roots for remote tmux mirrors
dev-fennek 22beb8c
fix: show SSH tmux mirror directories in Files
dev-fennek faf7a95
Merge main (c42b5fe141db) into fix/ssh-tmux-files-22053
dev-fennek 750085f
Merge main (6ada07ce7fcf) into fix/ssh-tmux-files-22053
dev-fennek d8347da
refactor: publish the tmux mirror link from the workspace
dev-fennek 351708a
Merge main (21dcc2b27b2e) into fix/ssh-tmux-files-22053
dev-fennek cd16354
test: withhold stale tmux mirror Files roots after reconnect and pane…
dev-fennek bdbcbc8
fix: withhold stale tmux mirror directories after reconnect and pane …
dev-fennek fce3b51
test: require the SSH root to survive an unreported pane switch
dev-fennek d5ad262
Merge main (42ed8159e6c1) into fix/ssh-tmux-files-22053
dev-fennek 490e67e
Merge main (54e90553bbb3) into fix/ssh-tmux-files-22053
dev-fennek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import Foundation | ||
| import Observation | ||
|
|
||
| /// The tmux mirror that owns a workspace, as Files and other projections see it. | ||
| struct RemoteTmuxMirrorLink: Equatable { | ||
| let host: RemoteTmuxHost | ||
| var isConnected: Bool | ||
| } | ||
|
|
||
| /// Owns a workspace's tmux mirror link: set when a mirror attaches, updated on each | ||
| /// control-connection transition, and cleared when the mirror detaches. | ||
| @MainActor | ||
| @Observable | ||
| final class WorkspaceRemoteTmuxMirrorState { | ||
| var link: RemoteTmuxMirrorLink? { | ||
| didSet { | ||
| guard oldValue != link else { return } | ||
| linkDidChange() | ||
| } | ||
| } | ||
| private(set) var revision: UInt64 = 0 | ||
| @ObservationIgnored | ||
| private var observers: [UUID: AsyncStream<UInt64>.Continuation] = [:] | ||
|
|
||
| /// Replays the current revision to every subscriber, then coalesces unread changes. | ||
| func changes() -> AsyncStream<UInt64> { | ||
| AsyncStream(bufferingPolicy: .bufferingNewest(1)) { continuation in | ||
| let id = UUID() | ||
| observers[id] = continuation | ||
| continuation.yield(revision) | ||
| // AsyncStream termination is a nonisolated callback boundary. | ||
| continuation.onTermination = { [weak self] _ in | ||
| Task { @MainActor in self?.observers[id] = nil } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private func linkDidChange() { | ||
| revision &+= 1 | ||
| var terminatedIDs: [UUID] = [] | ||
| for (id, continuation) in observers { | ||
| if case .terminated = continuation.yield(revision) { | ||
| terminatedIDs.append(id) | ||
| } | ||
| } | ||
| for id in terminatedIDs { | ||
| observers[id] = nil | ||
| } | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.