Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
00da345
CmuxControlSocket stage 3c-1: ControlCommandCoordinator + window domain
azooz2003-bit Jun 10, 2026
2383068
stage 3c: multi-protocol seam umbrella + shared param/ref helper port
azooz2003-bit Jun 10, 2026
b02c28d
stage 3c: extract App Focus + Feed + Notification domains
azooz2003-bit Jun 10, 2026
9bdae00
stage 3c: extract Mobile Host + Workspace Groups + Pane domains
azooz2003-bit Jun 10, 2026
4b8118f
stage 3c: fix int/double param helpers to match legacy NSNumber coercion
azooz2003-bit Jun 10, 2026
1905b38
stage 3c: integrate Workspace + Surface domains (full lifts)
azooz2003-bit Jun 10, 2026
8f7ac89
stage 3c: organize coordinator files into per-domain subfolders
azooz2003-bit Jun 10, 2026
487baaf
stage 3c: dedupe workspace.create onto the shared v2WorkspaceCreate body
azooz2003-bit Jun 10, 2026
6f2cba5
stage 3c: fix 8 divergences found by Workspace+Surface adversarial re…
azooz2003-bit Jun 11, 2026
fe419f0
Budget: entries for the two coordinator files grown by the divergence…
azooz2003-bit Jun 11, 2026
a94589d
Merge remote-tracking branch 'origin/main' into feat-ctl-coordinator-…
azooz2003-bit Jun 11, 2026
f731c27
Fix duplicate parameter name warning (sessionID sessionID) in workspa…
azooz2003-bit Jun 11, 2026
7d234dc
stage 3c: package side of System/Project/Debug/Sidebar/Browser domain…
azooz2003-bit Jun 11, 2026
39d111b
stage 3c: cut over System/Project/Debug/Sidebar/Browser domains to th…
azooz2003-bit Jun 11, 2026
a9eb608
CmuxSidebarGit: extract TabManager git-metadata + PR-polling subsystem
azooz2003-bit Jun 11, 2026
e446b2b
Merge remote-tracking branch 'origin/feat-ctl-coordinator-3c-1' into …
azooz2003-bit Jun 11, 2026
3e38fd9
CmuxSidebarGit tests: use a non-skip branch in PR poll tests
azooz2003-bit Jun 11, 2026
ecd5148
stage 3c: dedupe file.open onto the shared v2FileOpen body
azooz2003-bit Jun 11, 2026
3178b68
stage 3c: fix browser.focus_mode.set/zoom.set error precedence; finis…
azooz2003-bit Jun 11, 2026
42f9332
Budget tsv: strip accidental leading whitespace
azooz2003-bit Jun 11, 2026
1e88ee1
CmuxSettings: SettingsReading/SettingsWriting sync seam + Wave-3 key …
azooz2003-bit Jun 11, 2026
d47e003
Merge pull request #5909 from manaflow-ai/feat-ctl-3c-final-domains
azooz2003-bit Jun 11, 2026
4094e6e
Add CmuxSidebar, CmuxBrowser, CmuxNotifications Wave-3 packages (mode…
azooz2003-bit Jun 11, 2026
29d8342
stage 3c: address review threads (handles observation, window.close t…
azooz2003-bit Jun 11, 2026
2be538e
Merge origin/main: adopt PR 5778's socket-worker browser JS lane; rev…
azooz2003-bit Jun 12, 2026
ac0b71c
Merge origin/feat-ctl-coordinator-3c-1 into feat-sidebar-git
azooz2003-bit Jun 12, 2026
a0d4ff2
Wave-3 app cutover: TabManager drains settings enums + dismissal + br…
azooz2003-bit Jun 12, 2026
bc69ced
Merge origin/feat-sidebar-git (3c domains + main sync) into feat-tabm…
azooz2003-bit Jun 12, 2026
b1916de
Wave-4 tranche 1: CmuxWorkspaceNavigation package (FocusHistoryModel …
azooz2003-bit Jun 12, 2026
6d1116d
Wave-4 tranche 2: CmuxPanes package (SplitDirection/ResizeDirection v…
azooz2003-bit Jun 12, 2026
b889f5a
Wave-4 tranche 3: CmuxWorkspaces package bootstrap (WorkspaceGroup va…
azooz2003-bit Jun 12, 2026
5d63c88
Wave-4 tranche 4a: WorkspacesModel owns tabs/groups/selection storage…
azooz2003-bit Jun 12, 2026
7ad3dd7
Wave-4 tranche 4b: group + reorder flows drain into CmuxWorkspaces co…
azooz2003-bit Jun 12, 2026
0e8a3aa
Merge origin/main into feat-sidebar-git
azooz2003-bit Jun 12, 2026
4600f30
Merge origin/feat-sidebar-git (main sync) into feat-tabmanager-models
azooz2003-bit Jun 12, 2026
6bc21ba
Fix remaining conditional CmuxSettings imports in cmuxTests
azooz2003-bit Jun 12, 2026
94f18db
Budget: ratchet for the unconditional test imports (+1 line each)
azooz2003-bit Jun 12, 2026
5ae6fae
Fix missing CmuxSidebar import in SidebarWorkspaceSnapshotRefreshPoli…
azooz2003-bit Jun 12, 2026
399b9c5
Repair WorkspaceUnitTests detail-visibility retarget; pin ambiguous a…
azooz2003-bit Jun 12, 2026
09c9d72
KeyboardShortcutContextTests: ShortcutStroke pins to the package type
azooz2003-bit Jun 12, 2026
72907cc
Budget: ratchet for KeyboardShortcutContextTests typealias note (+2)
azooz2003-bit Jun 12, 2026
e283828
Merge origin/main into feat-tabmanager-models (retarget to main)
azooz2003-bit Jun 13, 2026
f8d9fb9
Merge origin/main (advanced past first merge: #6052, #5920)
azooz2003-bit Jun 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 12 additions & 3 deletions .github/swift-file-length-budget.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# Format: max_lines<TAB>relative path
# Reduce counts as files shrink. CI fails if tracked files exceed this budget.
32873 CLI/cmux.swift
22426 Sources/TerminalController.swift
518 Packages/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Surface/ControlCommandCoordinator+Surface.swift
10748 Sources/TerminalController.swift
19955 Sources/Workspace.swift
19245 Sources/ContentView.swift
18044 Sources/AppDelegate.swift
16539 Sources/GhosttyTerminalView.swift
13589 Sources/Panels/BrowserPanel.swift
11916 cmuxTests/AppDelegateShortcutRoutingTests.swift
9992 Sources/TabManager.swift
8366 Sources/TabManager.swift
8494 cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift
7737 Sources/Panels/BrowserPanelView.swift
7198 cmuxTests/WorkspaceUnitTests.swift
Expand All @@ -26,7 +27,7 @@
4227 Sources/BrowserWindowPortal.swift
4009 cmuxTests/WindowAndDragTests.swift
3937 Sources/Feed/FeedPanelView.swift
3760 cmuxTests/TabManagerUnitTests.swift
3761 cmuxTests/TabManagerUnitTests.swift
3699 cmuxTests/CLIGenericHookPersistenceTests.swift
3685 Packages/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift
3396 Sources/CmuxConfig.swift
Expand Down Expand Up @@ -185,3 +186,11 @@
504 cmuxTests/TerminalNotificationSocketActionTests.swift
502 Sources/CmuxEventPublishing.swift
502 Sources/Settings/ConfigSource.swift
611 Sources/TerminalController+ControlPaneContext.swift
533 Packages/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Pane/ControlCommandCoordinator+Pane.swift
852 Packages/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Workspace/ControlCommandCoordinator+Workspace.swift
756 Sources/TerminalController+ControlWorkspaceContext.swift
645 Packages/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Browser/ControlCommandCoordinator+BrowserAutomationActions.swift
642 Packages/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Browser/ControlCommandCoordinator+Browser3.swift
595 Packages/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Browser/ControlCommandCoordinator+BrowserAutomation.swift
563 Packages/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Browser/ControlCommandCoordinator+BrowserAutomationFind.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
internal import Foundation

/// The app-focus-domain slice of the control-command seam (a constituent of the
/// ``ControlCommandContext`` umbrella).
///
/// The app target (today `TerminalController`, the interim composition owner)
/// conforms by reading and mutating the app's `AppFocusState` override and by
/// re-running the `applicationDidBecomeActive` activation path. Every method is
/// `@MainActor` because its conformer lives on the main actor and the
/// coordinator runs there too, so these are plain in-isolation calls — the
/// per-read `v2MainSync` hop the legacy `v2AppSimulateActive` body used
/// disappears once this domain moves onto the coordinator.
@MainActor
public protocol ControlAppFocusContext: AnyObject {
/// Sets (or clears) the app-focus override for `app.focus_override.set`,
/// mirroring the legacy `AppFocusState.overrideIsFocused = …` assignment.
///
/// - Parameter focused: `true`/`false` to force the override, or `nil` to
/// clear it and fall back to the real `NSApp.isActive` state.
func controlSetAppFocusOverride(_ focused: Bool?)

/// Re-runs the `applicationDidBecomeActive` activation path for
/// `app.simulate_active`, exactly as the legacy body did by posting an
/// `NSApplication.didBecomeActiveNotification` to `AppDelegate.shared`.
func controlSimulateAppActive()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
internal import Foundation

/// The app-focus domain (`app.focus_override.set`, `app.simulate_active`),
/// lifted byte-faithfully from the former `TerminalController.v2AppFocusOverride`
/// / `v2AppSimulateActive` bodies. Each payload is built directly as a
/// ``JSONValue`` (the typed twin of the legacy `[String: Any]` dictionaries);
/// the resulting Foundation object is identical, so the encoded wire bytes match.
extension ControlCommandCoordinator {
/// Runs one decoded request if it belongs to the app-focus domain, returning
/// the typed result; returns `nil` otherwise so the core dispatcher falls
/// through to other domains.
///
/// - Parameter request: The decoded request envelope.
/// - Returns: The command result, or `nil` if not owned by this domain.
func handleAppFocus(_ request: ControlRequest) -> ControlCallResult? {
switch request.method {
case "app.focus_override.set":
return appFocusOverride(request.params)
case "app.simulate_active":
return appSimulateActive()
default:
return nil
}
}

/// `app.focus_override.set` — force or clear the app-focus override.
///
/// Accepts either a `state` of `active` / `inactive` / `clear` (also `none`),
/// or a `focused` boolean (present-but-non-boolean, or explicit `null`,
/// clears). The two acceptance paths and their error shapes are byte-faithful
/// to the legacy body.
func appFocusOverride(_ params: [String: JSONValue]) -> ControlCallResult {
let override: Bool?
if let state = string(params, "state")?.lowercased() {
switch state {
case "active":
override = true
case "inactive":
override = false
case "clear", "none":
override = nil
default:
return .err(
code: "invalid_params",
message: "Invalid state (active|inactive|clear)",
data: .object(["state": .string(state)])
)
}
} else if params.keys.contains("focused") {
// Legacy: `params.keys.contains("focused")` — present (including an
// explicit JSON null) routes here; a non-boolean or null value
// clears the override.
override = bool(params, "focused")
} else {
return .err(code: "invalid_params", message: "Missing state or focused", data: nil)
}

context?.controlSetAppFocusOverride(override)
return .ok(.object(["override": override.map { JSONValue.bool($0) } ?? .null]))
}

/// `app.simulate_active` — re-run the app's `applicationDidBecomeActive` path.
func appSimulateActive() -> ControlCallResult {
context?.controlSimulateAppActive()
return .ok(.object([:]))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
public import Foundation

/// The browser DOM-automation slice of the control-command seam (a
/// constituent of the ``ControlCommandContext`` umbrella): element actions,
/// JS eval plumbing, frames, and dialogs.
///
/// The conformer (`TerminalController`) keeps everything that is irreducibly
/// app-coupled — the WKWebView JS execution/run-loop pump
/// (`v2RunBrowserJavaScript` / `v2RunJavaScript`, shared with the still-app-side
/// nav/tab/network browser bodies), the viewport snapshot capture, WKUserScript
/// injection, and the dialog completion handlers — while every script string,
/// retry loop, payload shape, and piece of selection state lives in the
/// coordinator. Every method is `@MainActor`: the coordinator runs there, so
/// these are plain in-isolation calls (the legacy per-command `v2MainSync`
/// hops disappear).
@MainActor
public protocol ControlBrowserAutomationContext: AnyObject {
/// The single browser DOM-automation state instance (element refs, frame
/// selectors, init scripts/styles, pending dialogs). Owned by the
/// conformer so the app-side browser bodies that still read it
/// (snapshot ref minting, `state.save`/`state.load`, surface cleanup)
/// share it with the coordinator.
var controlBrowserAutomationState: ControlBrowserAutomationState { get }

/// Resolves the browser panel a DOM-automation command targets, mirroring
/// the legacy `v2BrowserWithPanel` + `v2ResolveBrowserSurfaceId`
/// precedence: explicit surface (`surface_id` ?? `tab_id`), else the
/// selected surface of an explicit `pane_id`, else the workspace's
/// focused surface.
///
/// - Parameters:
/// - routing: The shared routing selectors (TabManager + workspace).
/// - surfaceID: The explicit browser surface param, if present.
/// - Returns: The resolution outcome.
func controlBrowserResolvePanel(
routing: ControlRoutingSelectors,
surfaceID: UUID?
) -> ControlBrowserPanelResolution

/// Resolves the browser panel for `browser.wait`, whose legacy resolution
/// differs: explicit `surface_id` only (no `tab_id`/`pane_id`), else the
/// workspace's focused surface.
///
/// - Parameters:
/// - routing: The shared routing selectors.
/// - surfaceID: The explicit `surface_id` param, if present.
/// - Returns: The resolution outcome (the pane cases are never produced).
func controlBrowserResolveWaitPanel(
routing: ControlRoutingSelectors,
surfaceID: UUID?
) -> ControlBrowserPanelResolution

/// Runs a frame-scoped automation script on a surface's web view: the
/// legacy `v2RunBrowserJavaScript` (frame prelude from the current frame
/// selector, async envelope, page-world with isolated-world retry), with
/// the result bridged through the legacy `v2NormalizeJSValue` rules.
///
/// - Parameters:
/// - surfaceID: The browser surface.
/// - script: The script source.
/// - timeout: The evaluation timeout in seconds.
/// - useEval: Whether the script runs through `eval(...)` (legacy
/// `useEval: true`) or is inlined as an expression.
/// - Returns: The bridged outcome.
func controlBrowserRunAutomationScript(
surfaceID: UUID,
script: String,
timeout: TimeInterval,
useEval: Bool
) -> ControlBrowserScriptOutcome

/// Runs a raw page-world script on a surface's web view (the legacy bare
/// `v2RunJavaScript(..., contentWorld: .page)` used by
/// `browser.dialog.accept`/`dismiss`): no frame prelude, no eval envelope.
///
/// - Parameters:
/// - surfaceID: The browser surface.
/// - script: The script source.
/// - timeout: The evaluation timeout in seconds.
/// - Returns: The bridged outcome.
func controlBrowserRunPageScript(
surfaceID: UUID,
script: String,
timeout: TimeInterval
) -> ControlBrowserScriptOutcome

/// Installs the page-telemetry bootstrap hooks on a surface (the legacy
/// `v2BrowserEnsureTelemetryHooks`, best-effort).
///
/// - Parameter surfaceID: The browser surface.
func controlBrowserEnsureTelemetryHooks(surfaceID: UUID)

/// Installs the dialog-telemetry bootstrap hooks on a surface (the legacy
/// `v2BrowserEnsureDialogHooks`, best-effort).
///
/// - Parameter surfaceID: The browser surface.
func controlBrowserEnsureDialogHooks(surfaceID: UUID)

/// Captures the surface's visible viewport as PNG data for
/// `browser.screenshot` (the legacy 15s `v2AwaitCallback` around
/// `captureAutomationVisibleViewportSnapshot` + PNG encode).
///
/// - Parameter surfaceID: The browser surface.
/// - Returns: The capture outcome.
func controlBrowserCaptureScreenshot(surfaceID: UUID) -> ControlBrowserScreenshotResult

/// Adds a persistent `WKUserScript` (document-start, all frames) to the
/// surface's web view, as `browser.addinitscript`/`browser.addstyle` did.
///
/// - Parameters:
/// - surfaceID: The browser surface.
/// - source: The script source.
func controlBrowserAddPersistentUserScript(surfaceID: UUID, source: String)

/// Runs the stored WKWebView completion handler for a pending native
/// dialog popped from ``ControlBrowserAutomationState``, keyed by
/// ``ControlBrowserPendingDialog/dialogID`` (the redesigned transport for
/// the closure the legacy `V2BrowserPendingDialog` carried).
///
/// - Parameters:
/// - dialogID: The dialog's completion-handler key.
/// - accept: Whether the dialog was accepted.
/// - text: The prompt text, if any.
/// - Returns: Whether a stored completion handler was found and run.
func controlBrowserResolvePendingDialog(dialogID: UUID, accept: Bool, text: String?) -> Bool

/// The surface's current page title for `browser.get.title` (the legacy
/// `browserPanel.pageTitle` read).
///
/// - Parameter surfaceID: The browser surface.
/// - Returns: The page title, or `nil` when the surface is no longer a
/// browser.
func controlBrowserPageTitle(surfaceID: UUID) -> String?
}
Loading
Loading