Repository navigation
Inline notification replies (macOS + iOS) with schema-driven reply shapes and a notification debug mode #8670
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
05bde82
Add inline notification replies and debug mode
2c4cd9f
Add iOS inline replies for terminal pushes
6e9b204
Merge remote-tracking branch 'origin/main' into feat-notif-inline-reply
b766aca
Address review: serialize question-category writes, live-retarget rep…
azooz2003-bit ac3d411
Debug: add debug.notification.status verb reporting system notificati…
azooz2003-bit 5f9c7f8
Merge remote-tracking branch 'origin/main' into feat-notif-inline-reply
azooz2003-bit 82f5617
Fix post-merge compile: replyShape in new PhonePushPayload call sites
azooz2003-bit 9dbf39a
Debug: local reply-notification emitter on iOS Settings
azooz2003-bit 7d8952e
Debug Macs default the push lane to shared staging
azooz2003-bit 9882624
Push lane ignores the rig-baked VM origin
azooz2003-bit 48d75e5
Log per-attempt push delivery status
azooz2003-bit ea1680e
Fix nonisolated access to logValue in delivery attempt log
azooz2003-bit 98a29d6
Merge origin/main; graft category chain onto bounded UN boundary; rev…
azooz2003-bit 240c13a
Default replyShapeWire in control notification witnesses
azooz2003-bit 7a4b06f
Address cursor Mediums: preserve minted categories on install, retry …
azooz2003-bit ea468f9
Merge remote-tracking branch 'origin/main' into feat-notif-inline-reply
azooz2003-bit 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
Some comments aren't visible on the classic Files Changed page.
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
66 changes: 66 additions & 0 deletions
66
.../CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite+ExplicitTerminalInput.swift
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,66 @@ | ||
| internal import CmuxMobileRPC | ||
| public import CmuxMobileShellModel | ||
| internal import Foundation | ||
| internal import OSLog | ||
|
|
||
| private let explicitTerminalInputLog = Logger( | ||
| subsystem: Bundle.main.bundleIdentifier ?? "dev.cmux.ios", | ||
| category: "mobile-shell" | ||
| ) | ||
|
|
||
| extension MobileShellComposite { | ||
| /// Whether the Mac that owns `workspaceID` currently has an RPC channel able to accept terminal input. | ||
| /// | ||
| /// This check does not change the selected Mac, workspace, terminal, or navigation state. | ||
| /// | ||
| /// - Parameter workspaceID: The current UI row identifier for the target workspace. | ||
| /// - Returns: `true` when the workspace exists and its owning Mac has a live RPC client. | ||
| public func canSendTerminalInput(to workspaceID: MobileWorkspacePreview.ID) -> Bool { | ||
| guard workspaces.contains(where: { $0.id == workspaceID }) else { return false } | ||
| return workspaceMutationTarget(for: workspaceID).client != nil | ||
| } | ||
|
|
||
| /// Sends text to an explicit workspace and terminal without changing UI selection or navigation. | ||
| /// | ||
| /// The workspace row selects the owning Mac's live RPC client, including a connected secondary Mac | ||
| /// in the aggregated workspace list, while the Mac-local workspace identifier is sent on the wire. | ||
| /// | ||
| /// - Parameters: | ||
| /// - text: The exact terminal input bytes represented as text. | ||
| /// - workspaceID: The current UI row identifier for the target workspace. | ||
| /// - terminalID: The terminal that must still belong to `workspaceID`. | ||
| /// - Returns: `true` after the owning Mac acknowledges the input; otherwise `false`. | ||
| @discardableResult | ||
| public func sendTerminalInput( | ||
| _ text: String, | ||
| workspaceID: MobileWorkspacePreview.ID, | ||
| terminalID: MobileTerminalPreview.ID | ||
| ) async -> Bool { | ||
| guard !text.isEmpty, | ||
| workspace(workspaceID, containsSurfaceID: terminalID.rawValue) else { | ||
| return false | ||
| } | ||
| let target = workspaceMutationTarget(for: workspaceID) | ||
| guard let client = target.client else { return false } | ||
|
|
||
| do { | ||
| _ = try await client.sendRequest( | ||
| MobileCoreRPCClient.requestData( | ||
| method: "terminal.input", | ||
| params: [ | ||
| "workspace_id": remoteWorkspaceID(for: workspaceID).rawValue, | ||
| "surface_id": terminalID.rawValue, | ||
| "text": text, | ||
| "client_id": clientID, | ||
| ] | ||
| ) | ||
| ) | ||
| return true | ||
| } catch { | ||
| explicitTerminalInputLog.error( | ||
| "explicit terminal input failed workspace=\(workspaceID.rawValue, privacy: .private) surface=\(terminalID.rawValue, privacy: .private) error=\(String(describing: error), privacy: .private)" | ||
| ) | ||
| return false | ||
| } | ||
| } | ||
| } |
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
11 changes: 11 additions & 0 deletions
11
Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/PendingReply.swift
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,11 @@ | ||
| import Foundation | ||
|
|
||
| /// A single inline notification reply parked until its target Mac can accept input. | ||
| struct PendingReply: Equatable, Sendable { | ||
| let text: String | ||
| let workspaceId: String? | ||
| let surfaceId: String? | ||
| let macDeviceId: String? | ||
| let retargetsToLiveSurfaceOwner: Bool | ||
| let createdAt: Date | ||
| } |
7 changes: 7 additions & 0 deletions
7
Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/PendingReplyDecision.swift
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,7 @@ | ||
| /// The pure lifecycle decision for a parked inline notification reply. | ||
| enum PendingReplyDecision: Equatable, Sendable { | ||
| case noPending | ||
| case waiting | ||
| case expired | ||
| case ready(PendingReply) | ||
| } |
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.