diff --git a/.github/swift-file-length-budget.tsv b/.github/swift-file-length-budget.tsv index 0aba334a236b..622c2547a8ab 100644 --- a/.github/swift-file-length-budget.tsv +++ b/.github/swift-file-length-budget.tsv @@ -1,27 +1,27 @@ # cmux-owned Swift file length budget. # Format: max_linesrelative path # Reduce counts as files shrink. CI fails if tracked files exceed this budget. -35398 CLI/cmux.swift -17839 Sources/AppDelegate.swift -16424 Sources/ContentView.swift -15094 Sources/TerminalController.swift -13077 Sources/Workspace.swift +35560 CLI/cmux.swift +17793 Sources/AppDelegate.swift +16393 Sources/ContentView.swift +15093 Sources/TerminalController.swift +13021 Sources/Workspace.swift 12501 Sources/GhosttyTerminalView.swift 12348 cmuxTests/AppDelegateShortcutRoutingTests.swift 11344 Sources/Panels/BrowserPanel.swift 9497 cmuxTests/CLINotifyProcessIntegrationRegressionTests.swift 8016 CLI/cmux_open.swift -7959 Sources/Panels/BrowserPanelView.swift +7956 Sources/Panels/BrowserPanelView.swift 7709 Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/MobileShellComposite.swift 7489 cmuxTests/WorkspaceUnitTests.swift 7312 cmuxTests/WorkspaceRemoteConnectionTests.swift 6359 cmuxTests/SessionPersistenceTests.swift 6255 cmuxTests/GhosttyConfigTests.swift -6223 Sources/TabManager.swift +6201 Sources/TabManager.swift 5914 cmuxTests/TerminalAndGhosttyTests.swift 5809 Sources/TextBoxInput.swift -5572 cmuxTests/BrowserConfigTests.swift -4758 Sources/cmuxApp.swift +5571 cmuxTests/BrowserConfigTests.swift +4606 Sources/cmuxApp.swift 4482 Sources/Panels/FilePreviewPanel.swift 4367 cmuxTests/BrowserPanelTests.swift 4007 cmuxTests/TabManagerUnitTests.swift @@ -35,8 +35,8 @@ 2882 Sources/Update/UpdateTitlebarAccessory.swift 2876 cmuxTests/CMUXOpenCommandTests.swift 2875 Sources/SessionIndexView.swift -2611 Sources/KeyboardShortcutSettings.swift 2562 Sources/Panels/CmuxWebView.swift +2559 Sources/KeyboardShortcutSettings.swift 2546 cmuxTests/WorkspaceManualUnreadTests.swift 2524 cmuxTests/CommandPaletteSearchEngineTests.swift 2403 Sources/Mobile/MobileHostService.swift @@ -46,8 +46,8 @@ 2203 Sources/RestorableAgentSession.swift 2133 cmuxTests/ShortcutAndCommandPaletteTests.swift 2126 cmuxTests/CmuxConfigTests.swift -2016 Sources/SessionPersistence.swift -2011 Sources/KeyboardShortcutSettingsFileStore.swift +1989 Sources/SessionPersistence.swift +1983 Sources/KeyboardShortcutSettingsFileStore.swift 1900 cmuxTests/NotificationAndMenuBarTests.swift 1866 Sources/Panels/BrowserWebAuthnSupport.swift 1847 cmuxTests/TerminalControllerSocketSecurityTests.swift @@ -61,9 +61,9 @@ 1604 Packages/iOS/CmuxMobileTerminal/Sources/CmuxMobileTerminal/TerminalInputTextView.swift 1560 cmuxTests/TextBoxMentionCompletionTests.swift 1523 cmuxTests/RestorableAgentSessionIndexTests.swift -1498 cmuxUITests/MultiWindowNotificationsUITests.swift 1499 cmuxTests/OmnibarAndToolsTests.swift -1428 cmuxTests/AgentSessionAutoResumeSwiftTests.swift +1498 cmuxUITests/MultiWindowNotificationsUITests.swift +1429 cmuxTests/AgentSessionAutoResumeSwiftTests.swift 1420 cmuxTests/AppDelegateIssue2907RoutingTests.swift 1384 cmuxTests/KeyboardShortcutSettingsFileStoreStartupTests.swift 1380 cmuxUITests/MenuKeyEquivalentRoutingUITests.swift @@ -80,9 +80,7 @@ 1204 cmuxTests/FileExplorerStoreTests.swift 1197 cmuxTests/CodexAppServerSessionTests.swift 1197 cmuxTests/VMDefaultCloudCommandTests.swift -1175 Sources/RemoteTmuxControlConnection.swift 1166 Sources/VaultAgentProcessScanner.swift -1156 Sources/RemoteTmuxController.swift 1147 cmuxTests/PiVaultAgentPersistenceTests.swift 1121 cmuxTests/AgentHibernationTests.swift 1093 cmuxUITests/BonsplitTabDragUITests.swift @@ -96,7 +94,6 @@ 1002 Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/PairedMacBackupTests.swift 1000 cmuxTests/DockSocketLifecycleTests.swift 982 Packages/Shared/CmuxAgentChat/Tests/CmuxAgentChatTests/ChatConversationStoreTests.swift -951 Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Workspace/ControlCommandCoordinator+Workspace.swift 951 Sources/App/TerminalDirectoryOpenSupport.swift 948 Sources/App/ShortcutRoutingSupport.swift 947 Sources/TerminalNotificationPolicy.swift @@ -109,10 +106,12 @@ 918 Sources/Panels/BrowserPopupWindowController.swift 905 Sources/CmuxSSHURLRequest.swift 899 Sources/Panels/MarkdownWebRenderer.swift -897 Sources/DockSplitStore.swift 896 Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/AppSection.swift 885 cmuxTests/SidebarWorkspaceDropPlannerTests.swift +880 Sources/DockSplitStore.swift +878 Sources/RemoteTmuxControlConnection.swift 871 cmuxTests/ClaudeHookSurfaceResolutionSwiftTests.swift +868 Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Workspace/ControlCommandCoordinator+Workspace.swift 868 Sources/Panels/BrowserScreenshotSnapshotter.swift 864 Packages/Shared/CmuxAgentChat/Sources/CmuxAgentChat/Store/ChatConversationStore.swift 858 Sources/PricingPlansScreen.swift @@ -122,26 +121,27 @@ 834 Sources/MainWindowFocusController.swift 830 Sources/TaskManagerTypes.swift 825 Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/TerminalComposerView.swift -822 Sources/WorkspaceContentView.swift +821 Sources/WorkspaceContentView.swift 810 Packages/macOS/CmuxSwiftRender/Tests/CmuxSwiftRenderTests/SwiftViewInterpreterTests.swift 803 Packages/iOS/CmuxMobilePairedMac/Sources/CmuxMobilePairedMac/MobilePairedMacStore.swift 802 Sources/TerminalController+ControlPaneContext.swift 799 Sources/ClosedItemHistory.swift +793 Sources/RemoteTmuxController.swift 779 cmuxUITests/BrowserOmnibarSuggestionsUITests.swift 773 Sources/App/MenuBarExtraController.swift 769 Packages/macOS/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface+Input.swift 768 cmuxUITests/BrowserFixtureInteractionUITests.swift 762 Packages/iOS/CmuxMobileTransport/Sources/CmuxMobileTransport/CmxNetworkByteTransport.swift -757 Sources/TerminalController+ControlWorkspaceContext.swift 756 Sources/Panels/AgentSessionWebRendererCoordinator.swift 754 cmuxTests/GhosttyTerminalStartupEnvironmentTests.swift 753 Sources/Mobile/AgentChat/AgentChatSessionRegistry.swift 752 cmuxUITests/CloseWorkspaceCmdDUITests.swift -749 cmuxTests/UpdatePillReleaseVisibilityTests.swift 738 Packages/macOS/CMUXProjectModel/Sources/CMUXProjectModel/XcodeProjectAdapter.swift +729 Sources/TerminalController+ControlWorkspaceContext.swift 724 Packages/Shared/CmuxAuthRuntime/Sources/CmuxAuthRuntime/Coordinator/AuthCoordinator.swift 716 Sources/TaskManagerSnapshot.swift 714 Sources/AppleScriptSupport.swift +713 cmuxTests/UpdatePillReleaseVisibilityTests.swift 710 Sources/TerminalSSHSessionDetector.swift 709 Packages/macOS/CmuxFoundation/Sources/CmuxFoundation/SidebarDrop/SidebarWorkspaceReorderDropResolver.swift 706 CLI/CMUXCLI+Config.swift @@ -160,21 +160,19 @@ 676 Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Pane/ControlCommandCoordinator+Pane.swift 672 cmuxTests/SessionPersistenceResumeBindingTests.swift 668 cmuxTests/FeedCoordinatorTests.swift -668 cmuxTests/SettingsWindowPresenterTests.swift -667 Packages/macOS/CmuxRemoteWorkspace/Sources/CmuxRemoteWorkspace/Tunnel/RemoteDaemonProxyTunnel.swift 665 cmuxTests/CLICodexHookTimeoutRegressionTests.swift 664 Sources/CmuxTopSnapshot.swift 663 Sources/PortScanner.swift -661 Packages/macOS/CmuxRemoteSession/Sources/CmuxRemoteSession/Session/RemoteSessionCoordinator.swift +660 Packages/macOS/CmuxRemoteSession/Sources/CmuxRemoteSession/Session/RemoteSessionCoordinator.swift 657 Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellRenderGridInputCatchUpTests.swift 654 Packages/macOS/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface+RuntimeLifecycle.swift 653 Packages/iOS/CmuxMobileShellUI/Sources/CmuxMobileShellUI/WorkspaceListView.swift 650 Packages/macOS/CmuxBrowser/Sources/CmuxBrowser/Import/Detection/BrowserInstalledBrowserDetector.swift 650 Sources/Panels/MarkdownRemoteImageLoader.swift +649 Packages/macOS/CmuxRemoteWorkspace/Sources/CmuxRemoteWorkspace/Tunnel/RemoteDaemonProxyTunnel.swift 648 cmuxTests/TerminalNotificationQueueTests.swift 644 Packages/macOS/CMUXAgentLaunch/Tests/CMUXAgentLaunchTests/AgentLaunchSanitizerTests.swift 641 cmuxTests/CommandPaletteNucleoFFITests.swift -638 cmuxTests/RemoteTmuxControlParserTests.swift 637 Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/MobileShellRenderGridLivenessTestSupport.swift 635 Sources/Panels/BrowserNavigationDelegate.swift 635 cmuxUITests/RightSidebarChromeHeightUITests.swift @@ -186,6 +184,7 @@ 608 cmuxUITests/FeedSidebarUITests.swift 607 Sources/SessionIndexModels.swift 607 Sources/SleepyFaceView.swift +607 cmuxTests/RemoteTmuxControlParserTests.swift 606 Packages/macOS/CmuxTerminal/Sources/CmuxTerminal/Surface/TerminalSurface.swift 604 Packages/macOS/CmuxCommandPalette/Tests/CmuxCommandPaletteTests/CommandPaletteNucleoFFITests.swift 601 Packages/macOS/CmuxWorkspaces/Sources/CmuxWorkspaces/Coordinators/WorkspaceReorderCoordinator.swift @@ -204,9 +203,11 @@ 577 cmuxTests/AppearanceSettingsTests.swift 576 Packages/Shared/CMUXMobileCore/Sources/CMUXMobileCore/MobileTerminalRenderGrid.swift 575 Packages/macOS/CmuxWorkspaces/Sources/CmuxWorkspaces/Coordinators/WorkspaceGroupCoordinator.swift +574 cmuxTests/SettingsWindowPresenterTests.swift 572 Sources/Feed/FeedTextEditorDebugWindowController.swift 567 Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/BrowserSection.swift 567 Packages/macOS/CmuxTerminalCore/Sources/CmuxTerminalCore/ConfigDiscovery/GhosttyConfigDiscovery.swift +563 Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlCommandCoordinator+SidebarMetadataV1.swift 562 cmuxTests/AgentExecutableResolverTests.swift 561 cmuxTests/GhosttyConfigPathResolverTests.swift 560 cmuxTests/CLISSHPTYResizeInputTests.swift @@ -214,7 +215,6 @@ 558 Packages/macOS/CmuxGit/Sources/CmuxGit/Parsing/GitMetadataService+Config.swift 553 Sources/RightSidebarPanelView.swift 550 Sources/CloudVMActionLauncher.swift -549 Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlCommandCoordinator+SidebarMetadataV1.swift 549 Sources/Panels/BrowserAutomation.swift 547 Packages/iOS/CmuxMobileShell/Sources/CmuxMobileShell/BackingUpPairedMacStore.swift 546 Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Sections/AutomationSection.swift @@ -225,7 +225,6 @@ 538 Packages/Shared/CMUXMobileCore/Tests/CMUXMobileCoreTests/MobileTerminalRenderGridTests.swift 538 Sources/TerminalController+ControlSurfaceContext2.swift 535 Sources/App/WorkspaceRuntimeSettings.swift -533 Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene.swift 529 Packages/macOS/CMUXAgentLaunch/Sources/CMUXAgentLaunch/AgentLaunchSanitizerPrimaryPolicies.swift 528 cmuxUITests/AutomationSocketUITests.swift 527 CLI/CLISocketPathResolver.swift @@ -234,6 +233,7 @@ 525 Packages/macOS/CmuxSettings/Sources/CmuxSettings/SocketControl/SocketControlSettings.swift 524 CLI/CMUXCLI+AutoNaming.swift 522 Sources/TerminalPaneDropTargetView.swift +521 Packages/macOS/CmuxSettingsUI/Sources/CmuxSettingsUI/Scene/SettingsWindowScene.swift 520 CLI/CMUXCLI+AmpExtension.swift 520 cmuxTests/MainWindowVisibilityControllerTests.swift 519 Packages/macOS/CmuxSwiftRender/Tests/CmuxSwiftRenderTests/Corpus/stress-two-column-cockpit-sidebar.swift diff --git a/CLI/CMUXCLI+CommandSuggestions.swift b/CLI/CMUXCLI+CommandSuggestions.swift index 74099d433247..df0caa7352c2 100644 --- a/CLI/CMUXCLI+CommandSuggestions.swift +++ b/CLI/CMUXCLI+CommandSuggestions.swift @@ -68,6 +68,7 @@ extension CMUXCLI { "capture-pane", "claude-hook", "claude-teams", + "clear-agent-pid", "clear-history", "clear-log", "clear-notifications", @@ -169,6 +170,7 @@ extension CMUXCLI { "send-key", "send-key-panel", "send-panel", + "set-agent-lifecycle", "set-app-focus", "set-buffer", "set-hook", diff --git a/CLI/cmux.swift b/CLI/cmux.swift index b6ec3522b3f2..6649068db6ca 100644 --- a/CLI/cmux.swift +++ b/CLI/cmux.swift @@ -5143,6 +5143,24 @@ struct CMUXCLI { case "set-status": let response = try forwardSidebarMetadataCommand( "set_status", + commandArgs: commandArgs, + client: client, + windowOverride: windowId, + resolvePanelOption: true, + validatePIDOption: true + ) + print(response) + + case "set-agent-lifecycle": + let response = try forwardSetAgentLifecycleCommand( + commandArgs: commandArgs, + client: client, + windowOverride: windowId + ) + print(response) + + case "clear-agent-pid": + let response = try forwardClearAgentPIDCommand( commandArgs: commandArgs, client: client, windowOverride: windowId @@ -16704,21 +16722,52 @@ struct CMUXCLI { return String(localized: "cli.help.setStatus", defaultValue: """ Usage: cmux set-status [flags] - Set a sidebar status entry for a workspace. Status entries appear as - pills in the sidebar tab row. Use a unique key so different tools - (e.g. "claude_code", "build") can manage their own entries. + Set a sidebar status entry. Workspace entries appear as pills; a + pane-scoped registered agent key appears as that pane's agent row. Flags: --icon Icon name (e.g. "sparkle", "hammer") --color <#hex> Pill color (e.g. "#ff9500") --priority Sort priority; higher appears first (default: 0) + --panel Scope this status to a pane/surface + --pid Associate a live agent PID with this key --workspace Target workspace (default: $CMUX_WORKSPACE_ID) --window Window context for workspace refs and indexes Example: cmux set-status build "compiling" --icon hammer --color "#ff9500" --priority 80 + cmux set-status my-agent "Running checks" --panel surface:1 --pid 12345 cmux set-status deploy "v1.2.3" --workspace workspace:2 """) + case "set-agent-lifecycle": + return """ + Usage: cmux set-agent-lifecycle [flags] + + Set a pane-scoped agent lifecycle state. + + Flags: + --panel Target pane/surface (default: focused surface) + --workspace Target workspace (default: $CMUX_WORKSPACE_ID) + --window Window context for workspace refs and indexes + + Example: + cmux set-agent-lifecycle my-agent running --panel surface:1 + """ + case "clear-agent-pid": + return """ + Usage: cmux clear-agent-pid [flags] + + Clear a tracked agent PID and optionally its status row state. + + Flags: + --panel Target pane/surface + --clear-status Also clear the associated status entry + --workspace Target workspace (default: $CMUX_WORKSPACE_ID) + --window Window context for workspace refs and indexes + + Example: + cmux clear-agent-pid my-agent --panel surface:1 --clear-status + """ case "clear-status": return """ Usage: cmux clear-status [flags] @@ -17192,7 +17241,9 @@ struct CMUXCLI { _ socketCommand: String, commandArgs: [String], client: SocketClient, - windowOverride: String? + windowOverride: String?, + resolvePanelOption: Bool = false, + validatePIDOption: Bool = false ) throws -> String { func insertArgumentBeforeSeparator(_ value: String, into args: inout [String]) { if let separatorIndex = args.firstIndex(of: "--") { @@ -17202,13 +17253,96 @@ struct CMUXCLI { } } - var forwardedArgs: [String] = [] - var resolvedExplicitWorkspace = false - var index = 0 - var parsingOptions = true + func hasOption(_ name: String, in args: [String]) -> Bool { + for arg in args { + if arg == "--" { return false } + if arg == name || arg.hasPrefix("\(name)=") { + return true + } + } + return false + } + + func validatePIDOptions(_ args: [String]) throws { + var index = 0 + while index < args.count { + let arg = args[index] + if arg == "--" { return } + let rawPID: String? + if arg == "--pid" { + guard index + 1 < args.count else { + throw CLIError(message: "set-status: --pid requires a positive integer") + } + rawPID = args[index + 1] + index += 2 + } else if arg.hasPrefix("--pid=") { + rawPID = String(arg.dropFirst("--pid=".count)) + index += 1 + } else { + index += 1 + continue + } + guard let rawPID, + let pid = Int32(rawPID), + pid > 0 else { + throw CLIError(message: "set-status: --pid requires a positive integer") + } + } + } + + func resolvePanelOptionValues(in args: inout [String], workspaceId: String) throws { + var index = 0 + while index < args.count { + let arg = args[index] + if arg == "--" { return } + if arg == "--panel" { + guard index + 1 < args.count else { + throw CLIError(message: "\(socketCommand.replacingOccurrences(of: "_", with: "-")): --panel requires a value") + } + args[index + 1] = try resolveSurfaceId(args[index + 1], workspaceId: workspaceId, client: client) + index += 2 + continue + } + if arg.hasPrefix("--panel=") { + let rawPanel = String(arg.dropFirst("--panel=".count)) + let panelId = try resolveSurfaceId(rawPanel, workspaceId: workspaceId, client: client) + args[index] = "--panel=\(panelId)" + index += 1 + continue + } + index += 1 + } + } + let rawWindow = windowFromArgsOrOverride(commandArgs, windowOverride: windowOverride) let windowHandle = try normalizeWindowHandle(rawWindow, client: client) + let explicitWorkspaceArg = optionValue(commandArgs, name: "--workspace") + if validatePIDOption { + try validatePIDOptions(commandArgs) + } + + let targetWorkspaceId: String? + if let explicitWorkspaceArg { + targetWorkspaceId = try resolveWorkspaceId(explicitWorkspaceArg, client: client, windowHandle: windowHandle) + } else if let workspaceArg = workspaceFromArgsOrEnv(commandArgs, windowOverride: windowOverride) { + targetWorkspaceId = try resolveWorkspaceId(workspaceArg, client: client, windowHandle: windowHandle) + } else if let windowHandle { + targetWorkspaceId = try requireCurrentWorkspaceId( + windowHandle: windowHandle, + client: client, + command: socketCommand + ) + } else if resolvePanelOption, + hasOption("--panel", in: commandArgs) { + targetWorkspaceId = try resolveWorkspaceId(nil, client: client, windowHandle: windowHandle) + } else { + targetWorkspaceId = nil + } + + var forwardedArgs: [String] = [] + var index = 0 + var parsingOptions = true while index < commandArgs.count { let arg = commandArgs[index] if parsingOptions, arg == "--" { @@ -17218,17 +17352,10 @@ struct CMUXCLI { continue } if parsingOptions, arg == "--workspace", index + 1 < commandArgs.count { - let workspaceId = try resolveWorkspaceId(commandArgs[index + 1], client: client, windowHandle: windowHandle) - forwardedArgs.append("--tab=\(workspaceId)") - resolvedExplicitWorkspace = true index += 2 continue } if parsingOptions, arg.hasPrefix("--workspace=") { - let rawWorkspace = String(arg.dropFirst("--workspace=".count)) - let workspaceId = try resolveWorkspaceId(rawWorkspace, client: client, windowHandle: windowHandle) - forwardedArgs.append("--tab=\(workspaceId)") - resolvedExplicitWorkspace = true index += 1 continue } @@ -17244,18 +17371,14 @@ struct CMUXCLI { index += 1 } - if !resolvedExplicitWorkspace, - let workspaceArg = workspaceFromArgsOrEnv(commandArgs, windowOverride: windowOverride) { - let workspaceId = try resolveWorkspaceId(workspaceArg, client: client, windowHandle: windowHandle) - insertArgumentBeforeSeparator("--tab=\(workspaceId)", into: &forwardedArgs) - } else if !resolvedExplicitWorkspace, - let windowHandle { - let workspaceId = try requireCurrentWorkspaceId( - windowHandle: windowHandle, - client: client, - command: socketCommand - ) - insertArgumentBeforeSeparator("--tab=\(workspaceId)", into: &forwardedArgs) + if let targetWorkspaceId { + insertArgumentBeforeSeparator("--tab=\(targetWorkspaceId)", into: &forwardedArgs) + } + + if resolvePanelOption, + let targetWorkspaceId, + hasOption("--panel", in: forwardedArgs) { + try resolvePanelOptionValues(in: &forwardedArgs, workspaceId: targetWorkspaceId) } let command = ([socketCommand] + forwardedArgs) @@ -17264,6 +17387,57 @@ struct CMUXCLI { return try sendV1Command(command, client: client) } + private func forwardSetAgentLifecycleCommand( + commandArgs: [String], + client: SocketClient, + windowOverride: String? + ) throws -> String { + let (_, rem0) = parseOption(commandArgs, name: "--workspace") + let (_, rem1) = parseOption(rem0, name: "--window") + let (_, rem2) = parseOption(rem1, name: "--panel") + guard rem2.count == 2 else { + throw CLIError(message: "Usage: cmux set-agent-lifecycle [--workspace ] [--panel ]") + } + let lifecycle = rem2[1] + let allowed = ["running", "idle", "needsInput", "unknown"] + guard allowed.contains(lifecycle) else { + throw CLIError(message: "set-agent-lifecycle: invalid lifecycle '\(lifecycle)' (expected running, idle, needsInput, or unknown)") + } + return try forwardSidebarMetadataCommand( + "set_agent_lifecycle", + commandArgs: commandArgs, + client: client, + windowOverride: windowOverride, + resolvePanelOption: true + ) + } + + private func forwardClearAgentPIDCommand( + commandArgs: [String], + client: SocketClient, + windowOverride: String? + ) throws -> String { + let clearStatus = hasFlag(commandArgs, name: "--clear-status") + let argsWithoutClearStatus = commandArgs.filter { $0 != "--clear-status" } + let (_, rem0) = parseOption(argsWithoutClearStatus, name: "--workspace") + let (_, rem1) = parseOption(rem0, name: "--window") + let (_, rem2) = parseOption(rem1, name: "--panel") + guard rem2.count == 1 else { + throw CLIError(message: "Usage: cmux clear-agent-pid [--workspace ] [--panel ] [--clear-status]") + } + var forwardedArgs = argsWithoutClearStatus + if clearStatus { + forwardedArgs.append("--clear-status") + } + return try forwardSidebarMetadataCommand( + "clear_agent_pid", + commandArgs: forwardedArgs, + client: client, + windowOverride: windowOverride, + resolvePanelOption: true + ) + } + private struct RightSidebarCLIArguments { let positional: [String] let workspace: String? @@ -35264,7 +35438,9 @@ export default CMUXSessionRestore; clear-notifications [--workspace ] [--window ] right-sidebar [--workspace ] [--window ] [--no-focus] sidebar [name] - set-status [--workspace ] [--window ] [--icon ] [--color <#hex>] [--priority ] + set-status [--workspace ] [--window ] [--panel ] [--pid ] [--icon ] [--color <#hex>] [--priority ] + set-agent-lifecycle [--workspace ] [--panel ] [--window ] + clear-agent-pid [--workspace ] [--panel ] [--clear-status] [--window ] clear-status [--workspace ] [--window ] list-status [--workspace ] [--window ] set-progress <0.0-1.0> [--label ] [--workspace ] [--window ] diff --git a/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlCommandCoordinator+SidebarMetadataV1.swift b/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlCommandCoordinator+SidebarMetadataV1.swift index e9a0fc42d72c..ff8125cd4a25 100644 --- a/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlCommandCoordinator+SidebarMetadataV1.swift +++ b/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlCommandCoordinator+SidebarMetadataV1.swift @@ -18,11 +18,14 @@ extension ControlCommandCoordinator { // MARK: - Status / metadata entries /// The shared `set_status`/`report_meta` upsert body: parse + validate on - /// the calling thread, then a bus enqueue; the `OK` reply is parse-only - /// (zero main hops, exactly the legacy deferred-mutation semantics). + /// the calling thread, then a bus enqueue. `set_status --panel` may run + /// the app-owned vault-agent allowlist check to decide whether a custom + /// key is row-eligible; otherwise the `OK` reply is parse-only (zero main + /// hops, exactly the legacy deferred-mutation semantics). nonisolated func sidebarUpsertMetadata( _ args: String, missingError: String, + allowsDynamicAgentRows: Bool, context: (any ControlCommandContext)? ) -> String { let parsed = sidebarParseOptionsNoStop(args) @@ -66,7 +69,7 @@ extension ControlCommandCoordinator { } let panelResolution = sidebarParseOptionalPanelIdOption( options: parsed.options, - usage: "set_status [--icon=X] [--color=#hex] [--url=X] [--priority=N] [--format=plain|markdown] [--tab=X] [--panel=ID]" + usage: "set_status [--icon=X] [--color=#hex] [--url=X] [--priority=N] [--format=plain|markdown] [--tab=X] [--panel=ID] [--pid=N]" ) if let error = panelResolution.error { return error @@ -80,6 +83,14 @@ extension ControlCommandCoordinator { return nil }() + let dynamicAgentRowKey = allowsDynamicAgentRows + && panelResolution.panelId != nil + && (context?.controlSidebarIsAllowedAgentLifecycleKey( + key, + target: target, + panelID: panelResolution.panelId + ) ?? false) + context?.controlSidebarScheduleStatusUpsert( target: target, key: key, @@ -90,7 +101,8 @@ extension ControlCommandCoordinator { priority: priority, format: format, panelID: panelResolution.panelId, - pid: pidValue + pid: pidValue, + dynamicAgentRowKey: dynamicAgentRowKey ) return "OK" } @@ -120,7 +132,8 @@ extension ControlCommandCoordinator { nonisolated func sidebarSetStatus(_ args: String, context: (any ControlCommandContext)?) -> String { sidebarUpsertMetadata( args, - missingError: "ERROR: Missing status key or value — usage: set_status [--icon=X] [--color=#hex] [--url=X] [--priority=N] [--format=plain|markdown] [--tab=X]", + missingError: "ERROR: Missing status key or value — usage: set_status [--icon=X] [--color=#hex] [--url=X] [--priority=N] [--format=plain|markdown] [--tab=X] [--panel=ID] [--pid=N]", + allowsDynamicAgentRows: true, context: context ) } @@ -130,6 +143,7 @@ extension ControlCommandCoordinator { sidebarUpsertMetadata( args, missingError: "ERROR: Missing metadata key or value — usage: report_meta [--icon=X] [--color=#hex] [--url=X] [--priority=N] [--format=plain|markdown] [--tab=X]", + allowsDynamicAgentRows: false, context: context ) } diff --git a/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlSidebarContext.swift b/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlSidebarContext.swift index 4a74d0f4f38d..9ffdac2fef3d 100644 --- a/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlSidebarContext.swift +++ b/Packages/macOS/CmuxControlSocket/Sources/CmuxControlSocket/Coordinator/Sidebar/ControlSidebarContext.swift @@ -59,7 +59,8 @@ public protocol ControlSidebarContext: AnyObject { priority: Int, format: ControlSidebarMetadataFormat, panelID: UUID?, - pid: Int32? + pid: Int32?, + dynamicAgentRowKey: Bool ) /// Enqueues the `clear_status`/`clear_meta` removal mutation. diff --git a/Packages/macOS/CmuxControlSocket/Tests/CmuxControlSocketTests/ControlCommandContextTestStubs+SidebarBrowser.swift b/Packages/macOS/CmuxControlSocket/Tests/CmuxControlSocketTests/ControlCommandContextTestStubs+SidebarBrowser.swift index a449dd02b5a1..b2d656d4c326 100644 --- a/Packages/macOS/CmuxControlSocket/Tests/CmuxControlSocketTests/ControlCommandContextTestStubs+SidebarBrowser.swift +++ b/Packages/macOS/CmuxControlSocket/Tests/CmuxControlSocketTests/ControlCommandContextTestStubs+SidebarBrowser.swift @@ -58,7 +58,8 @@ extension ControlSidebarContext { priority: Int, format: ControlSidebarMetadataFormat, panelID: UUID?, - pid: Int32? + pid: Int32?, + dynamicAgentRowKey: Bool ) {} nonisolated func controlSidebarScheduleStatusClear(target: ControlSidebarTabTarget, key: String) {} diff --git a/Resources/Localizable.xcstrings b/Resources/Localizable.xcstrings index 4a3e346e9ec4..887b761f684b 100644 --- a/Resources/Localizable.xcstrings +++ b/Resources/Localizable.xcstrings @@ -31374,6 +31374,93 @@ } } }, + "cli.error.workspaceLoadingInvalidId": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Invalid --id '%@'. Use letters, digits, '.', '_', or '-' (no spaces)." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "無効な --id '%@' です。英数字、'.'、'_'、'-' のみ使用できます(空白不可)。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "잘못된 --id '%@'입니다. 영문자, 숫자, '.', '_', '-'만 사용할 수 있습니다(공백 불가)." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Неприпустимий --id '%@'. Використовуйте літери, цифри, '.', '_' або '-' (без пробілів)." + } + } + } + }, + "cli.error.workspaceLoadingInvalidState": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Invalid state '%@'. Expected on or off. %@" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "無効な状態 '%@' です。on または off を指定してください。%@" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "잘못된 상태 '%@'입니다. on 또는 off를 지정하세요. %@" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Неприпустимий стан '%@'. Очікується on або off. %@" + } + } + } + }, + "cli.error.workspaceLoadingNoWorkspace": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "No workspace resolved. Run inside a cmux workspace or pass --workspace ." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ワークスペースを特定できませんでした。cmux のワークスペース内で実行するか、--workspace を指定してください。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "워크스페이스를 확인할 수 없습니다. cmux 워크스페이스 안에서 실행하거나 --workspace 를 지정하세요." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Не вдалося визначити робочий простір. Запустіть у робочому просторі cmux або передайте --workspace ." + } + } + } + }, "cli.error.workspaceSubcommandRequired": { "extractionState": "manual", "localizations": { @@ -43745,89 +43832,31 @@ } } }, - "cli.error.workspaceLoadingInvalidId": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Invalid --id '%@'. Use letters, digits, '.', '_', or '-' (no spaces)." - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "無効な --id '%@' です。英数字、'.'、'_'、'-' のみ使用できます(空白不可)。" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "잘못된 --id '%@'입니다. 영문자, 숫자, '.', '_', '-'만 사용할 수 있습니다(공백 불가)." - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Неприпустимий --id '%@'. Використовуйте літери, цифри, '.', '_' або '-' (без пробілів)." - } - } - } - }, - "cli.error.workspaceLoadingInvalidState": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Invalid state '%@'. Expected on or off. %@" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "無効な状態 '%@' です。on または off を指定してください。%@" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "잘못된 상태 '%@'입니다. on 또는 off를 지정하세요. %@" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Неприпустимий стан '%@'. Очікується on або off. %@" - } - } - } - }, - "cli.error.workspaceLoadingNoWorkspace": { + "cli.workspace.usage": { "extractionState": "manual", "localizations": { "en": { "stringUnit": { "state": "translated", - "value": "No workspace resolved. Run inside a cmux workspace or pass --workspace ." + "value": "Usage: cmux workspace [flags]\n\nCanonical noun for workspace operations. Legacy verbs\n(new-workspace, list-workspaces, close-workspace,\nrename-workspace, select-workspace) keep working and print a\none-time deprecation hint pointing here.\n\nSubcommands:\n list List workspaces in a window\n create [flags] Create a workspace (same flags as new-workspace,\n including --env KEY=VALUE and --env-file )\n env [workspace] [--mask]\n Print a workspace's configured environment\n variables (--mask redacts the values)\n close Close a workspace\n rename --title \n select Make a workspace active\n reconnect [workspace] Reconnect a remote (SSH) workspace, including one\n whose automatic reconnect paused because the host\n was unreachable\n disconnect [workspace] Stop a remote (SSH) workspace's connection\n loading [--id ]\n Toggle the workspace's loading spinner. Each --id\n is a separate loader that stacks; omit for one\n default loader.\n group Workspace group operations (see cmux workspace-group --help)\n\nenv/reconnect/disconnect accept a positional handle or --workspace\n, defaulting to the caller's workspace, then the\nselected one (of --window's window when given).\n\nExamples:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" } }, "ja": { "stringUnit": { "state": "translated", - "value": "ワークスペースを特定できませんでした。cmux のワークスペース内で実行するか、--workspace を指定してください。" + "value": "使い方: cmux workspace <サブコマンド> [フラグ]\n\nワークスペース操作の正規の名前空間です。従来の動詞コマンド\n(new-workspace、list-workspaces、close-workspace、\nrename-workspace、select-workspace) は引き続き動作し、ここを指す\n非推奨ヒントを一度だけ表示します。\n\nサブコマンド:\n list ウィンドウ内のワークスペースを一覧表示\n create [flags] ワークスペースを作成 (new-workspace と同じフラグ。\n --env KEY=VALUE と --env-file を含む)\n env [workspace] [--mask]\n ワークスペースに設定された環境変数を表示\n (--mask は値を伏せ字にします)\n close ワークスペースを閉じる\n rename --title \n select ワークスペースをアクティブにする\n reconnect [workspace] リモート (SSH) ワークスペースを再接続。ホストに\n 到達できず自動再接続が一時停止したものも含む\n disconnect [workspace] リモート (SSH) ワークスペースの接続を停止\n loading [--id ]\n ワークスペースの読み込みスピナーを切り替え。--id ごとに\n 別のローダーとして積み重なり、省略時は既定の 1 つを\n 切り替えます\n group ワークスペースグループ操作 (cmux workspace-group --help を参照)\n\nenv/reconnect/disconnect は位置引数のハンドルまたは --workspace\n を受け付け、省略時は呼び出し元のワークスペース、\n次に選択中のワークスペース (--window 指定時はそのウィンドウ) を\n対象にします。\n\n例:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" } }, "ko": { "stringUnit": { "state": "translated", - "value": "워크스페이스를 확인할 수 없습니다. cmux 워크스페이스 안에서 실행하거나 --workspace 를 지정하세요." + "value": "사용법: cmux workspace <하위 명령> [플래그]\n\n워크스페이스 작업의 표준 네임스페이스입니다. 기존 동사형 명령\n(new-workspace, list-workspaces, close-workspace,\nrename-workspace, select-workspace)은 계속 작동하며 이곳을\n가리키는 사용 중단 안내를 한 번 표시합니다.\n\n하위 명령:\n list 창의 워크스페이스 목록 표시\n create [flags] 워크스페이스 생성 (new-workspace와 동일한 플래그.\n --env KEY=VALUE 및 --env-file 포함)\n env [workspace] [--mask]\n 워크스페이스에 설정된 환경 변수 표시\n (--mask는 값을 가립니다)\n close 워크스페이스 닫기\n rename --title \n select 워크스페이스를 활성화\n reconnect [workspace] 원격 (SSH) 워크스페이스 재연결. 호스트에 연결할\n 수 없어 자동 재연결이 일시 중지된 경우 포함\n disconnect [workspace] 원격 (SSH) 워크스페이스 연결 중지\n loading [--id ]\n 워크스페이스 로딩 스피너 전환. --id마다 별도의\n 로더로 누적되며, 생략 시 기본 로더 하나를 전환\n group 워크스페이스 그룹 작업 (cmux workspace-group --help 참고)\n\nenv/reconnect/disconnect는 위치 핸들 또는 --workspace\n를 받으며, 기본값은 호출자의 워크스페이스, 그다음\n선택된 워크스페이스입니다 (--window 지정 시 해당 창 기준).\n\n예시:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" } }, "uk": { "stringUnit": { "state": "translated", - "value": "Не вдалося визначити робочий простір. Запустіть у робочому просторі cmux або передайте --workspace ." + "value": "Використання: cmux workspace <підкоманда> [прапорці]\n\nКанонічний простір імен для операцій з робочими просторами.\nЗастарілі дієслівні команди (new-workspace, list-workspaces,\nclose-workspace, rename-workspace, select-workspace) продовжують\nпрацювати й одноразово показують підказку про застарілість, що\nвказує сюди.\n\nПідкоманди:\n list Список робочих просторів у вікні\n create [flags] Створити робочий простір (ті самі прапорці, що й\n new-workspace, зокрема --env KEY=VALUE та --env-file )\n env [workspace] [--mask]\n Показати налаштовані змінні середовища робочого\n простору (--mask приховує значення)\n close Закрити робочий простір\n rename --title \n select Зробити робочий простір активним\n reconnect [workspace] Перепідключити віддалений (SSH) робочий простір,\n зокрема той, де автоматичне перепідключення\n призупинено через недосяжний хост\n disconnect [workspace] Зупинити з'єднання віддаленого (SSH) робочого простору\n loading [--id ]\n Перемкнути індикатор завантаження робочого простору.\n Кожен --id — окремий лоадер; без --id перемикається\n один типовий\n group Операції з групами робочих просторів (див. cmux workspace-group --help)\n\nenv/reconnect/disconnect приймають позиційний дескриптор або --workspace\n; типово використовується робочий простір викликача,\nдалі — вибраний (у вікні з --window, якщо задано).\n\nПриклади:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" } } } @@ -43861,1582 +43890,6 @@ } } }, - "settings.app.loadingSpinnerPosition": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "موضع مؤشر التحميل" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Pozicija indikatora učitavanja" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Placering af indlæsningsindikator" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Position des Ladeindikators" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Loading Spinner Position" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Posición del indicador de carga" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Position de l’indicateur de chargement" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Posizione dell’indicatore di caricamento" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "読み込みスピナーの位置" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "로딩 스피너 위치" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Plassering av lasteindikator" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Pozycja wskaźnika ładowania" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Posição do indicador de carregamento" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Положение индикатора загрузки" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "ตำแหน่งตัวบ่งชี้การโหลด" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Yükleme göstergesi konumu" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Розташування індикатора завантаження" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "加载指示器位置" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "載入指示器位置" - } - } - } - }, - "settings.app.loadingSpinnerPosition.left": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "يسار" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Lijevo" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Venstre" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Links" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Left" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Izquierda" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Gauche" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Sinistra" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "左" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "왼쪽" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Venstre" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Lewo" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Esquerda" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Слева" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "ซ้าย" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Sol" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Ліворуч" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "左" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "左" - } - } - } - }, - "settings.app.loadingSpinnerPosition.right": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "يمين" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Desno" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Højre" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Rechts" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Right" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Derecha" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Droite" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Destra" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "右" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "오른쪽" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Høyre" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Prawo" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Direita" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Справа" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "ขวา" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Sağ" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Праворуч" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "右" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "右" - } - } - } - }, - "settings.app.loadingSpinnerPosition.subtitle": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "إظهار المؤشر على يسار صف مساحة العمل (بمشاركة موضع شارة غير المقروء) أو على يمينه." - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Prikazuje indikator lijevo (dijeli mjesto sa značkom nepročitanog) ili desno u redu radnog prostora." - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Viser indikatoren til venstre (deler plads med ulæst-mærket) eller til højre i arbejdsområdets række." - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Zeigt den Indikator links (teilt den Platz mit der Ungelesen-Plakette) oder rechts in der Arbeitsbereichszeile." - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Show the spinner on the left (sharing the unread badge slot) or the right of the workspace row." - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Muestra el indicador a la izquierda (compartiendo el espacio de la insignia de no leídos) o a la derecha de la fila del espacio de trabajo." - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Affiche l’indicateur à gauche (partageant l’emplacement du badge non lu) ou à droite de la ligne de l’espace de travail." - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Mostra l’indicatore a sinistra (condividendo lo spazio del badge non letti) o a destra della riga dello spazio di lavoro." - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "スピナーをワークスペース行の左(未読バッジの位置を共有)または右に表示します。" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "워크스페이스 행의 왼쪽(읽지 않음 배지 자리 공유) 또는 오른쪽에 스피너를 표시합니다." - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Viser indikatoren til venstre (deler plass med ulest-merket) eller til høyre i arbeidsområderaden." - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Pokazuje wskaźnik po lewej stronie (współdzieląc miejsce z plakietką nieprzeczytanych) lub po prawej stronie wiersza obszaru roboczego." - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Mostra o indicador à esquerda (compartilhando o espaço do selo de não lidos) ou à direita da linha do espaço de trabalho." - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Показывает индикатор слева (совместно со значком непрочитанного) или справа в строке рабочего пространства." - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "แสดงตัวบ่งชี้ทางซ้าย (ใช้ตำแหน่งเดียวกับป้ายยังไม่ได้อ่าน) หรือทางขวาของแถวเวิร์กสเปซ" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Göstergeyi çalışma alanı satırının solunda (okunmamış rozetiyle aynı yeri paylaşır) veya sağında gösterir." - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Показує індикатор ліворуч (спільно зі значком непрочитаного) або праворуч у рядку робочого простору." - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "在工作区行的左侧(与未读标记共用位置)或右侧显示指示器。" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "在工作區列的左側(與未讀標記共用位置)或右側顯示指示器。" - } - } - } - }, - "settings.app.notificationBadgePosition": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "موضع شارة الإشعارات" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Pozicija značke obavijesti" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Placering af notifikationsmærke" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Position der Benachrichtigungsplakette" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Notification Badge Position" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Posición de la insignia de notificaciones" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Position du badge de notification" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Posizione del badge di notifica" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "通知バッジの位置" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "알림 배지 위치" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Plassering av varselmerke" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Pozycja plakietki powiadomień" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Posição do selo de notificação" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Положение значка уведомлений" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "ตำแหน่งป้ายการแจ้งเตือน" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Bildirim rozeti konumu" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Розташування значка сповіщень" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "通知标记位置" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "通知標記位置" - } - } - } - }, - "settings.app.notificationBadgePosition.subtitle": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "إظهار شارة الإشعارات غير المقروءة على يسار صف مساحة العمل أو على يمينه." - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Prikazuje značku nepročitanih obavijesti lijevo ili desno u redu radnog prostora." - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Viser ulæst-notifikationsmærket til venstre eller højre i arbejdsområdets række." - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Zeigt die Ungelesen-Plakette links oder rechts in der Arbeitsbereichszeile." - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Show the unread notification badge on the left or the right of the workspace row." - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Muestra la insignia de notificaciones no leídas a la izquierda o a la derecha de la fila del espacio de trabajo." - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Affiche le badge de notifications non lues à gauche ou à droite de la ligne de l’espace de travail." - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Mostra il badge delle notifiche non lette a sinistra o a destra della riga dello spazio di lavoro." - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "未読通知バッジをワークスペース行の左または右に表示します。" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "읽지 않은 알림 배지를 워크스페이스 행의 왼쪽 또는 오른쪽에 표시합니다." - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Viser ulest-varselmerket til venstre eller høyre i arbeidsområderaden." - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Pokazuje plakietkę nieprzeczytanych powiadomień po lewej lub prawej stronie wiersza obszaru roboczego." - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Mostra o selo de notificações não lidas à esquerda ou à direita da linha do espaço de trabalho." - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Показывает значок непрочитанных уведомлений слева или справа в строке рабочего пространства." - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "แสดงป้ายการแจ้งเตือนที่ยังไม่ได้อ่านทางซ้ายหรือทางขวาของแถวเวิร์กสเปซ" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Okunmamış bildirim rozetini çalışma alanı satırının solunda veya sağında gösterir." - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Показує значок непрочитаних сповіщень ліворуч або праворуч у рядку робочого простору." - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "在工作区行的左侧或右侧显示未读通知标记。" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "在工作區列的左側或右側顯示未讀通知標記。" - } - } - } - }, - "settings.app.showAgentActivity": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "إظهار مؤشر التحميل" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Prikaži indikator učitavanja" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Vis indlæsningsindikator" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Ladeindikator anzeigen" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Show Loading Spinner" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Mostrar indicador de carga" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Afficher l’indicateur de chargement" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Mostra indicatore di caricamento" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "読み込みスピナーを表示" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "로딩 스피너 표시" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Vis lasteindikator" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Pokaż wskaźnik ładowania" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Mostrar indicador de carregamento" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Показывать индикатор загрузки" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "แสดงตัวบ่งชี้การโหลด" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Yükleme göstergesini göster" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Показувати індикатор завантаження" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "显示加载指示器" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "顯示載入指示器" - } - } - } - }, - "settings.app.showAgentActivity.subtitle": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "إظهار مؤشر تحميل على مساحات العمل التي بها وكلاء برمجة قيد التشغيل أو عمليات تحميل نشطة. يبقى ظاهرًا حتى عند إخفاء تفاصيل الشريط الجانبي." - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Prikazuje indikator učitavanja na radnim prostorima s pokrenutim agentima za kodiranje ili aktivnim učitavanjima. Ostaje vidljiv i kada su detalji bočne trake skriveni." - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Viser en indlæsningsindikator på arbejdsområder med kørende kodningsagenter eller aktive indlæsninger. Forbliver synlig, selv når sidepanelets detaljer er skjult." - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Zeigt einen Ladeindikator auf Arbeitsbereichen mit laufenden Coding-Agenten oder aktiven Ladevorgängen. Bleibt sichtbar, auch wenn Seitenleisten-Details ausgeblendet sind." - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Show a loading spinner on workspaces with running coding agents or active loaders. Stays visible even when sidebar details are hidden." - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Muestra un indicador de carga en los espacios de trabajo con agentes de código en ejecución o cargas activas. Permanece visible incluso cuando los detalles de la barra lateral están ocultos." - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Affiche un indicateur de chargement sur les espaces de travail avec des agents de codage en cours ou des chargements actifs. Reste visible même lorsque les détails de la barre latérale sont masqués." - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Mostra un indicatore di caricamento negli spazi di lavoro con agenti di codifica in esecuzione o caricamenti attivi. Rimane visibile anche quando i dettagli della barra laterale sono nascosti." - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "実行中のコーディングエージェントまたはアクティブなローダーがあるワークスペースに読み込みスピナーを表示します。サイドバーの詳細を非表示にしても表示され続けます。" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "실행 중인 코딩 에이전트 또는 활성 로더가 있는 워크스페이스에 로딩 스피너를 표시합니다. 사이드바 세부 정보를 숨겨도 계속 표시됩니다." - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Viser en lasteindikator på arbeidsområder med aktive kodeagenter eller aktive lastinger. Forblir synlig selv når sidefeltdetaljer er skjult." - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Pokazuje wskaźnik ładowania w obszarach roboczych z uruchomionymi agentami kodowania lub aktywnymi ładowaniami. Pozostaje widoczny nawet po ukryciu szczegółów paska bocznego." - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Mostra um indicador de carregamento nos espaços de trabalho com agentes de codificação em execução ou carregamentos ativos. Permanece visível mesmo quando os detalhes da barra lateral estão ocultos." - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Показывает индикатор загрузки в рабочих пространствах с запущенными агентами кодирования или активными загрузками. Остаётся видимым, даже если детали боковой панели скрыты." - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "แสดงตัวบ่งชี้การโหลดบนเวิร์กสเปซที่มีเอเจนต์เขียนโค้ดกำลังทำงานหรือมีการโหลดที่ใช้งานอยู่ ยังคงแสดงแม้ซ่อนรายละเอียดแถบด้านข้าง" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Çalışan kodlama aracıları veya etkin yüklemeler olan çalışma alanlarında bir yükleme göstergesi gösterir. Kenar çubuğu ayrıntıları gizliyken bile görünür kalır." - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Показує індикатор завантаження в робочих просторах із запущеними агентами кодування або активними завантаженнями. Залишається видимим, навіть якщо деталі бічної панелі приховано." - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "在有正在运行的编码代理或活动加载任务的工作区上显示加载指示器。即使隐藏侧边栏详细信息也会保持显示。" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "在有執行中的編碼代理或作用中載入工作的工作區上顯示載入指示器。即使隱藏側邊欄詳細資訊也會保持顯示。" - } - } - } - }, - "settings.search.alias.setting.app.loading-spinner-position": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace تحميل مؤشر يسار يمين موضع" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace učitavanje indikator lijevo desno pozicija" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace indlæsning indikator venstre højre placering" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace laden Indikator links rechts Position" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace carga indicador izquierda derecha posición" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace chargement indicateur gauche droite position" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace caricamento indicatore sinistra destra posizione" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 読み込み スピナー 位置 左 右 サイド" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 로딩 스피너 왼쪽 오른쪽 위치" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace lasting indikator venstre høyre plassering" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace ładowanie wskaźnik lewo prawo pozycja" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace carregamento indicador esquerda direita posição" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace загрузка индикатор слева справа положение" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace โหลด ตัวบ่งชี้ ซ้าย ขวา ตำแหน่ง" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace yükleme gösterge sol sağ konum" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace завантаження індикатор ліворуч праворуч розташування" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 加载 指示器 左 右 位置" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 載入 指示器 左 右 位置" - } - } - } - }, - "settings.search.alias.setting.app.notification-badge-position": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace تحميل مؤشر يسار يمين موضع" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace učitavanje indikator lijevo desno pozicija" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace indlæsning indikator venstre højre placering" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace laden Indikator links rechts Position" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace carga indicador izquierda derecha posición" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace chargement indicateur gauche droite position" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace caricamento indicatore sinistra destra posizione" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 通知 未読 バッジ 位置 左 右 サイド" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 로딩 스피너 왼쪽 오른쪽 위치" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace lasting indikator venstre høyre plassering" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace ładowanie wskaźnik lewo prawo pozycja" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace carregamento indicador esquerda direita posição" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace загрузка индикатор слева справа положение" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace โหลด ตัวบ่งชี้ ซ้าย ขวา ตำแหน่ง" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace yükleme gösterge sol sağ konum" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace завантаження індикатор ліворуч праворуч розташування" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 加载 指示器 左 右 位置" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 載入 指示器 左 右 位置" - } - } - } - }, - "settings.search.alias.setting.app.show-agent-activity": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity تحميل مؤشر يسار يمين موضع" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity učitavanje indikator lijevo desno pozicija" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity indlæsning indikator venstre højre placering" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity laden Indikator links rechts Position" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity carga indicador izquierda derecha posición" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity chargement indicateur gauche droite position" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity caricamento indicatore sinistra destra posizione" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 読み込み スピナー アクティブ コーディング エージェント 実行中 アクティビティ" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 로딩 스피너 왼쪽 오른쪽 위치" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity lasting indikator venstre høyre plassering" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity ładowanie wskaźnik lewo prawo pozycja" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity carregamento indicador esquerda direita posição" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity загрузка индикатор слева справа положение" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity โหลด ตัวบ่งชี้ ซ้าย ขวา ตำแหน่ง" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity yükleme gösterge sol sağ konum" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity завантаження індикатор ліворуч праворуч розташування" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 加载 指示器 左 右 位置" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 載入 指示器 左 右 位置" - } - } - } - }, - "sidebar.agentActivity.tooltip.many": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "جارٍ التحميل (%lld مهام نشطة)" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Učitavanje (%lld aktivnih zadataka)" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Indlæser (%lld aktive opgaver)" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Wird geladen (%lld aktive Aufgaben)" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Loading (%lld active tasks)" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Cargando (%lld tareas activas)" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Chargement (%lld tâches actives)" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Caricamento (%lld attività attive)" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "読み込み中(アクティブなタスク %lld 件)" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "로딩 중(활성 작업 %lld개)" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Laster (%lld aktive oppgaver)" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Ładowanie (%lld aktywnych zadań)" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Carregando (%lld tarefas ativas)" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Загрузка (%lld активных задач)" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "กำลังโหลด (งานที่ทำงานอยู่ %lld รายการ)" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Yükleniyor (%lld etkin görev)" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Завантаження (%lld активних завдань)" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "正在加载(%lld 个活跃任务)" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "正在載入(%lld 個作用中任務)" - } - } - } - }, - "sidebar.agentActivity.tooltip.one": { - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "translated", - "value": "جارٍ التحميل (مهمة نشطة واحدة)" - } - }, - "bs": { - "stringUnit": { - "state": "translated", - "value": "Učitavanje (1 aktivan zadatak)" - } - }, - "da": { - "stringUnit": { - "state": "translated", - "value": "Indlæser (1 aktiv opgave)" - } - }, - "de": { - "stringUnit": { - "state": "translated", - "value": "Wird geladen (1 aktive Aufgabe)" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Loading (1 active task)" - } - }, - "es": { - "stringUnit": { - "state": "translated", - "value": "Cargando (1 tarea activa)" - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Chargement (1 tâche active)" - } - }, - "it": { - "stringUnit": { - "state": "translated", - "value": "Caricamento (1 attività attiva)" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "読み込み中(アクティブなタスク 1 件)" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "로딩 중(활성 작업 1개)" - } - }, - "nb": { - "stringUnit": { - "state": "translated", - "value": "Laster (1 aktiv oppgave)" - } - }, - "pl": { - "stringUnit": { - "state": "translated", - "value": "Ładowanie (1 aktywne zadanie)" - } - }, - "pt-BR": { - "stringUnit": { - "state": "translated", - "value": "Carregando (1 tarefa ativa)" - } - }, - "ru": { - "stringUnit": { - "state": "translated", - "value": "Загрузка (1 активная задача)" - } - }, - "th": { - "stringUnit": { - "state": "translated", - "value": "กำลังโหลด (งานที่ทำงานอยู่ 1 รายการ)" - } - }, - "tr": { - "stringUnit": { - "state": "translated", - "value": "Yükleniyor (1 etkin görev)" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Завантаження (1 активне завдання)" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "translated", - "value": "正在加载(1 个活跃任务)" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "translated", - "value": "正在載入(1 個作用中任務)" - } - } - } - }, - "cli.workspace.usage": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Usage: cmux workspace [flags]\n\nCanonical noun for workspace operations. Legacy verbs\n(new-workspace, list-workspaces, close-workspace,\nrename-workspace, select-workspace) keep working and print a\none-time deprecation hint pointing here.\n\nSubcommands:\n list List workspaces in a window\n create [flags] Create a workspace (same flags as new-workspace,\n including --env KEY=VALUE and --env-file )\n env [workspace] [--mask]\n Print a workspace's configured environment\n variables (--mask redacts the values)\n close Close a workspace\n rename --title \n select Make a workspace active\n reconnect [workspace] Reconnect a remote (SSH) workspace, including one\n whose automatic reconnect paused because the host\n was unreachable\n disconnect [workspace] Stop a remote (SSH) workspace's connection\n loading [--id ]\n Toggle the workspace's loading spinner. Each --id\n is a separate loader that stacks; omit for one\n default loader.\n group Workspace group operations (see cmux workspace-group --help)\n\nenv/reconnect/disconnect accept a positional handle or --workspace\n, defaulting to the caller's workspace, then the\nselected one (of --window's window when given).\n\nExamples:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "使い方: cmux workspace <サブコマンド> [フラグ]\n\nワークスペース操作の正規の名前空間です。従来の動詞コマンド\n(new-workspace、list-workspaces、close-workspace、\nrename-workspace、select-workspace) は引き続き動作し、ここを指す\n非推奨ヒントを一度だけ表示します。\n\nサブコマンド:\n list ウィンドウ内のワークスペースを一覧表示\n create [flags] ワークスペースを作成 (new-workspace と同じフラグ。\n --env KEY=VALUE と --env-file を含む)\n env [workspace] [--mask]\n ワークスペースに設定された環境変数を表示\n (--mask は値を伏せ字にします)\n close ワークスペースを閉じる\n rename --title \n select ワークスペースをアクティブにする\n reconnect [workspace] リモート (SSH) ワークスペースを再接続。ホストに\n 到達できず自動再接続が一時停止したものも含む\n disconnect [workspace] リモート (SSH) ワークスペースの接続を停止\n loading [--id ]\n ワークスペースの読み込みスピナーを切り替え。--id ごとに\n 別のローダーとして積み重なり、省略時は既定の 1 つを\n 切り替えます\n group ワークスペースグループ操作 (cmux workspace-group --help を参照)\n\nenv/reconnect/disconnect は位置引数のハンドルまたは --workspace\n を受け付け、省略時は呼び出し元のワークスペース、\n次に選択中のワークスペース (--window 指定時はそのウィンドウ) を\n対象にします。\n\n例:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" - } - }, - "ko": { - "stringUnit": { - "state": "translated", - "value": "사용법: cmux workspace <하위 명령> [플래그]\n\n워크스페이스 작업의 표준 네임스페이스입니다. 기존 동사형 명령\n(new-workspace, list-workspaces, close-workspace,\nrename-workspace, select-workspace)은 계속 작동하며 이곳을\n가리키는 사용 중단 안내를 한 번 표시합니다.\n\n하위 명령:\n list 창의 워크스페이스 목록 표시\n create [flags] 워크스페이스 생성 (new-workspace와 동일한 플래그.\n --env KEY=VALUE 및 --env-file 포함)\n env [workspace] [--mask]\n 워크스페이스에 설정된 환경 변수 표시\n (--mask는 값을 가립니다)\n close 워크스페이스 닫기\n rename --title \n select 워크스페이스를 활성화\n reconnect [workspace] 원격 (SSH) 워크스페이스 재연결. 호스트에 연결할\n 수 없어 자동 재연결이 일시 중지된 경우 포함\n disconnect [workspace] 원격 (SSH) 워크스페이스 연결 중지\n loading [--id ]\n 워크스페이스 로딩 스피너 전환. --id마다 별도의\n 로더로 누적되며, 생략 시 기본 로더 하나를 전환\n group 워크스페이스 그룹 작업 (cmux workspace-group --help 참고)\n\nenv/reconnect/disconnect는 위치 핸들 또는 --workspace\n를 받으며, 기본값은 호출자의 워크스페이스, 그다음\n선택된 워크스페이스입니다 (--window 지정 시 해당 창 기준).\n\n예시:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" - } - }, - "uk": { - "stringUnit": { - "state": "translated", - "value": "Використання: cmux workspace <підкоманда> [прапорці]\n\nКанонічний простір імен для операцій з робочими просторами.\nЗастарілі дієслівні команди (new-workspace, list-workspaces,\nclose-workspace, rename-workspace, select-workspace) продовжують\nпрацювати й одноразово показують підказку про застарілість, що\nвказує сюди.\n\nПідкоманди:\n list Список робочих просторів у вікні\n create [flags] Створити робочий простір (ті самі прапорці, що й\n new-workspace, зокрема --env KEY=VALUE та --env-file )\n env [workspace] [--mask]\n Показати налаштовані змінні середовища робочого\n простору (--mask приховує значення)\n close Закрити робочий простір\n rename --title \n select Зробити робочий простір активним\n reconnect [workspace] Перепідключити віддалений (SSH) робочий простір,\n зокрема той, де автоматичне перепідключення\n призупинено через недосяжний хост\n disconnect [workspace] Зупинити з'єднання віддаленого (SSH) робочого простору\n loading [--id ]\n Перемкнути індикатор завантаження робочого простору.\n Кожен --id — окремий лоадер; без --id перемикається\n один типовий\n group Операції з групами робочих просторів (див. cmux workspace-group --help)\n\nenv/reconnect/disconnect приймають позиційний дескриптор або --workspace\n; типово використовується робочий простір викликача,\nдалі — вибраний (у вікні з --window, якщо задано).\n\nПриклади:\n cmux workspace list --json\n cmux workspace create --name Build --cwd ~/projects/myapp\n cmux workspace create --cwd . --env AWS_PROFILE=prod --env-file ./.cmux.env\n cmux workspace env workspace:3 --mask\n cmux workspace close workspace:3\n cmux workspace reconnect\n cmux workspace disconnect --workspace workspace:3\n cmux workspace loading on\n cmux workspace loading on --id build\n cmux workspace loading off" - } - } - } - }, "clipboard.sshError.item": { "extractionState": "manual", "localizations": { @@ -70802,6 +69255,363 @@ } } }, + "debug.agentRows.placement.belowBranch": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Below the branch line" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ブランチ行の下" + } + } + } + }, + "debug.agentRows.placement.header": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Accordion position (in-card variants)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "アコーディオンの位置(カード内バリアント)" + } + } + } + }, + "debug.agentRows.placement.top": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Top of card (under the title)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード上部(タイトルの下)" + } + } + } + }, + "debug.agentRows.variant.belowAccordion": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Below card · accordion" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード下・アコーディオン" + } + } + } + }, + "debug.agentRows.variant.belowAccordion.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Summary header folds the rows; each row is its own button." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "サマリーヘッダーで行を折りたたみ。各行は独立したボタン。" + } + } + } + }, + "debug.agentRows.variant.belowChips": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Below card · chips" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード下・チップ" + } + } + } + }, + "debug.agentRows.variant.belowChips.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Wrapping icon chips, one per agent." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェントごとに折り返すアイコンチップ。" + } + } + } + }, + "debug.agentRows.variant.belowFlat": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Below card · flat rows" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード下・フラット行" + } + } + } + }, + "debug.agentRows.variant.belowFlat.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Always-expanded rows, no header." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "常に展開された行。ヘッダーなし。" + } + } + } + }, + "debug.agentRows.variant.belowTree": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Below card · tree guide" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード下・ツリーガイド" + } + } + } + }, + "debug.agentRows.variant.belowTree.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Rows hang off a tree guide line under the workspace." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ワークスペース下のツリーガイド線に行をぶら下げる。" + } + } + } + }, + "debug.agentRows.variant.globalSection": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Global Agents section (sidebar bottom)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "グローバルなエージェント欄(サイドバー下部)" + } + } + } + }, + "debug.agentRows.variant.globalSection.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "No per-workspace rows; one Agents list at the sidebar bottom, grouped by workspace." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ワークスペースごとの行はなし。サイドバー下部にワークスペース別のエージェント一覧。" + } + } + } + }, + "debug.agentRows.variant.graphite": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Graphite prototype (picked)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "グラファイト試作(採用案)" + } + } + } + }, + "debug.agentRows.variant.graphite.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Graphite selection card, in-card accordion, accent bar on the active (focused) agent." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "グラファイトの選択カード、カード内アコーディオン、アクティブなエージェントにアクセントバー。" + } + } + } + }, + "debug.agentRows.variant.inCardCompact": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "In card · compact line" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード内・コンパクト行" + } + } + } + }, + "debug.agentRows.variant.inCardCompact.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "One dense line of brand icons and state dots in the card." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード内にアイコンと状態ドットを1行で凝縮。" + } + } + } + }, + "debug.agentRows.variant.inCardRows": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "In card · rows" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "カード内・行" + } + } + } + }, + "debug.agentRows.variant.inCardRows.detail": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Rows embedded inside the workspace card." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "ワークスペースカード内に行を埋め込み。" + } + } + } + }, + "debug.agentRows.window.caption": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Switches the per-agent sidebar rows live. The choice persists across relaunch." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェント行の表示をライブで切り替えます。選択は再起動後も保持されます。" + } + } + } + }, + "debug.agentRows.window.title": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Agent Rows Style" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェント行スタイル" + } + } + } + }, "debug.bonsplitTabBarDebug.actionLaneBorder": { "localizations": { "en": { @@ -71459,6 +70269,23 @@ } } }, + "debug.menu.agentRowsStyle": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Agent Rows Style…" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェント行スタイル…" + } + } + } + }, "debug.menu.bonsplitTabBarDebug": { "localizations": { "en": { @@ -100478,6 +99305,40 @@ } } }, + "featureFlags.agentChat.description": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Shows the Agent chat entrypoints in the new-workspace dropdown, command palette, and surface tab bar." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "新規ワークスペースのドロップダウン、コマンドパレット、サーフェスタブバーにエージェントチャットの入口を表示します。" + } + } + } + }, + "featureFlags.agentChat.title": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Agent chat UI" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェントチャットUI" + } + } + } + }, "featureFlags.clearAll": { "extractionState": "manual", "localizations": { @@ -100750,6 +99611,40 @@ } } }, + "featureFlags.sidebarAgentRows.description": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Shows one row per agent pane in the sidebar with live state, replacing the single status pill." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "サイドバーにエージェントのペインごとの行をライブ状態付きで表示し、単一のステータスピルを置き換えます。" + } + } + } + }, + "featureFlags.sidebarAgentRows.title": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Per-agent sidebar rows" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェントごとのサイドバー行" + } + } + } + }, "featureFlags.sidebarWorkspaceAgentSpinner.description": { "extractionState": "manual", "localizations": { @@ -125095,6 +123990,23 @@ } } }, + "notification.agentChat.serverUnavailable.subtitleLaunchFailed": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Could not start Agent Chat" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェントチャットを起動できませんでした" + } + } + } + }, "notification.agentChat.serverUnavailable.title": { "extractionState": "manual", "localizations": { @@ -129017,6 +127929,23 @@ } } }, + "proWelcome.workspace.title": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Welcome to cmux Pro" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "cmux Pro へようこそ" + } + } + } + }, "projectSchemes.badge.personal": { "extractionState": "manual", "localizations": { @@ -129272,23 +128201,6 @@ } } }, - "proWelcome.workspace.title": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Welcome to cmux Pro" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "cmux Pro へようこそ" - } - } - } - }, "relativeTime.days": { "extractionState": "manual", "localizations": { @@ -139825,6 +138737,482 @@ } } }, + "settings.app.loadingSpinnerPosition": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "موضع مؤشر التحميل" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Pozicija indikatora učitavanja" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Placering af indlæsningsindikator" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Position des Ladeindikators" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Loading Spinner Position" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Posición del indicador de carga" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Position de l’indicateur de chargement" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Posizione dell’indicatore di caricamento" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "読み込みスピナーの位置" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "로딩 스피너 위치" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Plassering av lasteindikator" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Pozycja wskaźnika ładowania" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Posição do indicador de carregamento" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Положение индикатора загрузки" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "ตำแหน่งตัวบ่งชี้การโหลด" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Yükleme göstergesi konumu" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Розташування індикатора завантаження" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "加载指示器位置" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "載入指示器位置" + } + } + } + }, + "settings.app.loadingSpinnerPosition.left": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "يسار" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Lijevo" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Venstre" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Links" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Left" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Izquierda" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Gauche" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Sinistra" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "左" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "왼쪽" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Venstre" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Lewo" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Esquerda" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Слева" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "ซ้าย" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Sol" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Ліворуч" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "左" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "左" + } + } + } + }, + "settings.app.loadingSpinnerPosition.right": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "يمين" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Desno" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Højre" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Rechts" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Right" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Derecha" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Droite" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Destra" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "右" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "오른쪽" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Høyre" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Prawo" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Direita" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Справа" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "ขวา" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Sağ" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Праворуч" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "右" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "右" + } + } + } + }, + "settings.app.loadingSpinnerPosition.subtitle": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "إظهار المؤشر على يسار صف مساحة العمل (بمشاركة موضع شارة غير المقروء) أو على يمينه." + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Prikazuje indikator lijevo (dijeli mjesto sa značkom nepročitanog) ili desno u redu radnog prostora." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Viser indikatoren til venstre (deler plads med ulæst-mærket) eller til højre i arbejdsområdets række." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Zeigt den Indikator links (teilt den Platz mit der Ungelesen-Plakette) oder rechts in der Arbeitsbereichszeile." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Show the spinner on the left (sharing the unread badge slot) or the right of the workspace row." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Muestra el indicador a la izquierda (compartiendo el espacio de la insignia de no leídos) o a la derecha de la fila del espacio de trabajo." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Affiche l’indicateur à gauche (partageant l’emplacement du badge non lu) ou à droite de la ligne de l’espace de travail." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Mostra l’indicatore a sinistra (condividendo lo spazio del badge non letti) o a destra della riga dello spazio di lavoro." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "スピナーをワークスペース行の左(未読バッジの位置を共有)または右に表示します。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "워크스페이스 행의 왼쪽(읽지 않음 배지 자리 공유) 또는 오른쪽에 스피너를 표시합니다." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Viser indikatoren til venstre (deler plass med ulest-merket) eller til høyre i arbeidsområderaden." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Pokazuje wskaźnik po lewej stronie (współdzieląc miejsce z plakietką nieprzeczytanych) lub po prawej stronie wiersza obszaru roboczego." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Mostra o indicador à esquerda (compartilhando o espaço do selo de não lidos) ou à direita da linha do espaço de trabalho." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Показывает индикатор слева (совместно со значком непрочитанного) или справа в строке рабочего пространства." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "แสดงตัวบ่งชี้ทางซ้าย (ใช้ตำแหน่งเดียวกับป้ายยังไม่ได้อ่าน) หรือทางขวาของแถวเวิร์กสเปซ" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Göstergeyi çalışma alanı satırının solunda (okunmamış rozetiyle aynı yeri paylaşır) veya sağında gösterir." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Показує індикатор ліворуч (спільно зі значком непрочитаного) або праворуч у рядку робочого простору." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "在工作区行的左侧(与未读标记共用位置)或右侧显示指示器。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "在工作區列的左側(與未讀標記共用位置)或右側顯示指示器。" + } + } + } + }, "settings.app.makeSidebarPullRequestClickable": { "extractionState": "manual", "localizations": { @@ -140422,6 +139810,244 @@ } } }, + "settings.app.notificationBadgePosition": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "موضع شارة الإشعارات" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Pozicija značke obavijesti" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Placering af notifikationsmærke" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Position der Benachrichtigungsplakette" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Notification Badge Position" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Posición de la insignia de notificaciones" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Position du badge de notification" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Posizione del badge di notifica" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "通知バッジの位置" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "알림 배지 위치" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Plassering av varselmerke" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Pozycja plakietki powiadomień" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Posição do selo de notificação" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Положение значка уведомлений" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "ตำแหน่งป้ายการแจ้งเตือน" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Bildirim rozeti konumu" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Розташування значка сповіщень" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "通知标记位置" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "通知標記位置" + } + } + } + }, + "settings.app.notificationBadgePosition.subtitle": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "إظهار شارة الإشعارات غير المقروءة على يسار صف مساحة العمل أو على يمينه." + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Prikazuje značku nepročitanih obavijesti lijevo ili desno u redu radnog prostora." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Viser ulæst-notifikationsmærket til venstre eller højre i arbejdsområdets række." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Zeigt die Ungelesen-Plakette links oder rechts in der Arbeitsbereichszeile." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Show the unread notification badge on the left or the right of the workspace row." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Muestra la insignia de notificaciones no leídas a la izquierda o a la derecha de la fila del espacio de trabajo." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Affiche le badge de notifications non lues à gauche ou à droite de la ligne de l’espace de travail." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Mostra il badge delle notifiche non lette a sinistra o a destra della riga dello spazio di lavoro." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "未読通知バッジをワークスペース行の左または右に表示します。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "읽지 않은 알림 배지를 워크스페이스 행의 왼쪽 또는 오른쪽에 표시합니다." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Viser ulest-varselmerket til venstre eller høyre i arbeidsområderaden." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Pokazuje plakietkę nieprzeczytanych powiadomień po lewej lub prawej stronie wiersza obszaru roboczego." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Mostra o selo de notificações não lidas à esquerda ou à direita da linha do espaço de trabalho." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Показывает значок непрочитанных уведомлений слева или справа в строке рабочего пространства." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "แสดงป้ายการแจ้งเตือนที่ยังไม่ได้อ่านทางซ้ายหรือทางขวาของแถวเวิร์กสเปซ" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Okunmamış bildirim rozetini çalışma alanı satırının solunda veya sağında gösterir." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Показує значок непрочитаних сповіщень ліворуч або праворуч у рядку робочого простору." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "在工作区行的左侧或右侧显示未读通知标记。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "在工作區列的左側或右側顯示未讀通知標記。" + } + } + } + }, "settings.app.openMarkdownInCmuxViewer": { "extractionState": "manual", "localizations": { @@ -142129,6 +141755,244 @@ } } }, + "settings.app.showAgentActivity": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "إظهار مؤشر التحميل" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Prikaži indikator učitavanja" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Vis indlæsningsindikator" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Ladeindikator anzeigen" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Show Loading Spinner" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Mostrar indicador de carga" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Afficher l’indicateur de chargement" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Mostra indicatore di caricamento" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "読み込みスピナーを表示" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "로딩 스피너 표시" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Vis lasteindikator" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Pokaż wskaźnik ładowania" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Mostrar indicador de carregamento" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Показывать индикатор загрузки" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "แสดงตัวบ่งชี้การโหลด" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Yükleme göstergesini göster" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Показувати індикатор завантаження" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "显示加载指示器" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "顯示載入指示器" + } + } + } + }, + "settings.app.showAgentActivity.subtitle": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "إظهار مؤشر تحميل على مساحات العمل التي بها وكلاء برمجة قيد التشغيل أو عمليات تحميل نشطة. يبقى ظاهرًا حتى عند إخفاء تفاصيل الشريط الجانبي." + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Prikazuje indikator učitavanja na radnim prostorima s pokrenutim agentima za kodiranje ili aktivnim učitavanjima. Ostaje vidljiv i kada su detalji bočne trake skriveni." + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Viser en indlæsningsindikator på arbejdsområder med kørende kodningsagenter eller aktive indlæsninger. Forbliver synlig, selv når sidepanelets detaljer er skjult." + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Zeigt einen Ladeindikator auf Arbeitsbereichen mit laufenden Coding-Agenten oder aktiven Ladevorgängen. Bleibt sichtbar, auch wenn Seitenleisten-Details ausgeblendet sind." + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Show a loading spinner on workspaces with running coding agents or active loaders. Stays visible even when sidebar details are hidden." + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Muestra un indicador de carga en los espacios de trabajo con agentes de código en ejecución o cargas activas. Permanece visible incluso cuando los detalles de la barra lateral están ocultos." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Affiche un indicateur de chargement sur les espaces de travail avec des agents de codage en cours ou des chargements actifs. Reste visible même lorsque les détails de la barre latérale sont masqués." + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Mostra un indicatore di caricamento negli spazi di lavoro con agenti di codifica in esecuzione o caricamenti attivi. Rimane visibile anche quando i dettagli della barra laterale sono nascosti." + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "実行中のコーディングエージェントまたはアクティブなローダーがあるワークスペースに読み込みスピナーを表示します。サイドバーの詳細を非表示にしても表示され続けます。" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "실행 중인 코딩 에이전트 또는 활성 로더가 있는 워크스페이스에 로딩 스피너를 표시합니다. 사이드바 세부 정보를 숨겨도 계속 표시됩니다." + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Viser en lasteindikator på arbeidsområder med aktive kodeagenter eller aktive lastinger. Forblir synlig selv når sidefeltdetaljer er skjult." + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Pokazuje wskaźnik ładowania w obszarach roboczych z uruchomionymi agentami kodowania lub aktywnymi ładowaniami. Pozostaje widoczny nawet po ukryciu szczegółów paska bocznego." + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Mostra um indicador de carregamento nos espaços de trabalho com agentes de codificação em execução ou carregamentos ativos. Permanece visível mesmo quando os detalhes da barra lateral estão ocultos." + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Показывает индикатор загрузки в рабочих пространствах с запущенными агентами кодирования или активными загрузками. Остаётся видимым, даже если детали боковой панели скрыты." + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "แสดงตัวบ่งชี้การโหลดบนเวิร์กสเปซที่มีเอเจนต์เขียนโค้ดกำลังทำงานหรือมีการโหลดที่ใช้งานอยู่ ยังคงแสดงแม้ซ่อนรายละเอียดแถบด้านข้าง" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Çalışan kodlama aracıları veya etkin yüklemeler olan çalışma alanlarında bir yükleme göstergesi gösterir. Kenar çubuğu ayrıntıları gizliyken bile görünür kalır." + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Показує індикатор завантаження в робочих просторах із запущеними агентами кодування або активними завантаженнями. Залишається видимим, навіть якщо деталі бічної панелі приховано." + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "在有正在运行的编码代理或活动加载任务的工作区上显示加载指示器。即使隐藏侧边栏详细信息也会保持显示。" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "在有執行中的編碼代理或作用中載入工作的工作區上顯示載入指示器。即使隱藏側邊欄詳細資訊也會保持顯示。" + } + } + } + }, "settings.app.showBranchDirectory": { "extractionState": "manual", "localizations": { @@ -166611,6 +166475,125 @@ } } }, + "settings.search.alias.setting.app.loading-spinner-position": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace تحميل مؤشر يسار يمين موضع" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace učitavanje indikator lijevo desno pozicija" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace indlæsning indikator venstre højre placering" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace laden Indikator links rechts Position" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace carga indicador izquierda derecha posición" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace chargement indicateur gauche droite position" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace caricamento indicatore sinistra destra posizione" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 読み込み スピナー 位置 左 右 サイド" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 로딩 스피너 왼쪽 오른쪽 위치" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace lasting indikator venstre høyre plassering" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace ładowanie wskaźnik lewo prawo pozycja" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace carregamento indicador esquerda direita posição" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace загрузка индикатор слева справа положение" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace โหลด ตัวบ่งชี้ ซ้าย ขวา ตำแหน่ง" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace yükleme gösterge sol sağ konum" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace завантаження індикатор ліворуч праворуч розташування" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 加载 指示器 左 右 位置" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "sidebar.loadingSpinnerPosition loading spinner position left right leading trailing side workspace 載入 指示器 左 右 位置" + } + } + } + }, "settings.search.alias.setting.app.markdown-font-family": { "extractionState": "manual", "localizations": { @@ -167138,6 +167121,125 @@ } } }, + "settings.search.alias.setting.app.notification-badge-position": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace تحميل مؤشر يسار يمين موضع" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace učitavanje indikator lijevo desno pozicija" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace indlæsning indikator venstre højre placering" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace laden Indikator links rechts Position" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace carga indicador izquierda derecha posición" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace chargement indicateur gauche droite position" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace caricamento indicatore sinistra destra posizione" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 通知 未読 バッジ 位置 左 右 サイド" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 로딩 스피너 왼쪽 오른쪽 위치" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace lasting indikator venstre høyre plassering" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace ładowanie wskaźnik lewo prawo pozycja" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace carregamento indicador esquerda direita posição" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace загрузка индикатор слева справа положение" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace โหลด ตัวบ่งชี้ ซ้าย ขวา ตำแหน่ง" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace yükleme gösterge sol sağ konum" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace завантаження індикатор ліворуч праворуч розташування" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 加载 指示器 左 右 位置" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "sidebar.notificationBadgePosition notification unread badge position left right leading trailing side workspace 載入 指示器 左 右 位置" + } + } + } + }, "settings.search.alias.setting.app.notification-command": { "extractionState": "manual", "localizations": { @@ -168209,6 +168311,125 @@ } } }, + "settings.search.alias.setting.app.show-agent-activity": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity تحميل مؤشر يسار يمين موضع" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity učitavanje indikator lijevo desno pozicija" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity indlæsning indikator venstre højre placering" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity laden Indikator links rechts Position" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity carga indicador izquierda derecha posición" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity chargement indicateur gauche droite position" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity caricamento indicatore sinistra destra posizione" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 読み込み スピナー アクティブ コーディング エージェント 実行中 アクティビティ" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 로딩 스피너 왼쪽 오른쪽 위치" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity lasting indikator venstre høyre plassering" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity ładowanie wskaźnik lewo prawo pozycja" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity carregamento indicador esquerda direita posição" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity загрузка индикатор слева справа положение" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity โหลด ตัวบ่งชี้ ซ้าย ขวา ตำแหน่ง" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity yükleme gösterge sol sağ konum" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity завантаження індикатор ліворуч праворуч розташування" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 加载 指示器 左 右 位置" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "sidebar.showAgentActivity loading spinner active coding agent agents running activity 載入 指示器 左 右 位置" + } + } + } + }, "settings.search.alias.setting.app.show-branch-directory": { "extractionState": "manual", "localizations": { @@ -196442,6 +196663,465 @@ } } }, + "sidebar.agentActivity.tooltip.many": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "جارٍ التحميل (%lld مهام نشطة)" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Učitavanje (%lld aktivnih zadataka)" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Indlæser (%lld aktive opgaver)" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Wird geladen (%lld aktive Aufgaben)" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Loading (%lld active tasks)" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Cargando (%lld tareas activas)" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Chargement (%lld tâches actives)" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Caricamento (%lld attività attive)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "読み込み中(アクティブなタスク %lld 件)" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "로딩 중(활성 작업 %lld개)" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Laster (%lld aktive oppgaver)" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Ładowanie (%lld aktywnych zadań)" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Carregando (%lld tarefas ativas)" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Загрузка (%lld активных задач)" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "กำลังโหลด (งานที่ทำงานอยู่ %lld รายการ)" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Yükleniyor (%lld etkin görev)" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Завантаження (%lld активних завдань)" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "正在加载(%lld 个活跃任务)" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "正在載入(%lld 個作用中任務)" + } + } + } + }, + "sidebar.agentActivity.tooltip.one": { + "extractionState": "manual", + "localizations": { + "ar": { + "stringUnit": { + "state": "translated", + "value": "جارٍ التحميل (مهمة نشطة واحدة)" + } + }, + "bs": { + "stringUnit": { + "state": "translated", + "value": "Učitavanje (1 aktivan zadatak)" + } + }, + "da": { + "stringUnit": { + "state": "translated", + "value": "Indlæser (1 aktiv opgave)" + } + }, + "de": { + "stringUnit": { + "state": "translated", + "value": "Wird geladen (1 aktive Aufgabe)" + } + }, + "en": { + "stringUnit": { + "state": "translated", + "value": "Loading (1 active task)" + } + }, + "es": { + "stringUnit": { + "state": "translated", + "value": "Cargando (1 tarea activa)" + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Chargement (1 tâche active)" + } + }, + "it": { + "stringUnit": { + "state": "translated", + "value": "Caricamento (1 attività attiva)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "読み込み中(アクティブなタスク 1 件)" + } + }, + "ko": { + "stringUnit": { + "state": "translated", + "value": "로딩 중(활성 작업 1개)" + } + }, + "nb": { + "stringUnit": { + "state": "translated", + "value": "Laster (1 aktiv oppgave)" + } + }, + "pl": { + "stringUnit": { + "state": "translated", + "value": "Ładowanie (1 aktywne zadanie)" + } + }, + "pt-BR": { + "stringUnit": { + "state": "translated", + "value": "Carregando (1 tarefa ativa)" + } + }, + "ru": { + "stringUnit": { + "state": "translated", + "value": "Загрузка (1 активная задача)" + } + }, + "th": { + "stringUnit": { + "state": "translated", + "value": "กำลังโหลด (งานที่ทำงานอยู่ 1 รายการ)" + } + }, + "tr": { + "stringUnit": { + "state": "translated", + "value": "Yükleniyor (1 etkin görev)" + } + }, + "uk": { + "stringUnit": { + "state": "translated", + "value": "Завантаження (1 активне завдання)" + } + }, + "zh-Hans": { + "stringUnit": { + "state": "translated", + "value": "正在加载(1 个活跃任务)" + } + }, + "zh-Hant": { + "stringUnit": { + "state": "translated", + "value": "正在載入(1 個作用中任務)" + } + } + } + }, + "sidebar.agentStatus.globalSection.header": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Agents" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェント" + } + } + } + }, + "sidebar.agentStatus.idle": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Idle" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "待機中" + } + } + } + }, + "sidebar.agentStatus.nameWithLifecycle": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%1$@: %2$@" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "%1$@: %2$@" + } + } + } + }, + "sidebar.agentStatus.needsInput": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Needs input" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "入力待ち" + } + } + } + }, + "sidebar.agentStatus.running": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "Running" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "実行中" + } + } + } + }, + "sidebar.agentStatus.summary.agentCount": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%lld agents" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェント %lld件" + } + } + } + }, + "sidebar.agentStatus.summary.needsInputCount": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%lld need input" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "%lld件が入力待ち" + } + } + } + }, + "sidebar.agentStatus.summary.oneAgent": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "1 agent" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "エージェント 1件" + } + } + } + }, + "sidebar.agentStatus.summary.oneNeedsInput": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "1 needs input" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "1件が入力待ち" + } + } + } + }, + "sidebar.agentStatus.valueWithPaneLabel": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "%1$@ (%2$@)" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "%1$@ (%2$@)" + } + } + } + }, + "sidebar.agentStatus.word.idle": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "idle" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "待機" + } + } + } + }, + "sidebar.agentStatus.word.waiting": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "waiting" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "入力待ち" + } + } + } + }, + "sidebar.agentStatus.word.working": { + "extractionState": "manual", + "localizations": { + "en": { + "stringUnit": { + "state": "translated", + "value": "working" + } + }, + "ja": { + "stringUnit": { + "state": "translated", + "value": "作業中" + } + } + } + }, "sidebar.browserStack.closeGroup": { "extractionState": "manual", "localizations": { @@ -231156,57 +231836,6 @@ } } } - }, - "featureFlags.agentChat.title": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Agent chat UI" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "エージェントチャットUI" - } - } - } - }, - "featureFlags.agentChat.description": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Shows the Agent chat entrypoints in the new-workspace dropdown, command palette, and surface tab bar." - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "新規ワークスペースのドロップダウン、コマンドパレット、サーフェスタブバーにエージェントチャットの入口を表示します。" - } - } - } - }, - "notification.agentChat.serverUnavailable.subtitleLaunchFailed": { - "extractionState": "manual", - "localizations": { - "en": { - "stringUnit": { - "state": "translated", - "value": "Could not start Agent Chat" - } - }, - "ja": { - "stringUnit": { - "state": "translated", - "value": "エージェントチャットを起動できませんでした" - } - } - } } }, "version": "1.0" diff --git a/Sources/ContentView.swift b/Sources/ContentView.swift index 535939d51036..a0b595a0d24f 100644 --- a/Sources/ContentView.swift +++ b/Sources/ContentView.swift @@ -12621,14 +12621,20 @@ private struct SidebarFooter: View { let onSendFeedback: () -> Void var body: some View { + VStack(alignment: .leading, spacing: 0) { + // Renders only while the globalSection debug variant is selected. + // Owns its TabManager observation internally so the footer (and + // the dev footer) never re-render on TabManager changes. + SidebarGlobalAgentsSection(fontScale: 1) #if DEBUG - SidebarDevFooter(updateViewModel: updateViewModel, fileExplorerState: fileExplorerState, onSendFeedback: onSendFeedback) + SidebarDevFooter(updateViewModel: updateViewModel, fileExplorerState: fileExplorerState, onSendFeedback: onSendFeedback) #else - SidebarFooterButtons(updateViewModel: updateViewModel, fileExplorerState: fileExplorerState, onSendFeedback: onSendFeedback) - .padding(.leading, 6) - .padding(.trailing, 10) - .padding(.bottom, 6) + SidebarFooterButtons(updateViewModel: updateViewModel, fileExplorerState: fileExplorerState, onSendFeedback: onSendFeedback) + .padding(.leading, 6) + .padding(.trailing, 10) + .padding(.bottom, 6) #endif + } } } @@ -13167,6 +13173,7 @@ struct SidebarWorkspaceSnapshotBuilder { let copyableSidebarSSHError: String? let latestConversationMessage: String? let metadataEntries: [SidebarStatusEntry] + let agentStatusRows: [SidebarAgentStatusRow] let metadataBlocks: [SidebarMetadataBlock] let latestLog: SidebarLogEntry? let progress: SidebarProgressState? @@ -13347,6 +13354,22 @@ struct TabItemView: View, Equatable { settings.activeTabIndicatorStyle } + // Debug lab observation: bounded (it mutates only on explicit picks in + // the Agent Rows Style window) and removed with the lab once a final + // design ships. Needed here because the graphite prototype restyles the + // workspace card's own selection background and border. + @ObservedObject private var agentRowsVariantStore = SidebarAgentRowsVariantStore.shared + + /// Feature-flag gate for the whole per-agent rows surface (rows, graphite + /// card styling, lab variants). Off = the pre-feature status pills. + private var agentRowsFeatureEnabled: Bool { + CmuxFeatureFlags.shared.isSidebarAgentRowsEnabled + } + + private var usesGraphiteVariant: Bool { + agentRowsFeatureEnabled && agentRowsVariantStore.variant == .graphite + } + private var isActive: Bool { observedIsActive ?? (tabManager.selectedTabId == tab.id) } @@ -13360,12 +13383,86 @@ struct TabItemView: View, Equatable { } private var selectedWorkspaceBackgroundNSColor: NSColor { - sidebarSelectedWorkspaceBackgroundNSColor( + // Debug lab "graphite" prototype v2: the selection is a dark tint of + // the workspace's own color (custom color when set, else the user's + // selection color), borderless. The foreground helper below + // auto-contrasts on it. Dies with the variant lab once a final design + // ships. + if usesGraphiteVariant { + return graphiteSelectionFillNSColor + } + return sidebarSelectedWorkspaceBackgroundNSColor( for: colorScheme, sidebarSelectionColorHex: sidebarSelectionColorHex ) } + /// Graphite prototype: selected-card fill = the workspace's color pulled + /// far toward the sidebar base, so custom colors survive as a tint + /// instead of a saturated slab. With no custom color (and no explicitly + /// customized selection color) the default is a neutral grey, not the + /// accent blue. + private var graphiteSelectionFillNSColor: NSColor { + let explicitBase: NSColor? = workspaceSnapshot.customColorHex.flatMap { + WorkspaceTabColorSettings.displayNSColor( + hex: $0, + colorScheme: colorScheme, + forceBright: false + ) + } ?? sidebarSelectionColorHex.flatMap { NSColor(hex: $0) } + guard let base = explicitBase else { + return colorScheme == .dark + ? NSColor(calibratedWhite: 0.24, alpha: 1.0) + : NSColor(calibratedWhite: 0.82, alpha: 1.0) + } + let srgbBase = base.usingColorSpace(.sRGB) ?? base + let dimBase = colorScheme == .dark + ? NSColor(calibratedWhite: 0.14, alpha: 1.0) + : NSColor(calibratedWhite: 0.92, alpha: 1.0) + return srgbBase.blended(withFraction: colorScheme == .dark ? 0.66 : 0.45, of: dimBase) ?? srgbBase + } + + /// Graphite prototype: the ACTIVE agent row is an even darker shade of + /// the same selection hue. + private var graphiteActiveAgentRowNSColor: NSColor { + let fill = graphiteSelectionFillNSColor + let deep = colorScheme == .dark + ? NSColor.black + : NSColor(calibratedWhite: 0.5, alpha: 1.0) + return fill.blended(withFraction: 0.38, of: deep) ?? fill + } + + /// Shared mount for the in-card agents accordion; used at both placements + /// (top of card / below the branch line). + @ViewBuilder + private var inCardAgentRowsMount: some View { + if !workspaceSnapshot.agentStatusRows.isEmpty { + SidebarAgentStatusInCardRows( + rows: workspaceSnapshot.agentStatusRows, + activePanelId: tab.focusedPanelId, + isActive: usesInvertedActiveForeground, + activeForegroundColor: activeSecondaryColor(0.95), + activeAgentRowColor: Color(nsColor: graphiteActiveAgentRowNSColor), + fontScale: fontScale, + onFocus: { updateSelection() }, + onFocusPanel: { panelId in + // The notification-jump path owns cross-workspace focus: + // plain updateSelection + focusPanel loses to the + // workspace's own focus restoration when the workspace + // was not already selected. + if AppDelegate.shared?.notificationNavigation.open( + tabId: tab.id, + surfaceId: panelId, + notificationId: nil + ) != true { + updateSelection() + tab.focusPanel(panelId) + } + } + ) + } + } + private func selectedWorkspaceForegroundNSColor(opacity: CGFloat) -> NSColor { sidebarSelectedWorkspaceForegroundNSColor( on: selectedWorkspaceBackgroundNSColor, @@ -13422,6 +13519,9 @@ struct TabItemView: View, Equatable { } private var activeBorderLineWidth: CGFloat { + if usesGraphiteVariant { + return 0 + } switch activeTabIndicatorStyle { case .leftRail: return 0 @@ -13432,6 +13532,9 @@ struct TabItemView: View, Equatable { private var activeBorderColor: Color { guard isActive else { return .clear } + if usesGraphiteVariant { + return .clear + } switch activeTabIndicatorStyle { case .leftRail: return .clear @@ -13762,6 +13865,9 @@ struct TabItemView: View, Equatable { if detailVisibility.showsMetadata { let metadataEntries = workspaceSnapshot.metadataEntries let metadataBlocks = workspaceSnapshot.metadataBlocks + if agentRowsVariantStore.inCardPlacement == .top { + inCardAgentRowsMount + } if !metadataEntries.isEmpty { SidebarMetadataRows( entries: metadataEntries, @@ -13915,6 +14021,12 @@ struct TabItemView: View, Equatable { } } + // Agents accordion below the branch/directory line (default + // placement; switchable to top-of-card in the debug lab). + if detailVisibility.showsMetadata, agentRowsVariantStore.inCardPlacement == .belowBranch { + inCardAgentRowsMount + } + // Pull request rows if detailVisibility.showsPullRequests, !workspaceSnapshot.pullRequestRows.isEmpty { VStack(alignment: .leading, spacing: 1) { @@ -14145,7 +14257,27 @@ struct TabItemView: View, Equatable { } } let _ = SidebarProfilingSignposts.end(signpost) - rowView + // Agent rows live BELOW the workspace card, not inside it: the card's + // whole-row tap gesture selects the workspace, so embedded rows could + // not be clicked independently. Out here each agent is its own + // full-width click target. + VStack(alignment: .leading, spacing: 2) { + rowView + if detailVisibility.showsMetadata, !workspaceSnapshot.agentStatusRows.isEmpty { + SidebarAgentStatusRows( + rows: workspaceSnapshot.agentStatusRows, + fontScale: fontScale, + onFocus: { updateSelection() }, + onFocusPanel: { panelId in + updateSelection() + tab.focusPanel(panelId) + } + ) + .padding(.leading, 14) + .padding(.trailing, 6) + .transition(.opacity) + } + } } private func beginInlineRename() { updateSelection() @@ -14475,6 +14607,11 @@ struct TabItemView: View, Equatable { } private var backgroundColor: Color { + // Debug lab "graphite" prototype v2: dark tint of the workspace's + // own color. Dies with the variant lab once a final design ships. + if usesGraphiteVariant, isActive { + return Color(nsColor: graphiteSelectionFillNSColor) + } let style = sidebarWorkspaceRowBackgroundStyle( activeTabIndicatorStyle: activeTabIndicatorStyle, isActive: isActive, @@ -14774,6 +14911,11 @@ struct TabItemView: View, Equatable { return pullRequestDisplays(orderedPanelIds: orderedPanelIds) }() + let agentStatusRows = detailVisibility.showsMetadata && CmuxFeatureFlags.shared.isSidebarAgentRowsEnabled + ? tab.sidebarAgentStatusRows() + : [] + let agentRowStatusKeys = Set(agentStatusRows.map(\.statusKey)) + return SidebarWorkspaceSnapshotBuilder.Snapshot( presentationKey: workspaceSnapshotPresentationKey, title: tab.title, @@ -14787,7 +14929,10 @@ struct TabItemView: View, Equatable { && (tab.remoteConnectionState == .suspended || tab.remoteConnectionState == .disconnected), copyableSidebarSSHError: copyableSidebarSSHError, latestConversationMessage: tab.latestConversationMessage, - metadataEntries: detailVisibility.showsMetadata ? tab.sidebarStatusEntriesInDisplayOrder() : [], + metadataEntries: detailVisibility.showsMetadata + ? tab.sidebarStatusEntriesInDisplayOrder().filter { !agentRowStatusKeys.contains($0.key) } + : [], + agentStatusRows: agentStatusRows, metadataBlocks: detailVisibility.showsMetadata ? tab.sidebarMetadataBlocksInDisplayOrder() : [], latestLog: detailVisibility.showsLog ? tab.logEntries.last : nil, progress: detailVisibility.showsProgress ? tab.progress : nil, @@ -15351,162 +15496,6 @@ private extension String { } } -private struct SidebarMetadataRows: View { - let entries: [SidebarStatusEntry] - let isActive: Bool - let activeForegroundColor: Color - let activeSecondaryForegroundColor: Color - let fontScale: CGFloat - let onFocus: () -> Void - - @State private var isExpanded: Bool = false - private let collapsedEntryLimit = 3 - - var body: some View { - VStack(alignment: .leading, spacing: 2) { - ForEach(visibleEntries, id: \.key) { entry in - SidebarMetadataEntryRow( - entry: entry, - isActive: isActive, - activeForegroundColor: activeForegroundColor, - fontScale: fontScale, - onFocus: onFocus - ) - } - - if shouldShowToggle { - Button(isExpanded ? String(localized: "sidebar.metadata.showLess", defaultValue: "Show less") : String(localized: "sidebar.metadata.showMore", defaultValue: "Show more")) { - onFocus() - withAnimation(.easeInOut(duration: 0.15)) { - isExpanded.toggle() - } - } - .buttonStyle(.plain) - .cmuxFont(size: 10 * fontScale, weight: .semibold) - .foregroundColor(isActive ? activeSecondaryForegroundColor : .secondary.opacity(0.9)) - .frame(maxWidth: .infinity, alignment: .leading) - } - } - .safeHelp(helpText) - } - - private var visibleEntries: [SidebarStatusEntry] { - guard !isExpanded, entries.count > collapsedEntryLimit else { return entries } - return Array(entries.prefix(collapsedEntryLimit)) - } - - private var helpText: String { - entries.map { entry in - let trimmed = entry.value.trimmingCharacters(in: .whitespacesAndNewlines) - return trimmed.isEmpty ? entry.key : trimmed - } - .joined(separator: "\n") - } - - private var shouldShowToggle: Bool { - entries.count > collapsedEntryLimit - } -} - -private struct SidebarMetadataEntryRow: View { - let entry: SidebarStatusEntry - let isActive: Bool - let activeForegroundColor: Color - let fontScale: CGFloat - let onFocus: () -> Void - - var body: some View { - Group { - if let url = entry.url { - Button { - onFocus() - NSWorkspace.shared.open(url) - } label: { - rowContent(underlined: true) - } - .buttonStyle(.plain) - .safeHelp(url.absoluteString) - } else { - rowContent(underlined: false) - .contentShape(Rectangle()) - .onTapGesture { onFocus() } - } - } - } - - @ViewBuilder - private func rowContent(underlined: Bool) -> some View { - HStack(alignment: .center, spacing: 4) { - if let icon = iconView { - icon - .foregroundColor(foregroundColor.opacity(0.95)) - } - metadataText(underlined: underlined) - .lineLimit(1) - .truncationMode(.tail) - Spacer(minLength: 0) - } - .cmuxFont(size: 10 * fontScale) - .frame(maxWidth: .infinity, alignment: .leading) - } - - private var foregroundColor: Color { - if isActive, - let raw = entry.color, - Color(hex: raw) != nil { - return activeForegroundColor - } - if let raw = entry.color, let explicit = Color(hex: raw) { - return explicit - } - return isActive ? activeForegroundColor.opacity(0.84) : .secondary - } - - private var iconView: AnyView? { - guard let iconRaw = entry.icon?.trimmingCharacters(in: .whitespacesAndNewlines), - !iconRaw.isEmpty else { - return nil - } - if iconRaw.hasPrefix("emoji:") { - let value = String(iconRaw.dropFirst("emoji:".count)) - guard !value.isEmpty else { return nil } - return AnyView(Text(value).cmuxFont(size: 9 * fontScale)) - } - if iconRaw.hasPrefix("text:") { - let value = String(iconRaw.dropFirst("text:".count)) - guard !value.isEmpty else { return nil } - return AnyView(Text(value).cmuxFont(size: 8 * fontScale, weight: .semibold)) - } - let symbolName: String - if iconRaw.hasPrefix("sf:") { - symbolName = String(iconRaw.dropFirst("sf:".count)) - } else { - symbolName = iconRaw - } - guard !symbolName.isEmpty else { return nil } - return AnyView(CmuxSystemSymbolImage(magnified: symbolName, pointSize: 8 * fontScale, weight: .medium)) - } - - @ViewBuilder - private func metadataText(underlined: Bool) -> some View { - let trimmed = entry.value.trimmingCharacters(in: .whitespacesAndNewlines) - let display = trimmed.isEmpty ? entry.key : trimmed - if entry.format == .markdown, - let attributed = try? AttributedString( - markdown: display, - options: .init(interpretedSyntax: .inlineOnlyPreservingWhitespace) - ) { - Text(attributed) - .underline(underlined) - .foregroundColor(foregroundColor) - } else { - Text(display) - .underline(underlined) - .foregroundColor(foregroundColor) - } - } -} - private struct SidebarMetadataMarkdownBlocks: View { let blocks: [SidebarMetadataBlock] let isActive: Bool diff --git a/Sources/DebugWindowsMenu.swift b/Sources/DebugWindowsMenu.swift new file mode 100644 index 000000000000..e1195187560c --- /dev/null +++ b/Sources/DebugWindowsMenu.swift @@ -0,0 +1,146 @@ +import SwiftUI + +#if DEBUG +/// The Debug > "Debug Windows" submenu, extracted from `cmuxApp.swift` +/// (see `AgentSessionDebugMenuButtons` / `CanvasDebugMenuButtons` for the +/// same pattern). Every item opens a singleton debug window controller. +struct DebugWindowsMenu: View { + var body: some View { + Menu("Debug Windows") { + Button("Background Debug…") { + BackgroundDebugWindowController.shared.show() + } + Button("Pro Badge Style…") { + ProBadgeDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.bonsplitTabBarDebug", + defaultValue: "Bonsplit Tab Bar Debug…" + ) + ) { + BonsplitTabBarDebugWindowController.shared.show() + } + Button("Browser Import Hint Debug…") { + BrowserImportHintDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.browserProfilePopoverDebug", + defaultValue: "Browser Profile Popover Debug…" + ) + ) { + BrowserProfilePopoverDebugWindowController.shared.show() + } + Button("Debug Window Controls…") { + DebugWindowControlsWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.devWindowDisplay", + defaultValue: "Dev Window Display…" + ) + ) { + DevWindowDisplayDebugWindowController.shared.show() + } + Button("Feed Preview…") { + FeedPreviewWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.feedTextEditorDebug", + defaultValue: "Feed Text Editor Lab…" + ) + ) { + FeedTextEditorDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.feedButtonStyleDebug", + defaultValue: "Feed Button Style Debug…" + ) + ) { + FeedButtonStyleDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.startupAppearanceDebug", + defaultValue: "Startup Appearance Debug…" + ) + ) { + StartupAppearanceDebugWindowController.shared.show() + } + Button("Menu Bar Extra Debug…") { + MenuBarExtraDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.aboutTitlebarDebug", + defaultValue: "About Titlebar Debug…" + ) + ) { + AppDelegate.shared?.debugWindowsCoordinator.showAboutTitlebarDebugWindow() + } + Button( + String( + localized: "debug.menu.titlebarLayoutDebug", + defaultValue: "Titlebar Layout Debug..." + ) + ) { + TitlebarLayoutDebugWindowController.shared.show() + } + Button("Sidebar Debug…") { + SidebarDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.splitButtonLayoutDebug", + defaultValue: "Split Button Layout Debug…" + ) + ) { + SplitButtonLayoutDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.tabBarBackdropLab", + defaultValue: "Tab Bar Backdrop Lab…" + ) + ) { + TabBarBackdropLabWindowController.shared.show() + } + Button("File Explorer Style Debug…") { + FileExplorerStyleDebugWindowController.shared.show() + } + Button( + String( + localized: "debug.menu.pdfPreviewChromeDebug", + defaultValue: "PDF Preview Chrome Debug…" + ) + ) { + PDFPreviewChromeDebugWindowController.shared.show() + } + Button("Open All Debug Windows") { + Self.openAllDebugWindows() + } + } + } + + private static func openAllDebugWindows() { + DebugWindowControlsWindowController.shared.show() + BrowserImportHintDebugWindowController.shared.show() + BrowserProfilePopoverDebugWindowController.shared.show() + AppDelegate.shared?.debugWindowsCoordinator.showAboutTitlebarDebugWindow() + TitlebarLayoutDebugWindowController.shared.show() + SidebarDebugWindowController.shared.show() + BackgroundDebugWindowController.shared.show() + StartupAppearanceDebugWindowController.shared.show() + MenuBarExtraDebugWindowController.shared.show() + PDFPreviewChromeDebugWindowController.shared.show() + FeedPreviewWindowController.shared.show() + FeedTextEditorDebugWindowController.shared.show() + FeedButtonStyleDebugWindowController.shared.show() + BonsplitTabBarDebugWindowController.shared.show() + SplitButtonLayoutDebugWindowController.shared.show() + } +} +#endif diff --git a/Sources/FeatureFlags.swift b/Sources/FeatureFlags.swift index a16336dc9a7a..cdcd7ce37eeb 100644 --- a/Sources/FeatureFlags.swift +++ b/Sources/FeatureFlags.swift @@ -47,6 +47,12 @@ final class CmuxFeatureFlags { private static let agentChatUIDefault = false private static let sidebarWorkspaceAgentSpinnerDefault = false + #if DEBUG + private static let sidebarAgentRowsDefault = true + #else + private static let sidebarAgentRowsDefault = false + #endif + private static let overrideKeyPrefix = "cmux.flags.override." // Order is load-bearing for the typed accessors below. A keyed lookup would @@ -132,6 +138,23 @@ final class CmuxFeatureFlags { ), defaultWhenUnavailable: CmuxFeatureFlags.sidebarWorkspaceAgentSpinnerDefault ), + + // FLAG(key: sidebar-agent-rows-enabled-release, owner: lawrencecchen, + // reviewBy: 2026-10-01, defaultWhenUnavailable: false) + // Per-agent sidebar rows: one row per agent pane inside the + // workspace card (graphite prototype), spinner/waiting states, + // click-to-focus, and the BYO-agent dynamic row keys. Release + // builds keep the pre-feature status pills until the PostHog flag + // is enabled; DEBUG keeps the rows on for dogfood. + CmuxFeatureFlagDefinition( + key: "sidebar-agent-rows-enabled-release", + title: String(localized: "featureFlags.sidebarAgentRows.title", defaultValue: "Per-agent sidebar rows"), + flagDescription: String( + localized: "featureFlags.sidebarAgentRows.description", + defaultValue: "Shows one row per agent pane in the sidebar with live state, replacing the single status pill." + ), + defaultWhenUnavailable: CmuxFeatureFlags.sidebarAgentRowsDefault + ), ] }() @@ -155,6 +178,10 @@ final class CmuxFeatureFlags { effectiveValue(for: Self.allFlags[4]) } + var isSidebarAgentRowsEnabled: Bool { + effectiveValue(for: Self.allFlags[5]) + } + @ObservationIgnored private let defaults: UserDefaults @ObservationIgnored diff --git a/Sources/SessionPersistence.swift b/Sources/SessionPersistence.swift index fe2b3df05c8b..81b1e812c55e 100644 --- a/Sources/SessionPersistence.swift +++ b/Sources/SessionPersistence.swift @@ -234,6 +234,12 @@ struct SessionStatusEntrySnapshot: Codable, Sendable { var icon: String? var color: String? var timestamp: TimeInterval + /// Row behavior fields (click-to-open URL, sort priority, markdown + /// rendering). Nil in legacy snapshots; panel-scoped restores must keep + /// them or a markdown/clickable/high-priority row degrades on relaunch. + var url: String? = nil + var priority: Int? = nil + var format: String? = nil } struct SessionLogEntrySnapshot: Codable, Sendable { @@ -1379,43 +1385,27 @@ enum SurfaceResumeBindingScriptStore { } } +/// The synthesized memberwise initializer (every property defaults to nil) +/// replaces the hand-written one; keep new properties `var ... = nil` so the +/// synthesized parameter list stays fully defaulted. struct SessionTerminalPanelSnapshot: Codable, Sendable { - var workingDirectory: String? - var scrollback: String? - var agent: SessionRestorableAgentSnapshot? - var tmuxStartCommand: String? - var hibernation: SessionAgentHibernationSnapshot? - var resumeBinding: SurfaceResumeBindingSnapshot? - var textBoxDraft: SessionTextBoxInputDraftSnapshot? - var isRemoteTerminal: Bool? - var remotePTYSessionID: String? + var workingDirectory: String? = nil + var scrollback: String? = nil + var agent: SessionRestorableAgentSnapshot? = nil + var tmuxStartCommand: String? = nil + var hibernation: SessionAgentHibernationSnapshot? = nil + var resumeBinding: SurfaceResumeBindingSnapshot? = nil + var textBoxDraft: SessionTextBoxInputDraftSnapshot? = nil + var isRemoteTerminal: Bool? = nil + var remotePTYSessionID: String? = nil /// Whether the agent process was actively running when this snapshot was captured. /// Nil means unknown (legacy snapshots); treated as true for backwards compatibility. - var wasAgentRunning: Bool? - - init( - workingDirectory: String? = nil, - scrollback: String? = nil, - agent: SessionRestorableAgentSnapshot? = nil, - tmuxStartCommand: String? = nil, - hibernation: SessionAgentHibernationSnapshot? = nil, - resumeBinding: SurfaceResumeBindingSnapshot? = nil, - textBoxDraft: SessionTextBoxInputDraftSnapshot? = nil, - isRemoteTerminal: Bool? = nil, - remotePTYSessionID: String? = nil, - wasAgentRunning: Bool? = nil - ) { - self.workingDirectory = workingDirectory - self.scrollback = scrollback - self.agent = agent - self.tmuxStartCommand = tmuxStartCommand - self.hibernation = hibernation - self.resumeBinding = resumeBinding - self.textBoxDraft = textBoxDraft - self.isRemoteTerminal = isRemoteTerminal - self.remotePTYSessionID = remotePTYSessionID - self.wasAgentRunning = wasAgentRunning - } + var wasAgentRunning: Bool? = nil + /// Panel-scoped structured agent status reports (one per status key), so + /// per-agent sidebar rows keep their pane binding across restart. + var agentStatusEntries: [SessionStatusEntrySnapshot]? = nil + /// Last known agent lifecycle raw value per structured status key. + var agentLifecyclesByStatusKey: [String: String]? = nil } extension SessionTerminalPanelSnapshot: WorkspaceSessionRemoteRestoreTerminalSnapshot {} diff --git a/Sources/Sidebar/SidebarWorkspaceSnapshotRefreshPolicy.swift b/Sources/Sidebar/SidebarWorkspaceSnapshotRefreshPolicy.swift index 74038c6ba038..729f50a34c81 100644 --- a/Sources/Sidebar/SidebarWorkspaceSnapshotRefreshPolicy.swift +++ b/Sources/Sidebar/SidebarWorkspaceSnapshotRefreshPolicy.swift @@ -36,6 +36,7 @@ extension SidebarWorkspaceSnapshotBuilder.Snapshot { copyableSidebarSSHError: copyableSidebarSSHError, latestConversationMessage: latestConversationMessage, metadataEntries: metadataEntries, + agentStatusRows: agentStatusRows, metadataBlocks: metadataBlocks, latestLog: latestLog, progress: progress, diff --git a/Sources/SidebarAgentGraphiteRowViews.swift b/Sources/SidebarAgentGraphiteRowViews.swift new file mode 100644 index 000000000000..48fb213586c2 --- /dev/null +++ b/Sources/SidebarAgentGraphiteRowViews.swift @@ -0,0 +1,197 @@ +import AppKit +import CmuxFoundation +import CmuxSidebar +import SwiftUI + +/// Graphite (in-card) presentation of the per-agent rows, split from +/// `SidebarAgentStatusRowViews.swift` to satisfy the new-file length budget. +/// Rows receive immutable value snapshots and closure action bundles only, +/// per the sidebar list snapshot-boundary rule. +struct SidebarAgentStatusGraphiteRows: View { + let rows: [SidebarAgentStatusRow] + let activePanelId: UUID? + let isActive: Bool + let activeForegroundColor: Color + let activeAgentRowColor: Color + let fontScale: CGFloat + let onFocus: () -> Void + let onFocusPanel: (UUID) -> Void + + @State private var isCollapsed = false + + var body: some View { + VStack(alignment: .leading, spacing: 1) { + header + if !isCollapsed { + ForEach(rows) { row in + SidebarAgentGraphiteRow( + row: row, + // Only the selected workspace hosts the globally + // focused pane; unselected workspaces remember a + // focus but the "camera" is not on them. + isActiveAgent: isActive && row.panelId == activePanelId, + isActive: isActive, + activeForegroundColor: activeForegroundColor, + activeAgentRowColor: activeAgentRowColor, + fontScale: fontScale, + onFocusPanel: onFocusPanel + ) + } + } + } + .padding(.top, 3) + } + + private var header: some View { + let summary = SidebarAgentStatusRowsSummary(rows: rows) + return Button { + onFocus() + withAnimation(.easeInOut(duration: 0.15)) { + isCollapsed.toggle() + } + } label: { + HStack(spacing: 4) { + CmuxSystemSymbolImage( + magnified: isCollapsed ? "chevron.right" : "chevron.down", + pointSize: 6.5 * fontScale, + weight: .semibold + ) + .foregroundColor(secondaryColor.opacity(0.8)) + if isCollapsed, let accent = summary.accentColorHex, let color = Color(hex: accent) { + Circle() + .fill(color) + .frame(width: 5 * fontScale, height: 5 * fontScale) + } + Text(summary.text) + .cmuxFont(size: 9.5 * fontScale, weight: .semibold) + .foregroundColor(secondaryColor) + .lineLimit(1) + Spacer(minLength: 0) + } + .padding(.vertical, 1) + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + .safeHelp(summary.text) + } + + private var secondaryColor: Color { + isActive ? activeForegroundColor.opacity(0.7) : .secondary + } +} + +private struct SidebarAgentGraphiteRow: View { + let row: SidebarAgentStatusRow + let isActiveAgent: Bool + let isActive: Bool + let activeForegroundColor: Color + let activeAgentRowColor: Color + let fontScale: CGFloat + let onFocusPanel: (UUID) -> Void + + @State private var isHovering = false + + var body: some View { + Button { + onFocusPanel(row.panelId) + } label: { + HStack(spacing: 6) { + SidebarAgentBrandIcon(row: row, fontScale: fontScale) + Text(row.paneLabel ?? SidebarAgentRowStateStyle.agentDisplayName(statusKey: row.statusKey)) + .cmuxFont(size: 10.5 * fontScale, weight: .medium) + .foregroundColor(nameColor) + .lineLimit(1) + .truncationMode(.middle) + Spacer(minLength: 4) + trailingState + } + .padding(.vertical, 3) + .padding(.horizontal, 7) + .frame(maxWidth: .infinity, alignment: .leading) + .background(rowBackground) + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + .onHover { isHovering = $0 } + .safeHelp(tooltip) + } + + /// Running shows a spinner (no state word); waiting keeps the orange + /// dot + word; idle shows nothing. Lifecycle-less rows (BYO agents that + /// only reported a status) keep their reported color as a small dot. + @ViewBuilder + private var trailingState: some View { + switch row.lifecycle { + case .running: + SidebarAgentRowSpinner(fontScale: fontScale) + case .needsInput: + if let stateColor = SidebarAgentRowStateStyle.stateColor(for: row) { + Circle() + .fill(stateColor) + .frame(width: 5 * fontScale, height: 5 * fontScale) + } + if let word = SidebarAgentRowStateStyle.stateWord(for: row) { + Text(word) + .cmuxFont(size: 9.5 * fontScale) + .foregroundColor(stateWordColor) + .lineLimit(1) + } + case .idle, .unknown: + EmptyView() + case nil: + if let raw = row.color, let reported = Color(hex: raw) { + Circle() + .fill(reported) + .frame(width: 5 * fontScale, height: 5 * fontScale) + } + } + } + + @ViewBuilder + private var rowBackground: some View { + if isActiveAgent { + // "Even darker of the same color": the active agent sits in a + // deeper shade of the card's own selection tint. + RoundedRectangle(cornerRadius: 5, style: .continuous) + .fill(activeAgentRowColor) + } else { + RoundedRectangle(cornerRadius: 5, style: .continuous) + .fill(Color.primary.opacity(isHovering ? 0.07 : 0)) + } + } + + private var nameColor: Color { + // isActiveAgent implies isActive (gated at the call site). + if isActiveAgent { + return activeForegroundColor + } + return isActive ? activeForegroundColor.opacity(0.92) : .primary.opacity(0.85) + } + + private var stateWordColor: Color { + if row.lifecycle == .needsInput { + return Color(hex: "#FF9F0A") ?? .orange + } + return isActive ? activeForegroundColor.opacity(0.6) : .secondary.opacity(0.8) + } + + private var tooltip: String { + [ + row.paneLabel ?? SidebarAgentRowStateStyle.agentDisplayName(statusKey: row.statusKey), + SidebarAgentRowStateStyle.statusText(for: row), + ].compactMap { $0 }.joined(separator: " · ") + } +} + + +/// Small native activity spinner sized for a sidebar agent row. +struct SidebarAgentRowSpinner: View { + let fontScale: CGFloat + + var body: some View { + ProgressView() + .controlSize(.small) + .scaleEffect(0.55 * fontScale) + .frame(width: 10 * fontScale, height: 10 * fontScale) + } +} diff --git a/Sources/SidebarAgentRowsVariantLab.swift b/Sources/SidebarAgentRowsVariantLab.swift new file mode 100644 index 000000000000..3032c0b3ad6a --- /dev/null +++ b/Sources/SidebarAgentRowsVariantLab.swift @@ -0,0 +1,264 @@ +import AppKit +import SwiftUI + +/// Debug explorer for the per-agent sidebar row presentation: eight variants +/// switchable live from Debug > "Agent Rows Style…", persisted in +/// UserDefaults. This is a dogfood decision aid; once a winner is picked the +/// losing variants get deleted and the store collapses to a constant. +enum SidebarAgentRowsVariant: String, CaseIterable, Identifiable { + case graphite + case belowAccordion + case belowFlat + case belowTree + case belowChips + case inCardRows + case inCardCompact + case globalSection + + static let userDefaultsKey = "sidebarAgentRowsVariantDebug" + + var id: String { rawValue } + + var isInCard: Bool { self == .inCardRows || self == .inCardCompact } + + var displayName: String { + switch self { + case .graphite: + return String(localized: "debug.agentRows.variant.graphite", defaultValue: "Graphite prototype (picked)") + case .belowAccordion: + return String(localized: "debug.agentRows.variant.belowAccordion", defaultValue: "Below card · accordion") + case .belowFlat: + return String(localized: "debug.agentRows.variant.belowFlat", defaultValue: "Below card · flat rows") + case .belowTree: + return String(localized: "debug.agentRows.variant.belowTree", defaultValue: "Below card · tree guide") + case .belowChips: + return String(localized: "debug.agentRows.variant.belowChips", defaultValue: "Below card · chips") + case .inCardRows: + return String(localized: "debug.agentRows.variant.inCardRows", defaultValue: "In card · rows") + case .inCardCompact: + return String(localized: "debug.agentRows.variant.inCardCompact", defaultValue: "In card · compact line") + case .globalSection: + return String(localized: "debug.agentRows.variant.globalSection", defaultValue: "Global Agents section (sidebar bottom)") + } + } + + var detail: String { + switch self { + case .graphite: + return String(localized: "debug.agentRows.variant.graphite.detail", defaultValue: "Graphite selection card, in-card accordion, accent bar on the active (focused) agent.") + case .belowAccordion: + return String(localized: "debug.agentRows.variant.belowAccordion.detail", defaultValue: "Summary header folds the rows; each row is its own button.") + case .belowFlat: + return String(localized: "debug.agentRows.variant.belowFlat.detail", defaultValue: "Always-expanded rows, no header.") + case .belowTree: + return String(localized: "debug.agentRows.variant.belowTree.detail", defaultValue: "Rows hang off a tree guide line under the workspace.") + case .belowChips: + return String(localized: "debug.agentRows.variant.belowChips.detail", defaultValue: "Wrapping icon chips, one per agent.") + case .inCardRows: + return String(localized: "debug.agentRows.variant.inCardRows.detail", defaultValue: "Rows embedded inside the workspace card.") + case .inCardCompact: + return String(localized: "debug.agentRows.variant.inCardCompact.detail", defaultValue: "One dense line of brand icons and state dots in the card.") + case .globalSection: + return String(localized: "debug.agentRows.variant.globalSection.detail", defaultValue: "No per-workspace rows; one Agents list at the sidebar bottom, grouped by workspace.") + } + } +} + +/// Where the in-card agents accordion sits inside the workspace card. +enum SidebarAgentRowsPlacement: String, CaseIterable, Identifiable { + case top + case belowBranch + + static let userDefaultsKey = "sidebarAgentRowsPlacementDebug" + + var id: String { rawValue } + + var displayName: String { + switch self { + case .top: + return String(localized: "debug.agentRows.placement.top", defaultValue: "Top of card (under the title)") + case .belowBranch: + return String(localized: "debug.agentRows.placement.belowBranch", defaultValue: "Below the branch line") + } + } +} + +/// Singleton the row containers observe. It only mutates when the user picks +/// a variant in the lab window, so the extra invalidation is bounded; this is +/// a deliberate, temporary exception to the sidebar snapshot-boundary rule +/// while the presentation is being chosen. +@MainActor +final class SidebarAgentRowsVariantStore: ObservableObject { + static let shared = SidebarAgentRowsVariantStore() + + @Published var variant: SidebarAgentRowsVariant { + didSet { + UserDefaults.standard.set(variant.rawValue, forKey: SidebarAgentRowsVariant.userDefaultsKey) + } + } + + @Published var inCardPlacement: SidebarAgentRowsPlacement { + didSet { + UserDefaults.standard.set(inCardPlacement.rawValue, forKey: SidebarAgentRowsPlacement.userDefaultsKey) + } + } + + private init() { + let raw = UserDefaults.standard.string(forKey: SidebarAgentRowsVariant.userDefaultsKey) + variant = raw.flatMap(SidebarAgentRowsVariant.init(rawValue:)) ?? .belowAccordion + let placementRaw = UserDefaults.standard.string(forKey: SidebarAgentRowsPlacement.userDefaultsKey) + inCardPlacement = placementRaw.flatMap(SidebarAgentRowsPlacement.init(rawValue:)) ?? .belowBranch + } +} + +@MainActor +final class AgentRowsVariantLabWindowController: ReleasingWindowController { + static let shared = AgentRowsVariantLabWindowController() + + override func makeWindow() -> NSWindow { + let window = NSPanel( + contentRect: NSRect(x: 0, y: 0, width: 380, height: 560), + styleMask: [.titled, .closable, .utilityWindow], + backing: .buffered, + defer: false + ) + window.title = String(localized: "debug.agentRows.window.title", defaultValue: "Agent Rows Style") + window.titleVisibility = .visible + window.isMovableByWindowBackground = true + window.level = .floating + window.identifier = NSUserInterfaceItemIdentifier("cmux.agentRowsVariantLab") + window.center() + window.contentView = NSHostingView(rootView: AgentRowsVariantLabView()) + AppDelegate.shared?.applyWindowDecorations(to: window) + return window + } + + func show() { + showManagedWindow() + } +} + +private struct AgentRowsVariantLabView: View { + @ObservedObject private var store = SidebarAgentRowsVariantStore.shared + + var body: some View { + VStack(alignment: .leading, spacing: 10) { + Text(String( + localized: "debug.agentRows.window.caption", + defaultValue: "Switches the per-agent sidebar rows live. The choice persists across relaunch." + )) + .font(.system(size: 11)) + .foregroundColor(.secondary) + + ForEach(SidebarAgentRowsVariant.allCases) { variant in + Button { + store.variant = variant + } label: { + HStack(alignment: .top, spacing: 8) { + Image(systemName: store.variant == variant ? "largecircle.fill.circle" : "circle") + .foregroundColor(store.variant == variant ? Color.accentColor : .secondary) + .padding(.top, 1) + VStack(alignment: .leading, spacing: 1) { + Text(variant.displayName) + .font(.system(size: 12, weight: .medium)) + Text(variant.detail) + .font(.system(size: 10.5)) + .foregroundColor(.secondary) + .fixedSize(horizontal: false, vertical: true) + } + Spacer(minLength: 0) + } + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + } + + Divider() + + Text(String(localized: "debug.agentRows.placement.header", defaultValue: "Accordion position (in-card variants)")) + .font(.system(size: 11, weight: .semibold)) + .foregroundColor(.secondary) + ForEach(SidebarAgentRowsPlacement.allCases) { placement in + Button { + store.inCardPlacement = placement + } label: { + HStack(spacing: 8) { + Image(systemName: store.inCardPlacement == placement ? "largecircle.fill.circle" : "circle") + .foregroundColor(store.inCardPlacement == placement ? Color.accentColor : .secondary) + Text(placement.displayName) + .font(.system(size: 12)) + Spacer(minLength: 0) + } + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + } + Spacer(minLength: 0) + } + .padding(14) + .frame(width: 380, alignment: .topLeading) + } +} + +/// The `globalSection` variant: one Agents list at the bottom of the sidebar, +/// grouped by workspace. Reads live workspace state directly; acceptable only +/// because it renders exclusively while this debug variant is selected. Owns +/// its TabManager observation so the host (the sidebar footer) does not +/// re-render on TabManager changes; when another variant is selected the +/// re-evaluated body is a single enum comparison. +struct SidebarGlobalAgentsSection: View { + let fontScale: CGFloat + + @EnvironmentObject private var tabManager: TabManager + @ObservedObject private var store = SidebarAgentRowsVariantStore.shared + + private func focus(workspaceId: UUID, panelId: UUID) { + if AppDelegate.shared?.notificationNavigation.open( + tabId: workspaceId, + surfaceId: panelId, + notificationId: nil + ) == true { + return + } + guard let tab = tabManager.tabs.first(where: { $0.id == workspaceId }) else { return } + tabManager.selectedTabId = workspaceId + tab.focusPanel(panelId) + } + + var body: some View { + if CmuxFeatureFlags.shared.isSidebarAgentRowsEnabled, store.variant == .globalSection { + let groups = tabManager.tabs.compactMap { tab -> (workspaceId: UUID, title: String, rows: [SidebarAgentStatusRow])? in + let rows = tab.sidebarAgentStatusRows() + guard !rows.isEmpty else { return nil } + return (tab.id, tab.title, rows) + } + if !groups.isEmpty { + VStack(alignment: .leading, spacing: 3) { + Text(String(localized: "sidebar.agentStatus.globalSection.header", defaultValue: "Agents")) + .cmuxFont(size: 10 * fontScale, weight: .semibold) + .foregroundColor(.secondary) + .padding(.horizontal, 10) + .padding(.top, 8) + ForEach(groups, id: \.workspaceId) { group in + Text(group.title) + .cmuxFont(size: 9 * fontScale, weight: .medium) + .foregroundColor(.secondary.opacity(0.7)) + .lineLimit(1) + .padding(.horizontal, 10) + .padding(.top, 2) + ForEach(group.rows) { row in + SidebarAgentStatusEntryRowView( + row: row, + fontScale: fontScale, + layout: .nameFirst, + onFocusPanel: { panelId in focus(workspaceId: group.workspaceId, panelId: panelId) } + ) + .padding(.horizontal, 8) + } + } + } + .padding(.bottom, 6) + } + } + } +} diff --git a/Sources/SidebarAgentStatusRowViews.swift b/Sources/SidebarAgentStatusRowViews.swift new file mode 100644 index 000000000000..103ee8d17539 --- /dev/null +++ b/Sources/SidebarAgentStatusRowViews.swift @@ -0,0 +1,455 @@ +import AppKit +import CmuxFoundation +import CmuxSidebar +import SwiftUI + +/// Below-card presentation of the per-agent rows. Owns the variant switch for +/// every below-card style; renders nothing when an in-card or global variant +/// is active. Rows receive immutable value snapshots and closure action +/// bundles only, per the sidebar list snapshot-boundary rule (the variant +/// store is a deliberate, temporary debug-lab exception; it changes only on +/// explicit user picks). +struct SidebarAgentStatusRows: View { + let rows: [SidebarAgentStatusRow] + let fontScale: CGFloat + let onFocus: () -> Void + let onFocusPanel: (UUID) -> Void + + @ObservedObject private var variantStore = SidebarAgentRowsVariantStore.shared + @State private var isCollapsed = false + + var body: some View { + switch variantStore.variant { + case .belowAccordion: + VStack(alignment: .leading, spacing: 2) { + if rows.count > 1 { + accordionHeader + if !isCollapsed { + rowList(layout: .nameFirst) + } + } else { + rowList(layout: .nameFirst) + } + } + case .belowFlat: + VStack(alignment: .leading, spacing: 2) { + rowList(layout: .nameFirst) + } + case .belowTree: + VStack(alignment: .leading, spacing: 0) { + rowList(layout: .tree) + } + case .belowChips: + SidebarAgentChipsFlow(rows: rows, fontScale: fontScale, onFocusPanel: onFocusPanel) + case .graphite, .inCardRows, .inCardCompact, .globalSection: + EmptyView() + } + } + + @ViewBuilder + private func rowList(layout: SidebarAgentRowLayout) -> some View { + ForEach(rows) { row in + SidebarAgentStatusEntryRowView( + row: row, + fontScale: fontScale, + layout: layout, + onFocusPanel: onFocusPanel + ) + } + } + + private var accordionHeader: some View { + let summary = SidebarAgentStatusRowsSummary(rows: rows) + return Button { + onFocus() + withAnimation(.easeInOut(duration: 0.15)) { + isCollapsed.toggle() + } + } label: { + HStack(spacing: 4) { + CmuxSystemSymbolImage( + magnified: isCollapsed ? "chevron.right" : "chevron.down", + pointSize: 7 * fontScale, + weight: .semibold + ) + .foregroundColor(.secondary.opacity(0.8)) + if isCollapsed, let accent = summary.accentColorHex, let color = Color(hex: accent) { + Circle() + .fill(color) + .frame(width: 5 * fontScale, height: 5 * fontScale) + } + Text(summary.text) + .foregroundColor(.secondary) + .lineLimit(1) + .truncationMode(.tail) + Spacer(minLength: 0) + } + .cmuxFont(size: 10 * fontScale, weight: .semibold) + .frame(maxWidth: .infinity, alignment: .leading) + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + .safeHelp(summary.text) + } +} + +/// In-card presentation (variants `inCardRows` / `inCardCompact`), mounted +/// inside the workspace card so it inherits the selection background. Renders +/// nothing for the below-card and global variants. +struct SidebarAgentStatusInCardRows: View { + let rows: [SidebarAgentStatusRow] + let activePanelId: UUID? + let isActive: Bool + let activeForegroundColor: Color + let activeAgentRowColor: Color + let fontScale: CGFloat + let onFocus: () -> Void + let onFocusPanel: (UUID) -> Void + + @ObservedObject private var variantStore = SidebarAgentRowsVariantStore.shared + + var body: some View { + switch variantStore.variant { + case .graphite: + SidebarAgentStatusGraphiteRows( + rows: rows, + activePanelId: activePanelId, + isActive: isActive, + activeForegroundColor: activeForegroundColor, + activeAgentRowColor: activeAgentRowColor, + fontScale: fontScale, + onFocus: onFocus, + onFocusPanel: onFocusPanel + ) + case .inCardRows: + VStack(alignment: .leading, spacing: 2) { + ForEach(rows) { row in + SidebarAgentStatusEntryRowView( + row: row, + fontScale: fontScale, + layout: .inCard(isActive: isActive, activeForeground: activeForegroundColor), + onFocusPanel: onFocusPanel + ) + } + } + case .inCardCompact: + compactLine + case .belowAccordion, .belowFlat, .belowTree, .belowChips, .globalSection: + EmptyView() + } + } + + private var compactLine: some View { + let summary = SidebarAgentStatusRowsSummary(rows: rows) + return HStack(spacing: 5) { + ForEach(rows) { row in + Button { + onFocusPanel(row.panelId) + } label: { + HStack(spacing: 2) { + SidebarAgentBrandIcon(row: row, fontScale: fontScale) + if let color = SidebarAgentRowStateStyle.stateColor(for: row) { + Circle() + .fill(color) + .frame(width: 4.5 * fontScale, height: 4.5 * fontScale) + } + } + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + .safeHelp(rowTooltip(row)) + } + Text(summary.text) + .cmuxFont(size: 9 * fontScale) + .foregroundColor(isActive ? activeForegroundColor.opacity(0.7) : .secondary.opacity(0.9)) + .lineLimit(1) + Spacer(minLength: 0) + } + } + + private func rowTooltip(_ row: SidebarAgentStatusRow) -> String { + [row.paneLabel, row.value].compactMap { $0 }.joined(separator: " · ") + } +} + +/// Wrapping chips variant: one capsule per agent, border tinted by state. +struct SidebarAgentChipsFlow: View { + let rows: [SidebarAgentStatusRow] + let fontScale: CGFloat + let onFocusPanel: (UUID) -> Void + + var body: some View { + // Simple two-column-ish flow: chips wrap by rendering in an adaptive grid. + LazyVGrid( + columns: [GridItem(.adaptive(minimum: 96 * fontScale), spacing: 4, alignment: .leading)], + alignment: .leading, + spacing: 4 + ) { + ForEach(rows) { row in + Button { + onFocusPanel(row.panelId) + } label: { + HStack(spacing: 3) { + SidebarAgentBrandIcon(row: row, fontScale: fontScale) + Text(row.paneLabel ?? SidebarAgentRowStateStyle.agentDisplayName(statusKey: row.statusKey)) + .cmuxFont(size: 9.5 * fontScale, weight: .medium) + .foregroundColor(.primary.opacity(0.85)) + .lineLimit(1) + .truncationMode(.middle) + } + .padding(.vertical, 2.5) + .padding(.horizontal, 6) + .background( + Capsule() + .strokeBorder( + SidebarAgentRowStateStyle.stateColor(for: row) ?? Color.secondary.opacity(0.35), + lineWidth: 1 + ) + ) + .contentShape(Capsule()) + } + .buttonStyle(.plain) + .safeHelp([row.paneLabel, row.value].compactMap { $0 }.joined(separator: " · ")) + } + } + } +} + +enum SidebarAgentRowLayout: Equatable { + case nameFirst + case tree + case inCard(isActive: Bool, activeForeground: Color) +} + +/// Shared state-styling helpers used by every variant. +enum SidebarAgentRowStateStyle { + /// Brand marks for the structured agent status keys that have assets in + /// `Assets.xcassets/AgentIcons`; keys without a mark fall back to the + /// reported or lifecycle-derived SF symbol. + static let brandAssetsByStatusKey: [String: String] = [ + "antigravity": "AgentIcons/Antigravity", + "claude_code": "AgentIcons/Claude", + "codex": "AgentIcons/Codex", + "grok": "AgentIcons/Grok", + "hermes-agent": "AgentIcons/HermesAgent", + "opencode": "AgentIcons/OpenCode", + "pi": "AgentIcons/Pi", + "rovodev": "AgentIcons/RovoDev", + ] + + static func agentDisplayName(statusKey: String) -> String { + statusKey + .split(separator: "_") + .map { $0.prefix(1).uppercased() + $0.dropFirst() } + .joined(separator: " ") + } + + static func effectiveColorHex(for row: SidebarAgentStatusRow) -> String? { + if let color = row.color { + return color + } + switch row.lifecycle { + case .running: + return "#4C8DFF" + case .needsInput: + return "#FF9F0A" + case .idle, .unknown, nil: + return nil + } + } + + static func stateColor(for row: SidebarAgentStatusRow) -> Color? { + guard let raw = effectiveColorHex(for: row) else { return nil } + return Color(hex: raw) + } + + /// Short right-aligned state word for dense layouts. + static func stateWord(for row: SidebarAgentStatusRow) -> String? { + switch row.lifecycle { + case .running: + return String(localized: "sidebar.agentStatus.word.working", defaultValue: "working") + case .needsInput: + return String(localized: "sidebar.agentStatus.word.waiting", defaultValue: "waiting") + case .idle: + return String(localized: "sidebar.agentStatus.word.idle", defaultValue: "idle") + case .unknown, nil: + return nil + } + } + + static func lifecycleText(for row: SidebarAgentStatusRow) -> String? { + switch row.lifecycle { + case .running: + return String(localized: "sidebar.agentStatus.running", defaultValue: "Running") + case .needsInput: + return String(localized: "sidebar.agentStatus.needsInput", defaultValue: "Needs input") + case .idle: + return String(localized: "sidebar.agentStatus.idle", defaultValue: "Idle") + case .unknown, nil: + return nil + } + } + + /// The row's status line: the reported value, else the lifecycle text. + /// Idle intentionally renders nothing: absence of activity needs no label. + static func statusText(for row: SidebarAgentStatusRow) -> String? { + if let value = row.value?.trimmingCharacters(in: .whitespacesAndNewlines), !value.isEmpty { + return value + } + if row.lifecycle == .idle { + return nil + } + return lifecycleText(for: row) + } +} + +/// The agent's brand mark, or the reported/lifecycle SF symbol fallback. +struct SidebarAgentBrandIcon: View { + let row: SidebarAgentStatusRow + let fontScale: CGFloat + + var body: some View { + if let asset = SidebarAgentRowStateStyle.brandAssetsByStatusKey[row.statusKey] { + Image(asset) + .resizable() + .scaledToFit() + .frame(width: 11 * fontScale, height: 11 * fontScale) + } else if let symbol = fallbackSymbol { + CmuxSystemSymbolImage(magnified: symbol, pointSize: 8 * fontScale, weight: .medium) + .foregroundColor((SidebarAgentRowStateStyle.stateColor(for: row) ?? .secondary).opacity(0.95)) + } + } + + private var fallbackSymbol: String? { + if let icon = row.icon?.trimmingCharacters(in: .whitespacesAndNewlines), !icon.isEmpty { + if icon.hasPrefix("sf:") { return String(icon.dropFirst(3)) } + if icon.hasPrefix("emoji:") || icon.hasPrefix("text:") { return nil } + return icon + } + switch row.lifecycle { + case .running: return "bolt.fill" + case .needsInput: return "exclamationmark.bubble.fill" + case .idle: return "checkmark.circle" + case .unknown, nil: return "person.crop.square" + } + } +} + +/// One agent row. Primary text is the session/tab name (rename wins, then the +/// live surface title); the status rides second. Each row is its own +/// hover-highlighted button so clicks never fight workspace selection. +struct SidebarAgentStatusEntryRowView: View { + let row: SidebarAgentStatusRow + let fontScale: CGFloat + let layout: SidebarAgentRowLayout + let onFocusPanel: (UUID) -> Void + + @State private var isHovering = false + + var body: some View { + Button { + onFocusPanel(row.panelId) + if let url = row.url { + NSWorkspace.shared.open(url) + } + } label: { + content + } + .buttonStyle(.plain) + .background( + RoundedRectangle(cornerRadius: 5, style: .continuous) + .fill(Color.primary.opacity(isHovering && !isInCard ? 0.07 : 0)) + ) + .onHover { isHovering = $0 } + .safeHelp(helpText) + } + + private var isInCard: Bool { + if case .inCard = layout { return true } + return false + } + + @ViewBuilder + private var content: some View { + HStack(spacing: 4) { + if case .tree = layout { + Text(verbatim: "└") + .cmuxFont(size: 9 * fontScale) + .foregroundColor(.secondary.opacity(0.5)) + } + SidebarAgentBrandIcon(row: row, fontScale: fontScale) + if let stateColor = SidebarAgentRowStateStyle.stateColor(for: row) { + Circle() + .fill(stateColor) + .frame(width: 5 * fontScale, height: 5 * fontScale) + } + Text(primaryText) + .cmuxFont(size: 10 * fontScale, weight: .medium) + .foregroundColor(primaryColor) + .lineLimit(1) + .truncationMode(.middle) + if let status = statusLineText { + statusTextView(status) + .lineLimit(1) + .truncationMode(.tail) + } + Spacer(minLength: 0) + } + .padding(.vertical, isInCard ? 1 : 3) + .padding(.horizontal, isInCard ? 0 : 6) + .frame(maxWidth: .infinity, alignment: .leading) + .contentShape(Rectangle()) + } + + /// Session/tab name first; agent-type name when the pane has no title yet. + private var primaryText: String { + row.paneLabel ?? SidebarAgentRowStateStyle.agentDisplayName(statusKey: row.statusKey) + } + + private var statusLineText: String? { + SidebarAgentRowStateStyle.statusText(for: row) + } + + @ViewBuilder + private func statusTextView(_ status: String) -> some View { + if row.format == .markdown, + let attributed = try? AttributedString( + markdown: status, + options: .init(interpretedSyntax: .inlineOnlyPreservingWhitespace) + ) { + Text(attributed) + .cmuxFont(size: 9.5 * fontScale) + .foregroundColor(secondaryColor) + } else { + Text(status) + .cmuxFont(size: 9.5 * fontScale) + .foregroundColor(secondaryColor) + } + } + + private var primaryColor: Color { + if case let .inCard(isActive, activeForeground) = layout, isActive { + return activeForeground + } + return .primary.opacity(0.85) + } + + private var secondaryColor: Color { + if case let .inCard(isActive, activeForeground) = layout, isActive { + return activeForeground.opacity(0.65) + } + return .secondary.opacity(0.9) + } + + private var helpText: String { + [primaryText, statusLineText].compactMap { $0 }.joined(separator: " · ") + } +} + + +/// The picked design (round-2 mock "G"): in-card accordion under the +/// workspace title, one row per agent with a right-aligned state word, and a +/// periwinkle accent bar + tint marking the ACTIVE agent (the workspace's +/// focused pane). Selection styling of the card itself is handled by +/// `TabItemView` (graphite instead of the blue selection) while this variant +/// is active. diff --git a/Sources/SidebarAgentStatusRowsSummary.swift b/Sources/SidebarAgentStatusRowsSummary.swift new file mode 100644 index 000000000000..c15f136e29d1 --- /dev/null +++ b/Sources/SidebarAgentStatusRowsSummary.swift @@ -0,0 +1,44 @@ +import Foundation + +/// Aggregate over the agent rows of one workspace, shown in the accordion +/// header of `SidebarAgentStatusRows` (and standing in for the rows while +/// collapsed). +struct SidebarAgentStatusRowsSummary: Equatable { + let agentCount: Int + let needsInputCount: Int + let runningCount: Int + + init(rows: [SidebarAgentStatusRow]) { + agentCount = rows.count + needsInputCount = rows.filter { $0.lifecycle == .needsInput }.count + runningCount = rows.filter { $0.lifecycle == .running }.count + } + + var text: String { + var parts: [String] = [] + if agentCount == 1 { + parts.append(String(localized: "sidebar.agentStatus.summary.oneAgent", defaultValue: "1 agent")) + } else { + parts.append(String( + format: String(localized: "sidebar.agentStatus.summary.agentCount", defaultValue: "%lld agents"), + agentCount + )) + } + if needsInputCount == 1 { + parts.append(String(localized: "sidebar.agentStatus.summary.oneNeedsInput", defaultValue: "1 needs input")) + } else if needsInputCount > 1 { + parts.append(String( + format: String(localized: "sidebar.agentStatus.summary.needsInputCount", defaultValue: "%lld need input"), + needsInputCount + )) + } + return parts.joined(separator: " · ") + } + + /// Worst-state accent: needs-input beats running beats idle. + var accentColorHex: String? { + if needsInputCount > 0 { return "#FF9F0A" } + if runningCount > 0 { return "#4C8DFF" } + return nil + } +} diff --git a/Sources/SidebarMetadataRowViews.swift b/Sources/SidebarMetadataRowViews.swift new file mode 100644 index 000000000000..6b1c97ce40cd --- /dev/null +++ b/Sources/SidebarMetadataRowViews.swift @@ -0,0 +1,164 @@ +import AppKit +import CmuxFoundation +import CmuxSidebar +import SwiftUI + +/// Sidebar keyed metadata rows reported over the control socket +/// (`set_status`/`report_meta`): the expandable list plus its private entry +/// row. Rows receive immutable value snapshots and closure action bundles +/// only, per the sidebar list snapshot-boundary rule. +struct SidebarMetadataRows: View { + let entries: [SidebarStatusEntry] + let isActive: Bool + let activeForegroundColor: Color + let activeSecondaryForegroundColor: Color + let fontScale: CGFloat + let onFocus: () -> Void + + @State private var isExpanded: Bool = false + private let collapsedEntryLimit = 3 + + var body: some View { + VStack(alignment: .leading, spacing: 2) { + ForEach(visibleEntries, id: \.key) { entry in + SidebarMetadataEntryRow( + entry: entry, + isActive: isActive, + activeForegroundColor: activeForegroundColor, + fontScale: fontScale, + onFocus: onFocus + ) + } + + if shouldShowToggle { + Button(isExpanded ? String(localized: "sidebar.metadata.showLess", defaultValue: "Show less") : String(localized: "sidebar.metadata.showMore", defaultValue: "Show more")) { + onFocus() + withAnimation(.easeInOut(duration: 0.15)) { + isExpanded.toggle() + } + } + .buttonStyle(.plain) + .cmuxFont(size: 10 * fontScale, weight: .semibold) + .foregroundColor(isActive ? activeSecondaryForegroundColor : .secondary.opacity(0.9)) + .frame(maxWidth: .infinity, alignment: .leading) + } + } + .safeHelp(helpText) + } + + private var visibleEntries: [SidebarStatusEntry] { + guard !isExpanded, entries.count > collapsedEntryLimit else { return entries } + return Array(entries.prefix(collapsedEntryLimit)) + } + + private var helpText: String { + entries.map { entry in + let trimmed = entry.value.trimmingCharacters(in: .whitespacesAndNewlines) + return trimmed.isEmpty ? entry.key : trimmed + } + .joined(separator: "\n") + } + + private var shouldShowToggle: Bool { + entries.count > collapsedEntryLimit + } +} + +private struct SidebarMetadataEntryRow: View { + let entry: SidebarStatusEntry + let isActive: Bool + let activeForegroundColor: Color + let fontScale: CGFloat + let onFocus: () -> Void + + var body: some View { + Group { + if let url = entry.url { + Button { + onFocus() + NSWorkspace.shared.open(url) + } label: { + rowContent(underlined: true) + } + .buttonStyle(.plain) + .safeHelp(url.absoluteString) + } else { + rowContent(underlined: false) + .contentShape(Rectangle()) + .onTapGesture { onFocus() } + } + } + } + + @ViewBuilder + private func rowContent(underlined: Bool) -> some View { + HStack(alignment: .center, spacing: 4) { + if let icon = iconView { + icon + .foregroundColor(foregroundColor.opacity(0.95)) + } + metadataText(underlined: underlined) + .lineLimit(1) + .truncationMode(.tail) + Spacer(minLength: 0) + } + .cmuxFont(size: 10 * fontScale) + .frame(maxWidth: .infinity, alignment: .leading) + } + + private var foregroundColor: Color { + if isActive, + let raw = entry.color, + Color(hex: raw) != nil { + return activeForegroundColor + } + if let raw = entry.color, let explicit = Color(hex: raw) { + return explicit + } + return isActive ? activeForegroundColor.opacity(0.84) : .secondary + } + + private var iconView: AnyView? { + guard let iconRaw = entry.icon?.trimmingCharacters(in: .whitespacesAndNewlines), + !iconRaw.isEmpty else { + return nil + } + if iconRaw.hasPrefix("emoji:") { + let value = String(iconRaw.dropFirst("emoji:".count)) + guard !value.isEmpty else { return nil } + return AnyView(Text(value).cmuxFont(size: 9 * fontScale)) + } + if iconRaw.hasPrefix("text:") { + let value = String(iconRaw.dropFirst("text:".count)) + guard !value.isEmpty else { return nil } + return AnyView(Text(value).cmuxFont(size: 8 * fontScale, weight: .semibold)) + } + let symbolName: String + if iconRaw.hasPrefix("sf:") { + symbolName = String(iconRaw.dropFirst("sf:".count)) + } else { + symbolName = iconRaw + } + guard !symbolName.isEmpty else { return nil } + return AnyView(CmuxSystemSymbolImage(magnified: symbolName, pointSize: 8 * fontScale, weight: .medium)) + } + + @ViewBuilder + private func metadataText(underlined: Bool) -> some View { + let trimmed = entry.value.trimmingCharacters(in: .whitespacesAndNewlines) + let display = trimmed.isEmpty ? entry.key : trimmed + if entry.format == .markdown, + let attributed = try? AttributedString( + markdown: display, + options: .init(interpretedSyntax: .inlineOnlyPreservingWhitespace) + ) { + Text(attributed) + .underline(underlined) + .foregroundColor(foregroundColor) + } else { + Text(display) + .underline(underlined) + .foregroundColor(foregroundColor) + } + } +} diff --git a/Sources/TabManager.swift b/Sources/TabManager.swift index 48c4fb9dae83..ce3c56872c82 100644 --- a/Sources/TabManager.swift +++ b/Sources/TabManager.swift @@ -5573,6 +5573,7 @@ extension TabManager { hasher.combine(workspace.isPinned) hasher.combine(workspace.panels.count) hasher.combine(workspace.statusEntries.count) + workspace.hashPanelScopedAgentStatus(into: &hasher) hasher.combine(workspace.metadataBlocks.count) hasher.combine(workspace.logEntries.count) hasher.combine(workspace.panelDirectories.count) @@ -5587,7 +5588,6 @@ extension TabManager { into: &hasher ) let panelIds = workspace.panels.keys.sorted { $0.uuidString < $1.uuidString } - hasher.combine(panelIds.count) for panelId in panelIds { hasher.combine(panelId) hasher.combine(workspace.panelDirectories[panelId] ?? "") diff --git a/Sources/TerminalController+ControlSidebarContext.swift b/Sources/TerminalController+ControlSidebarContext.swift index b2f70eec2905..56b273c1f79f 100644 --- a/Sources/TerminalController+ControlSidebarContext.swift +++ b/Sources/TerminalController+ControlSidebarContext.swift @@ -26,49 +26,72 @@ extension TerminalController: ControlSidebarContext { priority: Int, format: ControlSidebarMetadataFormat, panelID: UUID?, - pid: Int32? + pid: Int32?, + dynamicAgentRowKey: Bool ) { let appFormat = SidebarMetadataFormat(rawValue: format.rawValue) ?? .plain controlSidebarScheduleMutation(target: target) { _, tab in if let panelId = panelID, !tab.panels.keys.contains(panelId) { return } - guard Self.shouldReplaceStatusEntry( - current: tab.statusEntries[key], + let entry = SidebarStatusEntry( key: key, value: value, icon: icon, color: color, url: url, priority: priority, - format: appFormat - ) else { - // Still update PID tracking even if the status display hasn't changed. - if let pid { - tab.recordAgentPID(key: key, pid: pid, panelId: panelID) - } - return + format: appFormat, + timestamp: Date() + ) + if dynamicAgentRowKey { + tab.registerDynamicAgentRowKey(key) } - tab.statusEntries[key] = SidebarStatusEntry( + if Self.shouldReplaceStatusEntry( + current: tab.statusEntries[key], key: key, value: value, icon: icon, color: color, url: url, priority: priority, - format: appFormat, - timestamp: Date() - ) + format: appFormat + ) { + tab.statusEntries[key] = entry + } + // PID tracking updates even when the status display hasn't changed. + // It must also run BEFORE the panel-scoped write below: recording a + // new agent PID evicts stale structured runtimes on the panel and + // that cleanup clears their panel-scoped entries, so writing the + // panel copy first would let the eviction delete it. if let pid { tab.recordAgentPID(key: key, pid: pid, panelId: panelID) } + // The panel-scoped copy is recorded independently of the workspace + // guard above: the workspace slot is last-write-wins per key, so + // "no change" there can still be a change for this panel's own row. + // recordPanelStatusEntry drops identical repeats itself so agent + // heartbeats do not churn the sidebar snapshot. + if let panelId = panelID { + tab.recordPanelStatusEntry(entry, panelId: panelId) + } } } + /// `clear_status ` is the workspace-scoped user command: it removes + /// the key from the whole workspace, including every pane's panel-scoped + /// copy, by contract. Agent lifecycle hooks never send it; they clean up + /// via `clear_agent_pid --panel= --clear-status`, which + /// routes through the panel-scoped `clearAgentPID` and cannot touch + /// sibling panes' rows. nonisolated func controlSidebarScheduleStatusClear(target: ControlSidebarTabTarget, key: String) { controlSidebarScheduleMutation(target: target) { _, tab in _ = tab.statusEntries.removeValue(forKey: key) - tab.clearAgentPID(key: key) + _ = tab.clearPanelStatusEntries(statusKey: key) + // Bare shared keys can have been displaced onto synthesized + // panel-scoped keys; the workspace-scoped clear must reap those + // runtimes and lifecycles too, not just the exact bare key. + tab.clearAgentRuntimes(forStatusKey: key) } } @@ -169,6 +192,9 @@ extension TerminalController: ControlSidebarContext { if let panelId = panelID, !tab.panels.keys.contains(panelId) { return } + if panelID != nil { + tab.registerDynamicAgentRowKey(key) + } tab.setAgentLifecycle(key: key, panelId: panelID, lifecycle: lifecycle) } } diff --git a/Sources/Workspace+AgentLifecycle.swift b/Sources/Workspace+AgentLifecycle.swift index 60f5671c1248..01be168a0fac 100644 --- a/Sources/Workspace+AgentLifecycle.swift +++ b/Sources/Workspace+AgentLifecycle.swift @@ -30,6 +30,9 @@ extension Workspace { recordAgentLifecycleChange(panelId: panelId) } } + if didClear { + pruneDynamicAgentRowKeyIfUnused(key) + } return didClear } @@ -57,13 +60,22 @@ extension Workspace { } } } + // Safe for migrated manual keys: the prune is usage-checked, and a + // migrated key is still in use on its host panel. + for key in removed.keys { + pruneDynamicAgentRowKeyIfUnused(key) + } recordAgentLifecycleChange(panelId: panelId) } func clearAllAgentLifecycleStates() { let panelIds = Array(agentLifecycleStatesByPanelId.keys) guard !panelIds.isEmpty else { return } + let removedKeys = Set(agentLifecycleStatesByPanelId.values.flatMap(\.keys)) agentLifecycleStatesByPanelId.removeAll() + for key in removedKeys { + pruneDynamicAgentRowKeyIfUnused(key) + } for panelId in panelIds { recordAgentLifecycleChange(panelId: panelId) } diff --git a/Sources/Workspace+AgentPIDOwnership.swift b/Sources/Workspace+AgentPIDOwnership.swift new file mode 100644 index 000000000000..2a990e3d283e --- /dev/null +++ b/Sources/Workspace+AgentPIDOwnership.swift @@ -0,0 +1,163 @@ +import Foundation + +// Panel ownership of agent PID keys: which pane owns each reported key, and +// how a bare shared key (claude-style hooks report one key per agent type for +// the whole workspace) moves between panes without erasing a sibling pane's +// live agent row. Cleanup of the maps written here stays with the callers in +// `Workspace+PanelLifecycle.swift` (`clearAgentPID`, the liveness sweeps, and +// `discardClosedPanelLifecycleState`). +extension Workspace { + func removeAgentPIDOwnership(key: String) { + if let previousPanelId = agentPIDPanelIdsByKey[key] { + agentPIDKeysByPanelId[previousPanelId]?.remove(key) + if agentPIDKeysByPanelId[previousPanelId]?.isEmpty == true { + agentPIDKeysByPanelId.removeValue(forKey: previousPanelId) + } + agentPIDPanelIdsByKey.removeValue(forKey: key) + } + } + + func recordAgentPIDOwnership(key: String, panelId: UUID) { + if let previousPanelId = agentPIDPanelIdsByKey[key], previousPanelId != panelId { + preserveDisplacedBareKeyRuntime(key: key, displacedPanelId: previousPanelId) + removeAgentPIDOwnership(key: key) + } + if isStructuredAgentHookPIDKey(key) { + let statusKey = agentStatusKey(forAgentPIDKey: key) + let synthesizedKey = Self.synthesizedDisplacedPIDKey(statusKey: statusKey, panelId: panelId) + let stalePanelKeys = agentPIDKeysByPanelId[panelId]?.filter { + $0 != key && isStructuredAgentHookPIDKey($0) + } ?? [] + for staleKey in stalePanelKeys { + // The key-shape change (bare key returning to a pane holding + // this pane's own synthesized displacement key) reaps only the + // pid bookkeeping: the same runtime keeps reporting, so its + // status entry AND lifecycle survive. Anything else, including + // a NEW session of the same agent type under a different + // suffixed key, is a real replacement: clear everything. + if staleKey == synthesizedKey { + _ = reapSynthesizedDisplacementKeyPreservingRow(staleKey) + } else { + _ = clearAgentPID(key: staleKey, panelId: panelId, clearStatus: true, refreshPorts: false) + } + } + } + agentPIDPanelIdsByKey[key] = panelId + agentPIDKeysByPanelId[panelId, default: []].insert(key) + } + + /// Claude-style dedicated hooks share ONE bare PID key per agent type + /// across every pane of a workspace, so a report from pane B displaces + /// pane A's ownership even though A still hosts its own live agent. + /// Re-key A's record to a synthesized panel-scoped key instead of dropping + /// its presence: the pid and start-time identity move with it, so the + /// liveness sweep still owns cleanup, and A keeps its sidebar row. + private func preserveDisplacedBareKeyRuntime(key: String, displacedPanelId: UUID) { + guard isStructuredAgentHookPIDKey(key), !key.contains(".") else { return } + guard panels[displacedPanelId] != nil, let pid = agentPIDs[key] else { return } + let synthesizedKey = Self.synthesizedDisplacedPIDKey(statusKey: key, panelId: displacedPanelId) + agentPIDs[synthesizedKey] = pid + agentPIDProcessIdentitiesByKey[synthesizedKey] = agentPIDProcessIdentitiesByKey[key] + agentPIDPanelIdsByKey[synthesizedKey] = displacedPanelId + agentPIDKeysByPanelId[displacedPanelId, default: []].insert(synthesizedKey) + } + + static func synthesizedDisplacedPIDKey(statusKey: String, panelId: UUID) -> String { + "\(statusKey).pane-\(panelId.uuidString)" + } + + /// Removes ONLY the pid bookkeeping for a pane's synthesized displacement + /// key. The pane's status entry and lifecycle survive: the same runtime is + /// re-keying back to the bare key, not exiting. + @discardableResult + private func reapSynthesizedDisplacementKeyPreservingRow(_ synthesizedKey: String) -> Bool { + var didChange = false + if agentPIDs.removeValue(forKey: synthesizedKey) != nil { + didChange = true + } + if agentPIDProcessIdentitiesByKey.removeValue(forKey: synthesizedKey) != nil { + didChange = true + } + if agentPIDPanelIdsByKey[synthesizedKey] != nil { + removeAgentPIDOwnership(key: synthesizedKey) + didChange = true + } + return didChange + } + + /// Workspace-scoped removal of every runtime tracked for a status key: + /// the bare shared key, every synthesized displacement key, and every + /// pane's lifecycle for the key. This backs the `clear_status ` + /// contract ("removes the key from the whole workspace"). The liveness + /// sweep must NOT use this: it judges each pid key's process separately, + /// and a dead bare-key owner does not imply displaced siblings are dead. + func clearAgentRuntimes(forStatusKey statusKey: String, refreshPorts: Bool = true) { + var keysToClear = Set() + for key in agentPIDs.keys where agentStatusKey(forAgentPIDKey: key) == statusKey { + keysToClear.insert(key) + } + for key in agentPIDPanelIdsByKey.keys where agentStatusKey(forAgentPIDKey: key) == statusKey { + keysToClear.insert(key) + } + var didChange = false + for key in keysToClear { + if clearAgentPID(key: key, clearStatus: false, refreshPorts: false) { + didChange = true + } + } + if clearAgentLifecycle(key: statusKey) { + didChange = true + } + pruneDynamicAgentRowKeyIfUnused(statusKey) + if didChange, refreshPorts { + refreshTrackedAgentPorts() + } + } + + @discardableResult + func clearOtherStructuredAgentRuntimes(onPanel panelId: UUID, keeping retainedKey: String) -> Bool { + guard isStructuredAgentHookPIDKey(retainedKey) else { return false } + let retainedStatusKey = agentStatusKey(forAgentPIDKey: retainedKey) + let synthesizedKey = Self.synthesizedDisplacedPIDKey(statusKey: retainedStatusKey, panelId: panelId) + let staleKeys = agentPIDKeysByPanelId[panelId] ?? [] + var didChange = false + for staleKey in staleKeys where staleKey != retainedKey && isStructuredAgentHookPIDKey(staleKey) { + // The key-shape change (bare key returning to a pane holding this + // pane's own synthesized displacement key) reaps only the pid + // bookkeeping: the same runtime keeps reporting, so its status + // entry AND lifecycle survive. Anything else, including a NEW + // session of the same agent type under a different suffixed key, + // is a real replacement: clear everything. + if staleKey == synthesizedKey { + if reapSynthesizedDisplacementKeyPreservingRow(staleKey) { + didChange = true + } + } else if clearAgentPID(key: staleKey, panelId: panelId, clearStatus: true, refreshPorts: false) { + didChange = true + } + } + // A pane can hold a panel-scoped structured status with NO recorded + // pid (`set_status --panel` without `--pid`), which the loop above + // never sees. A different structured agent replacing it on this pane + // must drop that entry and its lifecycle, or the row keeps showing + // the dead agent's text (nil-entry candidates lose to any entry in + // sidebarAgentStatusRows' comparator). Mirror pane close for the + // workspace-level slot: drop it when this pane was its last owner. + for statusKey in Set((statusEntriesByPanelId[panelId] ?? [:]).keys) + where statusKey != retainedStatusKey && isAgentRowKey(statusKey) { + if clearPanelStatusEntry(statusKey: statusKey, panelId: panelId) { + didChange = true + } + if clearAgentLifecycle(key: statusKey, panelId: panelId) { + didChange = true + } + if panelsOwningAgentStatusKey(statusKey).isEmpty, + !hasAgentRuntime(forStatusKey: statusKey), + statusEntries.removeValue(forKey: statusKey) != nil { + didChange = true + } + pruneDynamicAgentRowKeyIfUnused(statusKey) + } + return didChange + } +} diff --git a/Sources/Workspace+DetachedSurfaceTransfer.swift b/Sources/Workspace+DetachedSurfaceTransfer.swift index fb0a03894275..def97559529c 100644 --- a/Sources/Workspace+DetachedSurfaceTransfer.swift +++ b/Sources/Workspace+DetachedSurfaceTransfer.swift @@ -14,6 +14,7 @@ extension Workspace { /// an unrelated process" (same contract as `isRecordedAgentPIDLive`). let agentPIDProcessIdentities: [String: AgentPIDProcessIdentity] let agentPIDKeys: Set + let dynamicAgentRowKeys: Set } struct DetachedSurfaceTransfer { diff --git a/Sources/Workspace+PanelLifecycle.swift b/Sources/Workspace+PanelLifecycle.swift index 595b82a5758f..28d88a991953 100644 --- a/Sources/Workspace+PanelLifecycle.swift +++ b/Sources/Workspace+PanelLifecycle.swift @@ -6,7 +6,7 @@ import Foundation import CmuxSidebar extension Workspace { - private static let structuredAgentHookStatusKeys = AgentHibernationLifecycleStatusKeys.allowedStatusKeys + static let structuredAgentHookStatusKeys = AgentHibernationLifecycleStatusKeys.allowedStatusKeys private static let managedSubagentEnvironmentKey = "CMUX_AGENT_MANAGED_SUBAGENT" private static let truthyStartupEnvironmentValues: Set = ["1", "true", "yes", "on", "enabled"] @@ -47,17 +47,29 @@ extension Workspace { agentPIDIdentitiesForPanel[key] = agentPIDProcessIdentitiesByKey[key] } let statusKey = agentStatusKey(forAgentPIDKey: key) - if let statusEntry = statusEntries[statusKey] { + if let statusEntry = statusEntriesByPanelId[panelId]?[statusKey] { + statusEntriesForPanel[statusKey] = statusEntry + } else if panelsOwningAgentStatusKey(statusKey).isSubset(of: [panelId]), + let statusEntry = statusEntries[statusKey] { + // The workspace-level slot is last-write-wins across panes, so + // only attribute it to this panel when no other pane can own + // the key; otherwise a transferred pane would adopt a sibling + // agent's status text as its own. statusEntriesForPanel[statusKey] = statusEntry } } + for (statusKey, statusEntry) in statusEntriesByPanelId[panelId] ?? [:] + where statusEntriesForPanel[statusKey] == nil { + statusEntriesForPanel[statusKey] = statusEntry + } guard !statusEntriesForPanel.isEmpty || !agentPIDsForPanel.isEmpty || !pidKeys.isEmpty else { return nil } return DetachedAgentRuntimeState( panelId: panelId, statusEntries: statusEntriesForPanel, agentPIDs: agentPIDsForPanel, agentPIDProcessIdentities: agentPIDIdentitiesForPanel, - agentPIDKeys: pidKeys + agentPIDKeys: pidKeys, + dynamicAgentRowKeys: dynamicAgentRowKeys.intersection(statusEntriesForPanel.keys) ) } @@ -71,7 +83,7 @@ extension Workspace { return String(key[.. Bool { + func hasAgentRuntime(forStatusKey statusKey: String) -> Bool { for key in agentPIDs.keys where agentStatusKey(forAgentPIDKey: key) == statusKey { return true } @@ -81,62 +93,22 @@ extension Workspace { return false } - private func removeAgentPIDOwnership(key: String) { - if let previousPanelId = agentPIDPanelIdsByKey[key] { - agentPIDKeysByPanelId[previousPanelId]?.remove(key) - if agentPIDKeysByPanelId[previousPanelId]?.isEmpty == true { - agentPIDKeysByPanelId.removeValue(forKey: previousPanelId) - } - agentPIDPanelIdsByKey.removeValue(forKey: key) - } - } - - private func recordAgentPIDOwnership(key: String, panelId: UUID) { - if let previousPanelId = agentPIDPanelIdsByKey[key], previousPanelId != panelId { - removeAgentPIDOwnership(key: key) - } - if isStructuredAgentHookPIDKey(key) { - let statusKey = agentStatusKey(forAgentPIDKey: key) - let stalePanelKeys = agentPIDKeysByPanelId[panelId]?.filter { - $0 != key && - isStructuredAgentHookPIDKey($0) && - agentStatusKey(forAgentPIDKey: $0) != statusKey - } ?? [] - for staleKey in stalePanelKeys { - _ = clearAgentPID(key: staleKey, panelId: panelId, clearStatus: true, refreshPorts: false) - } - } - agentPIDPanelIdsByKey[key] = panelId - agentPIDKeysByPanelId[panelId, default: []].insert(key) - } - - @discardableResult - private func clearOtherStructuredAgentRuntimes(onPanel panelId: UUID, keeping retainedKey: String) -> Bool { - guard isStructuredAgentHookPIDKey(retainedKey) else { return false } - let staleKeys = agentPIDKeysByPanelId[panelId] ?? [] - var didChange = false - for staleKey in staleKeys where staleKey != retainedKey && isStructuredAgentHookPIDKey(staleKey) { - if clearAgentPID(key: staleKey, panelId: panelId, clearStatus: true, refreshPorts: false) { - didChange = true - } - } - return didChange - } - @discardableResult func recordAgentPID(key: String, pid: pid_t, panelId: UUID?, refreshPorts: Bool = true) -> Bool { let previousPanelId = agentPIDPanelIdsByKey[key] var didClearOtherStructuredAgentRuntime = false + // Ownership displacement must run BEFORE the bare key's pid/identity + // are overwritten: preserveDisplacedBareKeyRuntime re-keys the + // previous owner's runtime and must capture the DISPLACED pane's pid, + // not the new reporter's. if let panelId { didClearOtherStructuredAgentRuntime = clearOtherStructuredAgentRuntimes(onPanel: panelId, keeping: key) - } - agentPIDs[key] = pid - agentPIDProcessIdentitiesByKey[key] = Self.agentPIDProcessIdentity(pid: pid) - if let panelId { recordAgentPIDOwnership(key: key, panelId: panelId) } else { removeAgentPIDOwnership(key: key) } + agentPIDs[key] = pid + agentPIDProcessIdentitiesByKey[key] = Self.agentPIDProcessIdentity(pid: pid) if refreshPorts { refreshTrackedAgentPorts() } syncTerminalTabAgentIconAssets(forPanelIds: previousPanelId, panelId) return didClearOtherStructuredAgentRuntime @@ -186,6 +158,8 @@ extension Workspace { agentPIDProcessIdentitiesByKey.removeAll() agentPIDPanelIdsByKey.removeAll() agentPIDKeysByPanelId.removeAll() + statusEntriesByPanelId.removeAll() + pruneDynamicAgentRowKeys() syncTerminalTabAgentIconAssetsForAllTerminalPanels() if hadAgentPIDs, refreshPorts { refreshTrackedAgentPorts() } } @@ -237,71 +211,8 @@ extension Workspace { return Self.truthyStartupEnvironmentValues.contains(rawValue) } - func sidebarStatusEntriesVisibleForDisplay() -> [SidebarStatusEntry] { - let visibleStructuredStatusKeys = visibleStructuredAgentStatusKeysByPanel() - return statusEntries.values.filter { entry in - shouldDisplaySidebarStatusEntry(entry, visibleStructuredStatusKeys: visibleStructuredStatusKeys) - } - } - - private func shouldDisplaySidebarStatusEntry( - _ entry: SidebarStatusEntry, - visibleStructuredStatusKeys: Set - ) -> Bool { - guard Self.structuredAgentHookStatusKeys.contains(entry.key) else { - return true - } - return visibleStructuredStatusKeys.contains(entry.key) - } - - private func visibleStructuredAgentStatusKeysByPanel() -> Set { - var statusKeysByPanelId: [UUID: Set] = [:] - for (key, panelId) in agentPIDPanelIdsByKey - where panels[panelId] != nil { - let statusKey = agentStatusKey(forAgentPIDKey: key) - guard Self.structuredAgentHookStatusKeys.contains(statusKey), - statusEntries[statusKey] != nil else { - continue - } - statusKeysByPanelId[panelId, default: []].insert(statusKey) - } - var visibleStatusKeys = Set() - for statusKeys in statusKeysByPanelId.values { - let winningEntry = statusKeys.compactMap { statusEntries[$0] }.max { - isSidebarStatusEntryLessCurrent($0, than: $1) - } - if let winningEntry { - visibleStatusKeys.insert(winningEntry.key) - } - } - - for key in agentPIDs.keys where agentPIDPanelIdsByKey[key] == nil { - let statusKey = agentStatusKey(forAgentPIDKey: key) - guard Self.structuredAgentHookStatusKeys.contains(statusKey), - statusEntries[statusKey] != nil else { - continue - } - visibleStatusKeys.insert(statusKey) - } - - return visibleStatusKeys - } - - private func isSidebarStatusEntryLessCurrent( - _ lhs: SidebarStatusEntry, - than rhs: SidebarStatusEntry - ) -> Bool { - if lhs.timestamp != rhs.timestamp { - return lhs.timestamp < rhs.timestamp - } - if lhs.priority != rhs.priority { - return lhs.priority < rhs.priority - } - return lhs.key > rhs.key - } - - private func isStructuredAgentHookPIDKey(_ key: String) -> Bool { - Self.structuredAgentHookStatusKeys.contains(agentStatusKey(forAgentPIDKey: key)) + func isStructuredAgentHookPIDKey(_ key: String) -> Bool { + isAgentRowKey(agentStatusKey(forAgentPIDKey: key)) } @discardableResult @@ -313,7 +224,30 @@ extension Workspace { ) -> Bool { let ownedPanelId = agentPIDPanelIdsByKey[key] if let panelId, let ownedPanelId, ownedPanelId != panelId { - return false + // Bare shared keys migrate ownership to the last reporting pane, + // so an earlier pane's exit hook arrives with a panel that no + // longer owns the PID key. Never touch the current owner's + // runtime, but still drop the exiting pane's own panel-scoped row + // state or its sidebar row would stay stale until the pane closes. + var didChange = false + let statusKey = agentStatusKey(forAgentPIDKey: key) + if clearAgentLifecycle(key: statusKey, panelId: panelId) { + didChange = true + } + if clearStatus, clearPanelStatusEntry(statusKey: statusKey, panelId: panelId) { + didChange = true + } + // The exiting pane's runtime may live under a synthesized + // displacement key (bare-key ownership moved to another pane + // after this agent's last report); reap it with the exit hook + // instead of waiting for the liveness sweep. + let synthesizedKey = Self.synthesizedDisplacedPIDKey(statusKey: statusKey, panelId: panelId) + if agentPIDPanelIdsByKey[synthesizedKey] == panelId, + clearAgentPID(key: synthesizedKey, panelId: panelId, clearStatus: clearStatus, refreshPorts: refreshPorts) { + didChange = true + } + pruneDynamicAgentRowKeyIfUnused(statusKey) + return didChange } let statusKeyToClear = clearStatus ? agentStatusKey(forAgentPIDKey: key) : nil @@ -333,12 +267,20 @@ extension Workspace { if clearAgentLifecycle(key: lifecycleStatusKey, panelId: lifecyclePanelId) { didChange = true } + if let statusKeyToClear, clearPanelStatusEntry(statusKey: statusKeyToClear, panelId: lifecyclePanelId) { + didChange = true + } } if let statusKeyToClear, !hasAgentRuntime(forStatusKey: statusKeyToClear), statusEntries.removeValue(forKey: statusKeyToClear) != nil { didChange = true } + if let statusKeyToClear { + pruneDynamicAgentRowKeyIfUnused(statusKeyToClear) + } else { + pruneDynamicAgentRowKeyIfUnused(agentStatusKey(forAgentPIDKey: key)) + } if didChange, refreshPorts { refreshTrackedAgentPorts() } @@ -379,7 +321,11 @@ extension Workspace { func adoptDetachedAgentRuntimeState(_ runtimeState: DetachedAgentRuntimeState?) { guard let runtimeState else { return } for (statusKey, statusEntry) in runtimeState.statusEntries { + if runtimeState.dynamicAgentRowKeys.contains(statusKey) { + registerDynamicAgentRowKey(statusKey) + } statusEntries[statusKey] = statusEntry + recordPanelStatusEntry(statusEntry, panelId: runtimeState.panelId) } var didAdoptAgentPID = false for (key, pid) in runtimeState.agentPIDs { @@ -466,6 +412,8 @@ extension Workspace { manualUnreadMarkedAt.removeValue(forKey: panelId) panelShellActivityStates.removeValue(forKey: panelId) clearAgentLifecycleStates(panelId: panelId) + let closedPanelStatusKeys = Set((statusEntriesByPanelId[panelId] ?? [:]).keys) + statusEntriesByPanelId.removeValue(forKey: panelId) surfaceTTYNames.removeValue(forKey: panelId) discardRemotePTYSessionID(panelId: panelId) surfaceResumeBindingsByPanelId.removeValue(forKey: panelId) @@ -476,6 +424,21 @@ extension Workspace { debugSessionSnapshotSyntheticScrollbackByPanelId.removeValue(forKey: panelId) #endif discardAgentRuntimeState(closedAgentRuntimeState) + // A pane can hold a panel-scoped structured status with no recorded + // PID (`set_status --panel` without `--pid`); discardAgentRuntimeState + // only sweeps PID-owned keys. Clear the workspace-level slot for keys + // whose last plausible owner was this pane, or a future same-type + // agent pane would adopt the dead pane's text via the sole-owner + // fallback in sidebarAgentStatusRows(). + for statusKey in closedPanelStatusKeys + where panelsOwningAgentStatusKey(statusKey).isEmpty && !hasAgentRuntime(forStatusKey: statusKey) { + statusEntries.removeValue(forKey: statusKey) + } + for statusKey in closedPanelStatusKeys { + pruneDynamicAgentRowKeyIfUnused(statusKey) + } + // Main's icon-state discard also removes restoredAgentSnapshots / + // restoredAgentResumeStates for the panel. discardTerminalTabAgentIconState(forPanelId: panelId) restoredResumeSessionWorkingDirectoriesByPanelId.removeValue(forKey: panelId) invalidatedRestoredAgentFingerprintsByPanelId.removeValue(forKey: panelId) diff --git a/Sources/Workspace+SidebarAgentStatus.swift b/Sources/Workspace+SidebarAgentStatus.swift new file mode 100644 index 000000000000..d009edbf3b7b --- /dev/null +++ b/Sources/Workspace+SidebarAgentStatus.swift @@ -0,0 +1,416 @@ +import CmuxSidebar +import Foundation + +/// Immutable per-pane agent status row consumed by the sidebar (a value +/// snapshot only, per the sidebar list snapshot-boundary rule). +struct SidebarAgentStatusRow: Equatable, Identifiable { + let panelId: UUID + let statusKey: String + let value: String? + let icon: String? + let color: String? + let url: URL? + /// How `value` renders (markdown vs plain); tied to `value`'s source entry. + let format: SidebarMetadataFormat + let lifecycle: AgentHibernationLifecycleState? + let paneLabel: String? + let priority: Int + let timestamp: Date + + var id: String { "\(panelId.uuidString)|\(statusKey)" } +} + +/// Panel-scoped structured agent status: storage, visibility filtering, and +/// the per-agent sidebar row projection. Lifecycle bookkeeping (PID ownership, +/// transfer, cleanup) stays in `Workspace+PanelLifecycle.swift`. +extension Workspace { + var statusEntriesByPanelId: [UUID: [String: SidebarStatusEntry]] { + get { sidebarAgentRuntimeObservation.statusEntriesByPanelId } + set { sidebarAgentRuntimeObservation.setStatusEntriesByPanelId(newValue) } + } + + var dynamicAgentRowKeys: Set { + get { sidebarAgentRuntimeObservation.dynamicAgentRowKeys } + set { sidebarAgentRuntimeObservation.setDynamicAgentRowKeys(newValue) } + } + + func isAgentRowKey(_ key: String) -> Bool { + Self.structuredAgentHookStatusKeys.contains(key) || dynamicAgentRowKeys.contains(key) + } + + func registerDynamicAgentRowKey(_ key: String) { + guard !Self.structuredAgentHookStatusKeys.contains(key), + !dynamicAgentRowKeys.contains(key) else { + return + } + dynamicAgentRowKeys.insert(key) + } + + @discardableResult + func pruneDynamicAgentRowKeyIfUnused(_ key: String) -> Bool { + guard dynamicAgentRowKeys.contains(key), + !hasRuntimeStateForDynamicAgentRowKey(key) else { + return false + } + dynamicAgentRowKeys.remove(key) + return true + } + + func pruneDynamicAgentRowKeys() { + for key in Array(dynamicAgentRowKeys) { + _ = pruneDynamicAgentRowKeyIfUnused(key) + } + } + + private func hasRuntimeStateForDynamicAgentRowKey(_ statusKey: String) -> Bool { + if statusEntries[statusKey] != nil { + return true + } + if hasAgentRuntime(forStatusKey: statusKey) { + return true + } + if statusEntriesByPanelId.values.contains(where: { $0[statusKey] != nil }) { + return true + } + if agentLifecycleStatesByPanelId.values.contains(where: { $0[statusKey] != nil }) { + return true + } + return false + } + + /// Records the panel-scoped copy of a structured agent status report, so + /// each agent pane keeps its own row even when several agents of the same + /// type share the workspace (the workspace-level `statusEntries` slot is + /// last-write-wins per agent type). Identical repeated reports are dropped + /// (ignoring the timestamp) so agent heartbeats with no visible change do + /// not invalidate the sidebar snapshot. + func recordPanelStatusEntry(_ entry: SidebarStatusEntry, panelId: UUID) { + guard isAgentRowKey(entry.key) else { return } + guard TerminalController.shouldReplaceStatusEntry( + current: statusEntriesByPanelId[panelId]?[entry.key], + key: entry.key, + value: entry.value, + icon: entry.icon, + color: entry.color, + url: entry.url, + priority: entry.priority, + format: entry.format + ) else { return } + statusEntriesByPanelId[panelId, default: [:]][entry.key] = entry + } + + @discardableResult + func clearPanelStatusEntry(statusKey: String, panelId: UUID) -> Bool { + guard var entries = statusEntriesByPanelId[panelId], + entries.removeValue(forKey: statusKey) != nil else { + return false + } + if entries.isEmpty { + statusEntriesByPanelId.removeValue(forKey: panelId) + } else { + statusEntriesByPanelId[panelId] = entries + } + pruneDynamicAgentRowKeyIfUnused(statusKey) + return true + } + + @discardableResult + func clearPanelStatusEntries(statusKey: String) -> Bool { + var didChange = false + for panelId in statusEntriesByPanelId.keys where statusEntriesByPanelId[panelId]?[statusKey] != nil { + if clearPanelStatusEntry(statusKey: statusKey, panelId: panelId) { + didChange = true + } + } + return didChange + } + + /// Every panel that plausibly owns `statusKey`: panels with a live agent + /// PID mapping to that key plus panels holding a panel-scoped entry for + /// it. Used to decide whether the ambiguous workspace-level last-write-wins + /// entry can be attributed to a single pane. + func panelsOwningAgentStatusKey(_ statusKey: String) -> Set { + var owners: Set = [] + for (key, ownerPanelId) in agentPIDPanelIdsByKey + where agentStatusKey(forAgentPIDKey: key) == statusKey { + owners.insert(ownerPanelId) + } + for (ownerPanelId, entries) in statusEntriesByPanelId where entries[statusKey] != nil { + owners.insert(ownerPanelId) + } + return owners + } + + func sidebarStatusEntriesVisibleForDisplay() -> [SidebarStatusEntry] { + let visibleStructuredStatusKeys = visibleStructuredAgentStatusKeysByPanel() + return statusEntries.values.filter { entry in + shouldDisplaySidebarStatusEntry(entry, visibleStructuredStatusKeys: visibleStructuredStatusKeys) + } + } + + private func shouldDisplaySidebarStatusEntry( + _ entry: SidebarStatusEntry, + visibleStructuredStatusKeys: Set + ) -> Bool { + guard isAgentRowKey(entry.key) else { + return true + } + return visibleStructuredStatusKeys.contains(entry.key) + } + + private func visibleStructuredAgentStatusKeysByPanel() -> Set { + var statusKeysByPanelId: [UUID: Set] = [:] + for (key, panelId) in agentPIDPanelIdsByKey + where panels[panelId] != nil { + let statusKey = agentStatusKey(forAgentPIDKey: key) + guard isAgentRowKey(statusKey), + statusEntries[statusKey] != nil else { + continue + } + statusKeysByPanelId[panelId, default: []].insert(statusKey) + } + var visibleStatusKeys = Set() + for statusKeys in statusKeysByPanelId.values { + let winningEntry = statusKeys.compactMap { statusEntries[$0] }.max { + isSidebarStatusEntryLessCurrent($0, than: $1) + } + if let winningEntry { + visibleStatusKeys.insert(winningEntry.key) + } + } + + for key in agentPIDs.keys where agentPIDPanelIdsByKey[key] == nil { + let statusKey = agentStatusKey(forAgentPIDKey: key) + guard isAgentRowKey(statusKey), + statusEntries[statusKey] != nil else { + continue + } + visibleStatusKeys.insert(statusKey) + } + + return visibleStatusKeys + } + + /// One sidebar row per live agent pane, so several agents in one workspace + /// never collapse into a single last-write-wins pill. Candidate + /// (panel, statusKey) pairs are the UNION of recorded agent PID ownership + /// and live panels holding a panel-scoped structured entry: Claude-style + /// hooks share one bare PID key per agent type across panes (ownership + /// migrates to the last reporter), so the panel-scoped entry must keep a + /// pane's row alive independently. Stale entries stay bounded because + /// `clear_status`, `clearAgentPID(clearStatus: true)`, and pane close all + /// drop panel-scoped entries. A panel-scoped report wins; the + /// workspace-level entry is only trusted when a single pane owns that + /// status key; otherwise the per-panel lifecycle drives the row. + func sidebarAgentStatusRows() -> [SidebarAgentStatusRow] { + var statusKeysByPanel: [UUID: Set] = [:] + for (key, panelId) in agentPIDPanelIdsByKey where panels[panelId] != nil { + let statusKey = agentStatusKey(forAgentPIDKey: key) + guard isAgentRowKey(statusKey) else { continue } + statusKeysByPanel[panelId, default: []].insert(statusKey) + } + for (panelId, entries) in statusEntriesByPanelId where panels[panelId] != nil { + for statusKey in entries.keys where isAgentRowKey(statusKey) { + statusKeysByPanel[panelId, default: []].insert(statusKey) + } + } + + var chosenByPanel: [(panelId: UUID, statusKey: String, entry: SidebarStatusEntry?)] = [] + for (panelId, statusKeys) in statusKeysByPanel { + let candidates = statusKeys.map { ($0, statusEntriesByPanelId[panelId]?[$0]) } + let chosen = candidates.max { lhs, rhs in + switch (lhs.1, rhs.1) { + case let (lhsEntry?, rhsEntry?): + return isSidebarStatusEntryLessCurrent(lhsEntry, than: rhsEntry) + case (nil, .some): + return true + case (.some, nil): + return false + case (nil, nil): + return lhs.0 > rhs.0 + } + } + if let chosen { + chosenByPanel.append((panelId: panelId, statusKey: chosen.0, entry: chosen.1)) + } + } + + var panelCountByStatusKey: [String: Int] = [:] + for item in chosenByPanel { + panelCountByStatusKey[item.statusKey, default: 0] += 1 + } + + let rows = chosenByPanel.map { item -> SidebarAgentStatusRow in + let workspaceEntry = statusEntries[item.statusKey] + let soleOwner = panelCountByStatusKey[item.statusKey] == 1 + let entry = item.entry ?? (soleOwner ? workspaceEntry : nil) + return SidebarAgentStatusRow( + panelId: item.panelId, + statusKey: item.statusKey, + value: entry?.value, + icon: entry?.icon ?? (soleOwner ? workspaceEntry?.icon : nil), + color: entry?.color ?? (soleOwner ? workspaceEntry?.color : nil), + url: entry?.url, + format: entry?.format ?? .plain, + lifecycle: agentLifecycleStatesByPanelId[item.panelId]?[item.statusKey], + paneLabel: agentStatusRowPaneLabel(panelId: item.panelId), + // No workspace fallback here: when the pane is not the sole + // owner, the last-write-wins workspace entry's freshness must + // not influence this row's sort position either. + priority: entry?.priority ?? 0, + timestamp: entry?.timestamp ?? .distantPast + ) + } + return rows.sorted { lhs, rhs in + if lhs.priority != rhs.priority { return lhs.priority > rhs.priority } + if lhs.timestamp != rhs.timestamp { return lhs.timestamp > rhs.timestamp } + return lhs.id < rhs.id + } + } + + /// The row's identity label combines the live surface title with a + /// user-authored rename so sibling agents in the same tab stay distinct. + /// Auto-generated titles remain replacements rather than extra identity. + func agentStatusRowPaneLabel(panelId: UUID) -> String? { + let baseCandidates = [ + panelTitles[panelId], + panelDirectoryDisplayLabels[panelId], + ] + var baseLabel: String? + for candidate in baseCandidates { + if let trimmed = candidate?.trimmingCharacters(in: .whitespacesAndNewlines), !trimmed.isEmpty { + baseLabel = trimmed + break + } + } + + guard let customLabel = panelCustomTitles[panelId]?.trimmingCharacters(in: .whitespacesAndNewlines), + !customLabel.isEmpty else { + return baseLabel + } + guard (panelCustomTitleSources[panelId] ?? .user) == .user, + let baseLabel, + baseLabel != customLabel else { + return customLabel + } + return "\(baseLabel) · \(customLabel)" + } + + private func isSidebarStatusEntryLessCurrent( + _ lhs: SidebarStatusEntry, + than rhs: SidebarStatusEntry + ) -> Bool { + if lhs.timestamp != rhs.timestamp { + return lhs.timestamp < rhs.timestamp + } + if lhs.priority != rhs.priority { + return lhs.priority < rhs.priority + } + return lhs.key > rhs.key + } + + // MARK: - Session persistence + + /// Runs the session-restore reset for agent runtime state: status entries + /// and agent PIDs are ephemeral state tied to running processes (e.g. + /// claude_code "Running"), so they never survive a restart. Panel-scoped + /// agent status is restorable UI state, unlike PIDs: the rows re-bind to + /// the restored panes so the sidebar stays informative and click-navigable + /// across relaunch. Seeding MUST run after the clears: restorePane runs + /// earlier in restoreSessionSnapshot, so seeding during panel creation is + /// wiped before the sidebar ever sees it (this bug shipped). + func resetAgentRuntimeStateForSessionRestore( + panelSnapshotsById: [UUID: SessionPanelSnapshot], + oldToNewPanelIds: [UUID: UUID] + ) { + statusEntries.removeAll() + clearAllAgentPIDs(refreshPorts: false) + clearAllAgentLifecycleStates() + agentListeningPorts.removeAll() + for (oldPanelId, newPanelId) in oldToNewPanelIds { + guard let terminal = panelSnapshotsById[oldPanelId]?.terminal else { continue } + restorePanelScopedAgentStatus(terminal: terminal, panelId: newPanelId) + } + } + + /// Feeds the panel-scoped agent status content into the session autosave + /// fingerprint. Counts are not enough: a value-only change to a + /// panel-scoped entry (same entry count) must dirty the autosave, or the + /// persisted per-agent row text goes stale until an unrelated change + /// happens to land. Timestamps are excluded on purpose: identical repeated + /// reports are dropped before storage, so content is the real signal. + func hashPanelScopedAgentStatus(into hasher: inout Hasher) { + for (panelId, entries) in statusEntriesByPanelId.sorted(by: { $0.key.uuidString < $1.key.uuidString }) { + hasher.combine(panelId) + for (key, entry) in entries.sorted(by: { $0.key < $1.key }) { + hasher.combine(key) + hasher.combine(entry.value) + hasher.combine(entry.icon) + hasher.combine(entry.color) + hasher.combine(entry.url) + hasher.combine(entry.priority) + hasher.combine(entry.format.rawValue) + } + } + hasher.combine(agentLifecycleStatesByPanelId) + } + + /// Panel-scoped structured status reports for the session snapshot, so a + /// restored pane keeps its own sidebar row (and stays click-navigable) + /// instead of degrading to the ambiguous workspace-level slot. + func panelScopedAgentStatusSnapshots(panelId: UUID) -> [SessionStatusEntrySnapshot]? { + let entries = (statusEntriesByPanelId[panelId] ?? [:]).values + .filter { Self.structuredAgentHookStatusKeys.contains($0.key) } + .sorted { $0.key < $1.key } + .map { + SessionStatusEntrySnapshot( + key: $0.key, + value: $0.value, + icon: $0.icon, + color: $0.color, + timestamp: $0.timestamp.timeIntervalSince1970, + url: $0.url?.absoluteString, + priority: $0.priority, + format: $0.format.rawValue + ) + } + return entries.isEmpty ? nil : entries + } + + func panelScopedAgentLifecycleSnapshots(panelId: UUID) -> [String: String]? { + let lifecycles = (agentLifecycleStatesByPanelId[panelId] ?? [:]) + .filter { Self.structuredAgentHookStatusKeys.contains($0.key) } + .mapValues { $0.rawValue } + return lifecycles.isEmpty ? nil : lifecycles + } + + /// Seeds the restored pane's panel-scoped agent status from its session + /// snapshot. A captured `.running` lifecycle is demoted to `.unknown`: the + /// resumed agent sits at its prompt until the user acts, so restoring + /// "Running" would be a lie that sticks until the next hook fires. + func restorePanelScopedAgentStatus(terminal: SessionTerminalPanelSnapshot?, panelId: UUID) { + guard let terminal else { return } + for snapshot in terminal.agentStatusEntries ?? [] { + guard Self.structuredAgentHookStatusKeys.contains(snapshot.key) else { continue } + recordPanelStatusEntry( + SidebarStatusEntry( + key: snapshot.key, + value: snapshot.value, + icon: snapshot.icon, + color: snapshot.color, + url: snapshot.url.flatMap(URL.init(string:)), + priority: snapshot.priority ?? 0, + format: snapshot.format.flatMap(SidebarMetadataFormat.init(rawValue:)) ?? .plain, + timestamp: Date(timeIntervalSince1970: snapshot.timestamp) + ), + panelId: panelId + ) + } + for (key, rawValue) in terminal.agentLifecyclesByStatusKey ?? [:] { + guard Self.structuredAgentHookStatusKeys.contains(key), + let captured = AgentHibernationLifecycleState(rawValue: rawValue) else { continue } + let lifecycle: AgentHibernationLifecycleState = captured == .running ? .unknown : captured + setAgentLifecycle(key: key, panelId: panelId, lifecycle: lifecycle) + } + } +} diff --git a/Sources/Workspace.swift b/Sources/Workspace.swift index a629f52d1d11..391704567b6f 100644 --- a/Sources/Workspace.swift +++ b/Sources/Workspace.swift @@ -232,13 +232,10 @@ extension Workspace { isPinned = snapshot.isPinned groupId = snapshot.groupId - // Status entries and agent PIDs are ephemeral runtime state tied to running - // processes (e.g. claude_code "Running"). Don't restore them across app - // restarts because the processes that set them are gone. - statusEntries.removeAll() - clearAllAgentPIDs(refreshPorts: false) - clearAllAgentLifecycleStates() - agentListeningPorts.removeAll() + resetAgentRuntimeStateForSessionRestore( + panelSnapshotsById: panelSnapshotsById, + oldToNewPanelIds: oldToNewPanelIds + ) logEntries = snapshot.logEntries.map { entry in SidebarLogEntry( message: entry.message, @@ -567,7 +564,9 @@ extension Workspace { textBoxDraft: terminalPanel.sessionTextBoxDraftSnapshot(), isRemoteTerminal: activeRemoteTerminalSurfaceIds.contains(panelId), remotePTYSessionID: remotePTYSessionIDForSnapshot(panelId: panelId), - wasAgentRunning: agentWasRunning + wasAgentRunning: agentWasRunning, + agentStatusEntries: panelScopedAgentStatusSnapshots(panelId: panelId), + agentLifecyclesByStatusKey: panelScopedAgentLifecycleSnapshots(panelId: panelId) ) browserSnapshot = nil markdownSnapshot = nil @@ -2198,7 +2197,7 @@ final class Workspace: Identifiable, ObservableObject { /// Provenance of entries in `panelCustomTitles` (see ``CustomTitleSource``). /// An entry may be absent for a title carried across panel moves or /// restored from older snapshots; absent provenance is treated as `.user`. - var panelCustomTitleSources: [UUID: CustomTitleSource] = [:] + @Published var panelCustomTitleSources: [UUID: CustomTitleSource] = [:] @Published var pinnedPanelIds: Set = [] var pinMutationTokensByPanelId: [UUID: UUID] = [:] @Published var manualUnreadPanelIds: Set = [] { diff --git a/Sources/WorkspaceSidebarAgentRuntimeObservationModel.swift b/Sources/WorkspaceSidebarAgentRuntimeObservationModel.swift index 0e05409746c5..daa964aa3cc0 100644 --- a/Sources/WorkspaceSidebarAgentRuntimeObservationModel.swift +++ b/Sources/WorkspaceSidebarAgentRuntimeObservationModel.swift @@ -1,3 +1,4 @@ +import CmuxSidebar import Darwin import Foundation import Observation @@ -9,6 +10,8 @@ final class WorkspaceSidebarAgentRuntimeObservationModel { @ObservationIgnored private(set) var agentPIDs: [String: pid_t] = [:] @ObservationIgnored + private(set) var statusEntriesByPanelId: [UUID: [String: SidebarStatusEntry]] = [:] + @ObservationIgnored private(set) var agentPIDProcessIdentitiesByKey: [String: AgentPIDProcessIdentity] = [:] @ObservationIgnored private(set) var agentPIDPanelIdsByKey: [String: UUID] = [:] @@ -17,6 +20,8 @@ final class WorkspaceSidebarAgentRuntimeObservationModel { @ObservationIgnored private(set) var agentLifecycleStatesByPanelId: [UUID: [String: AgentHibernationLifecycleState]] = [:] @ObservationIgnored + private(set) var dynamicAgentRowKeys: Set = [] + @ObservationIgnored private(set) var changeGeneration: UInt64 = 0 @ObservationIgnored @@ -63,6 +68,18 @@ final class WorkspaceSidebarAgentRuntimeObservationModel { notifyChanged() } + func setStatusEntriesByPanelId(_ newValue: [UUID: [String: SidebarStatusEntry]]) { + guard statusEntriesByPanelId != newValue else { return } + statusEntriesByPanelId = newValue + notifyChanged() + } + + func setDynamicAgentRowKeys(_ newValue: Set) { + guard dynamicAgentRowKeys != newValue else { return } + dynamicAgentRowKeys = newValue + notifyChanged() + } + private func notifyChanged() { changeGeneration &+= 1 for continuation in changeObservers.values { diff --git a/Sources/WorkspaceSidebarObservation.swift b/Sources/WorkspaceSidebarObservation.swift index 3c86232e2b22..a631ad95950b 100644 --- a/Sources/WorkspaceSidebarObservation.swift +++ b/Sources/WorkspaceSidebarObservation.swift @@ -43,6 +43,11 @@ private struct SidebarObservationState: Equatable { let panels: SidebarPanelObservationState let panelDirectories: [UUID: String] let panelDirectoryDisplayLabels: [UUID: String] + // Agent row labels resolve pane rename > surface title, and provenance + // determines whether a same-text rename changes the rendered label. + let panelTitles: [UUID: String] + let panelCustomTitles: [UUID: String] + let panelCustomTitleSources: [UUID: Workspace.CustomTitleSource] let directoryChangeRevision: UInt64 let statusEntries: [String: SidebarStatusEntry] let metadataBlocks: [String: SidebarMetadataBlock] @@ -158,8 +163,11 @@ extension Workspace { remoteFields ) .combineLatest($listeningPorts, sidebarMetadata.panelDirectoryDisplayLabelsPublisher) - .combineLatest(directoryChangeRevision) - .compactMap { [weak self] values, directoryChangeRevision -> SidebarObservationState? in + .combineLatest( + directoryChangeRevision, + Publishers.CombineLatest3($panelTitles, $panelCustomTitles, $panelCustomTitleSources) + ) + .compactMap { [weak self] values, directoryChangeRevision, panelTitleFields -> SidebarObservationState? in guard let self else { return nil } let (groupedFields, listeningPorts, panelDirectoryDisplayLabels) = values let workspaceFields = groupedFields.0 @@ -172,6 +180,9 @@ extension Workspace { panels: workspaceFields.2, panelDirectories: workspaceFields.3, panelDirectoryDisplayLabels: panelDirectoryDisplayLabels, + panelTitles: panelTitleFields.0, + panelCustomTitles: panelTitleFields.1, + panelCustomTitleSources: panelTitleFields.2, directoryChangeRevision: directoryChangeRevision, statusEntries: metadataFields.0, metadataBlocks: metadataFields.1, diff --git a/Sources/cmuxApp.swift b/Sources/cmuxApp.swift index b389b39df611..7d5a194f3e2a 100644 --- a/Sources/cmuxApp.swift +++ b/Sources/cmuxApp.swift @@ -504,6 +504,10 @@ struct cmuxApp: App { #if DEBUG CommandMenu("Debug") { + Button(String(localized: "debug.menu.agentRowsStyle", defaultValue: "Agent Rows Style…")) { + AgentRowsVariantLabWindowController.shared.show() + } + Button("New Tab With Lorem Search Text") { appDelegate.openDebugLoremTab(nil) } @@ -529,123 +533,7 @@ struct cmuxApp: App { ) Divider() - Menu("Debug Windows") { - Button("Background Debug…") { - BackgroundDebugWindowController.shared.show() - } - Button("Pro Badge Style…") { - ProBadgeDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.bonsplitTabBarDebug", - defaultValue: "Bonsplit Tab Bar Debug…" - ) - ) { - BonsplitTabBarDebugWindowController.shared.show() - } - Button("Browser Import Hint Debug…") { - BrowserImportHintDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.browserProfilePopoverDebug", - defaultValue: "Browser Profile Popover Debug…" - ) - ) { - BrowserProfilePopoverDebugWindowController.shared.show() - } - Button("Debug Window Controls…") { - DebugWindowControlsWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.devWindowDisplay", - defaultValue: "Dev Window Display…" - ) - ) { - DevWindowDisplayDebugWindowController.shared.show() - } - Button("Feed Preview…") { - FeedPreviewWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.feedTextEditorDebug", - defaultValue: "Feed Text Editor Lab…" - ) - ) { - FeedTextEditorDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.feedButtonStyleDebug", - defaultValue: "Feed Button Style Debug…" - ) - ) { - FeedButtonStyleDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.startupAppearanceDebug", - defaultValue: "Startup Appearance Debug…" - ) - ) { - StartupAppearanceDebugWindowController.shared.show() - } - Button("Menu Bar Extra Debug…") { - MenuBarExtraDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.aboutTitlebarDebug", - defaultValue: "About Titlebar Debug…" - ) - ) { - AppDelegate.shared?.debugWindowsCoordinator.showAboutTitlebarDebugWindow() - } - Button( - String( - localized: "debug.menu.titlebarLayoutDebug", - defaultValue: "Titlebar Layout Debug..." - ) - ) { - TitlebarLayoutDebugWindowController.shared.show() - } - Button("Sidebar Debug…") { - SidebarDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.splitButtonLayoutDebug", - defaultValue: "Split Button Layout Debug…" - ) - ) { - SplitButtonLayoutDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.tabBarBackdropLab", - defaultValue: "Tab Bar Backdrop Lab…" - ) - ) { - TabBarBackdropLabWindowController.shared.show() - } - Button("File Explorer Style Debug…") { - FileExplorerStyleDebugWindowController.shared.show() - } - Button( - String( - localized: "debug.menu.pdfPreviewChromeDebug", - defaultValue: "PDF Preview Chrome Debug…" - ) - ) { - PDFPreviewChromeDebugWindowController.shared.show() - } - Button("Open All Debug Windows") { - openAllDebugWindows() - } - } + DebugWindowsMenu() Menu( String( @@ -1407,26 +1295,6 @@ struct cmuxApp: App { private func showNotificationsPopover() { AppDelegate.shared?.toggleNotificationsPopover(animated: false) } - -#if DEBUG - private func openAllDebugWindows() { - DebugWindowControlsWindowController.shared.show() - BrowserImportHintDebugWindowController.shared.show() - BrowserProfilePopoverDebugWindowController.shared.show() - AppDelegate.shared?.debugWindowsCoordinator.showAboutTitlebarDebugWindow() - TitlebarLayoutDebugWindowController.shared.show() - SidebarDebugWindowController.shared.show() - BackgroundDebugWindowController.shared.show() - StartupAppearanceDebugWindowController.shared.show() - MenuBarExtraDebugWindowController.shared.show() - PDFPreviewChromeDebugWindowController.shared.show() - FeedPreviewWindowController.shared.show() - FeedTextEditorDebugWindowController.shared.show() - FeedButtonStyleDebugWindowController.shared.show() - BonsplitTabBarDebugWindowController.shared.show() - SplitButtonLayoutDebugWindowController.shared.show() - } -#endif } private struct MainWindowBootstrapView: View { @@ -1448,6 +1316,7 @@ private struct MainWindowBootstrapView: View { private let cmuxAuxiliaryWindowIdentifiers: Set = [ "cmux.settings", "cmux.about", + "cmux.agentRowsVariantLab", "cmux.licenses", "cmux.browser-popup", "cmux.browserProfilePopoverDebug", @@ -1564,7 +1433,7 @@ private enum DebugWindowConfigSnapshot { } #if DEBUG -private final class DebugWindowControlsWindowController: ReleasingWindowController { +final class DebugWindowControlsWindowController: ReleasingWindowController { static let shared = DebugWindowControlsWindowController() override func makeWindow() -> NSWindow { @@ -1826,7 +1695,7 @@ private struct DebugWindowControlsView: View { } #endif -private final class BrowserImportHintDebugWindowController: ReleasingWindowController { +final class BrowserImportHintDebugWindowController: ReleasingWindowController { static let shared = BrowserImportHintDebugWindowController() override func makeWindow() -> NSWindow { @@ -1852,7 +1721,7 @@ private final class BrowserImportHintDebugWindowController: ReleasingWindowContr } } -private final class BrowserProfilePopoverDebugWindowController: ReleasingWindowController { +final class BrowserProfilePopoverDebugWindowController: ReleasingWindowController { static let shared = BrowserProfilePopoverDebugWindowController() override func makeWindow() -> NSWindow { @@ -2368,7 +2237,7 @@ extension Notification.Name { static let fileExplorerStyleDidChange = Notification.Name("fileExplorerStyleDidChange") } -private final class FileExplorerStyleDebugWindowController: ReleasingWindowController { +final class FileExplorerStyleDebugWindowController: ReleasingWindowController { static let shared = FileExplorerStyleDebugWindowController() private override init() { @@ -2403,7 +2272,7 @@ private final class FileExplorerStyleDebugWindowController: ReleasingWindowContr } } -private final class SidebarDebugWindowController: ReleasingWindowController { +final class SidebarDebugWindowController: ReleasingWindowController { static let shared = SidebarDebugWindowController() private override init() { @@ -2769,7 +2638,7 @@ private struct SidebarDebugView: View { // MARK: - Menu Bar Extra Debug Window -private final class MenuBarExtraDebugWindowController: ReleasingWindowController { +final class MenuBarExtraDebugWindowController: ReleasingWindowController { static let shared = MenuBarExtraDebugWindowController() private override init() { @@ -2941,7 +2810,7 @@ private struct MenuBarExtraDebugView: View { #if DEBUG // MARK: - Split Button Layout Debug Window -private final class SplitButtonLayoutDebugWindowController: ReleasingWindowController { +final class SplitButtonLayoutDebugWindowController: ReleasingWindowController { static let shared = SplitButtonLayoutDebugWindowController() override func makeWindow() -> NSWindow { @@ -3265,7 +3134,7 @@ private struct SplitButtonLayoutDebugView: View { // MARK: - Tab Bar Backdrop Lab Window -private final class TabBarBackdropLabWindowController: ReleasingWindowController { +final class TabBarBackdropLabWindowController: ReleasingWindowController { static let shared = TabBarBackdropLabWindowController() override func makeWindow() -> NSWindow { @@ -3898,7 +3767,7 @@ private struct TabBarBackdropLabTerminalPane: View { // MARK: - Background Debug Window -private final class BackgroundDebugWindowController: ReleasingWindowController { +final class BackgroundDebugWindowController: ReleasingWindowController { static let shared = BackgroundDebugWindowController() private override init() { @@ -4047,7 +3916,7 @@ private struct BackgroundDebugView: View { } } -private final class StartupAppearanceDebugWindowController: ReleasingWindowController { +final class StartupAppearanceDebugWindowController: ReleasingWindowController { static let shared = StartupAppearanceDebugWindowController() private override init() { diff --git a/cmux.xcodeproj/project.pbxproj b/cmux.xcodeproj/project.pbxproj index 0a822e38f9f8..2fab48c1e900 100644 --- a/cmux.xcodeproj/project.pbxproj +++ b/cmux.xcodeproj/project.pbxproj @@ -579,6 +579,7 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources DEBDADADADADADADAD000001 /* DebugDogfoodCredentialResolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBDADADADADADADAD000002 /* DebugDogfoodCredentialResolver.swift */; }; DEBDADADADADADADAD000003 /* DebugDogfoodCredentialResolverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBDADADADADADADAD000004 /* DebugDogfoodCredentialResolverTests.swift */; }; A500D010A1B2C3D4E5F60718 /* DebugLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = A500D011A1B2C3D4E5F60718 /* DebugLogging.swift */; }; + 6D3C42A16D3C42A16D3C42A1 /* DebugWindowsMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D3C42A26D3C42A26D3C42A2 /* DebugWindowsMenu.swift */; }; A5001F000000000000000001 /* DetachedFolderDragIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001F000000000000000002 /* DetachedFolderDragIcon.swift */; }; B05553C10000000000000001 /* DetachedFolderPathLookupCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = B05553C10000000000000002 /* DetachedFolderPathLookupCache.swift */; }; B0555303B0555303B0555303 /* DetachedFolderPathLookupCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0555304B0555304B0555304 /* DetachedFolderPathLookupCacheTests.swift */; }; @@ -947,6 +948,10 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources 6313B6A0 /* PaneMemoryWarning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6313B6A1 /* PaneMemoryWarning.swift */; }; E30760090000000000000002 /* PassthroughWindowOverlayContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E30760090000000000000001 /* PassthroughWindowOverlayContainerView.swift */; }; A5001425 /* PDFPreviewChromeDebugWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001424 /* PDFPreviewChromeDebugWindowController.swift */; }; + 5B21C4E15B21C4E15B21C4E1 /* PerAgentSidebarStatusDisplacementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B21C4E25B21C4E25B21C4E2 /* PerAgentSidebarStatusDisplacementTests.swift */; }; + 2255A23ACD5B366E35B6ED0F /* PerAgentSidebarStatusPersistenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCC62AF23B380D1227E261 /* PerAgentSidebarStatusPersistenceTests.swift */; }; + 263D65B017D9E9AC6F525C27 /* PerAgentSidebarStatusRowClearingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C414665C5461092EFE64FE11 /* PerAgentSidebarStatusRowClearingTests.swift */; }; + DEC515B488104031B49F68F0 /* PerAgentSidebarStatusRowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF3A0288F87945DC8889FE91 /* PerAgentSidebarStatusRowTests.swift */; }; D1F0A00400000000000000D1 /* PhoneForwardingMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1F0A00400000000000000D2 /* PhoneForwardingMode.swift */; }; D1F0A00100000000000000A1 /* PhonePushClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1F0A00100000000000000A2 /* PhonePushClient.swift */; }; D1F0A00100000000000000A3 /* PhonePushPayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1F0A00100000000000000A4 /* PhonePushPayload.swift */; }; @@ -1198,6 +1203,11 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources C3467AB10000000000000001 /* ShortcutWhenClauseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3467AB10000000000000002 /* ShortcutWhenClauseTests.swift */; }; A6AC71020000000000000001 /* SidebarAgentActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AC71030000000000000001 /* SidebarAgentActivityIndicator.swift */; }; A6AC71040000000000000001 /* SidebarAgentActivitySummary.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AC71050000000000000001 /* SidebarAgentActivitySummary.swift */; }; + 492FBAC7FCA33879352B4204 /* SidebarAgentGraphiteRowViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E409BA6FC74C8E2681694F1 /* SidebarAgentGraphiteRowViews.swift */; }; + 14FE4CD3BCAD423796E56EE5 /* SidebarAgentRowsVariantLab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4722F35D10C94D12ADC4D017 /* SidebarAgentRowsVariantLab.swift */; }; + 2FB188449942360CAB895143 /* SidebarAgentStatusRowsSummary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2990638B9E75D4B02AF14F /* SidebarAgentStatusRowsSummary.swift */; }; + 7A11AA057A11AA057A11AA05 /* SidebarAgentStatusRowViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11AA067A11AA067A11AA06 /* SidebarAgentStatusRowViews.swift */; }; + 9322B0019322B0019322B001 /* SidebarAgentSurfaceNameTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9322B0029322B0029322B002 /* SidebarAgentSurfaceNameTests.swift */; }; 211A75777F433ED8BA5AE208 /* SidebarAppearanceSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 243632BA1DBBA36FD46E0610 /* SidebarAppearanceSupport.swift */; }; D7AB34310000000000000003 /* SidebarBonsplitTabDropDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB34310000000000000004 /* SidebarBonsplitTabDropDelegate.swift */; }; D7AB34300000000000000003 /* SidebarBonsplitTabWorkspaceDropOverlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB34300000000000000004 /* SidebarBonsplitTabWorkspaceDropOverlay.swift */; }; @@ -1218,6 +1228,7 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources 385C6BA7E78DB87460E5D930 /* SidebarMarkdownRendererTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1C3F1DBF6BF5D7223C4A30C /* SidebarMarkdownRendererTests.swift */; }; A6AC73F20000000000000001 /* SidebarMediaActivityIndicators.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AC73F20000000000000002 /* SidebarMediaActivityIndicators.swift */; }; C0DE5F210000000000000001 /* SidebarMetadataMarkdownRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE5F210000000000000002 /* SidebarMetadataMarkdownRenderer.swift */; }; + 7A11AA037A11AA037A11AA03 /* SidebarMetadataRowViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11AA047A11AA047A11AA04 /* SidebarMetadataRowViews.swift */; }; CB23911D7E131E8FBC9B82B6 /* SidebarOrderingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC39DE4B96D1931C52AF7D68 /* SidebarOrderingTests.swift */; }; EA1F00000000000000000001 /* SidebarPathFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA1F00000000000000000002 /* SidebarPathFormatter.swift */; }; C0DEF0A30000000000000001 /* SidebarPortDisplayText.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DEF0A30000000000000002 /* SidebarPortDisplayText.swift */; }; @@ -1232,6 +1243,7 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources AABBCC00000000000000020A /* SidebarRowDragGate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AABBCC000000000000000209 /* SidebarRowDragGate.swift */; }; C0DE35010000000000000001 /* SidebarScrim.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE35010000000000000002 /* SidebarScrim.swift */; }; C9A57513C9A57513C9A57513 /* SidebarScrollViewConfiguratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A57514C9A57514C9A57514 /* SidebarScrollViewConfiguratorTests.swift */; }; + 51CA9864B90D2721F384B327 /* SidebarSelectedWorkspaceScrollPolicyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221E4C0E77F96E7A38811AEE /* SidebarSelectedWorkspaceScrollPolicyTests.swift */; }; E62155868BB29FEB5DAAAF25 /* SidebarSelectionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AD52285508B1D6A9875E7B3 /* SidebarSelectionState.swift */; }; F57072635F25EBCA741E125D /* SidebarState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1614EAD3CCF70A177A51BD1 /* SidebarState.swift */; }; D7344F010000000000000001 /* SidebarTabDragPayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7344F010000000000000002 /* SidebarTabDragPayload.swift */; }; @@ -1262,6 +1274,7 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources D35450070000000000000007 /* SidebarWorkspaceRowHoverReconciler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D35450070000000000000008 /* SidebarWorkspaceRowHoverReconciler.swift */; }; D35450070000000000000009 /* SidebarWorkspaceRowHoverReconcilerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3545007000000000000000A /* SidebarWorkspaceRowHoverReconcilerView.swift */; }; D3545007000000000000000B /* SidebarWorkspaceRowHoverTrackingModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3545007000000000000000C /* SidebarWorkspaceRowHoverTrackingModifier.swift */; }; + 2E58C01936DF355241CC6911 /* SidebarWorkspaceRowInteractionStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B96BD18955B1A751A8493637 /* SidebarWorkspaceRowInteractionStateTests.swift */; }; D35450030000000000000003 /* SidebarWorkspaceRowMenuTrackingReconciler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D35450030000000000000004 /* SidebarWorkspaceRowMenuTrackingReconciler.swift */; }; D35450030000000000000005 /* SidebarWorkspaceRowMenuTrackingReconcilerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D35450030000000000000006 /* SidebarWorkspaceRowMenuTrackingReconcilerView.swift */; }; C9A57505C9A57505C9A57505 /* SidebarWorkspaceScrollLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A57506C9A57506C9A57506 /* SidebarWorkspaceScrollLayoutTests.swift */; }; @@ -1548,6 +1561,7 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources D7632B13A1B2C3D4E5F60718 /* WKWebView+CmuxPrintOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7632B14A1B2C3D4E5F60718 /* WKWebView+CmuxPrintOperation.swift */; }; C0DE43000000000000000007 /* Workspace+AgentChat.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE43000000000000000008 /* Workspace+AgentChat.swift */; }; A6AC73020000000000000001 /* Workspace+AgentLifecycle.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AC73020000000000000002 /* Workspace+AgentLifecycle.swift */; }; + 9A0B71D19A0B71D19A0B71D1 /* Workspace+AgentPIDOwnership.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B71D29A0B71D29A0B71D2 /* Workspace+AgentPIDOwnership.swift */; }; CA52B0150000000000000000 /* Workspace+CanvasLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA52C0150000000000000000 /* Workspace+CanvasLayout.swift */; }; C54860020000000000000001 /* Workspace+CmuxNavigationDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = C54860020000000000000002 /* Workspace+CmuxNavigationDescriptor.swift */; }; A5FB120D /* Workspace+CustomLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5FB120E /* Workspace+CustomLayout.swift */; }; @@ -1564,6 +1578,7 @@ C0DE71B10000000000000001 /* AppDelegate+AgentChatNotifications.swift in Sources C3744E010000000000000001 /* Workspace+PanelLifecycle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3744E020000000000000001 /* Workspace+PanelLifecycle.swift */; }; D77340010000000000000002 /* Workspace+RemoteTmuxTabOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77340010000000000000001 /* Workspace+RemoteTmuxTabOrder.swift */; }; C548600A000000000000001 /* Workspace+SessionRestoreIdentity.swift in Sources */ = {isa = PBXBuildFile; fileRef = C548600A000000000000002 /* Workspace+SessionRestoreIdentity.swift */; }; + 7A11AA017A11AA017A11AA01 /* Workspace+SidebarAgentStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A11AA027A11AA027A11AA02 /* Workspace+SidebarAgentStatus.swift */; }; C7268002000000000000001 /* Workspace+SidebarDirectories.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7268002000000000000002 /* Workspace+SidebarDirectories.swift */; }; CA52B0170000000000000000 /* Workspace+SurfaceNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA52C0170000000000000000 /* Workspace+SurfaceNavigation.swift */; }; E3B7A400000000000000020A /* Workspace+WorkspaceSurfaceTreeReading.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3B7A400000000000000020B /* Workspace+WorkspaceSurfaceTreeReading.swift */; }; @@ -2228,6 +2243,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = DEBDADADADADADADAD000002 /* DebugDogfoodCredentialResolver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = DebugDogfoodCredentialResolver.swift; sourceTree = ""; }; DEBDADADADADADADAD000004 /* DebugDogfoodCredentialResolverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugDogfoodCredentialResolverTests.swift; sourceTree = ""; }; A500D011A1B2C3D4E5F60718 /* DebugLogging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App/DebugLogging.swift; sourceTree = ""; }; + 6D3C42A26D3C42A26D3C42A2 /* DebugWindowsMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugWindowsMenu.swift; sourceTree = ""; }; A5001F000000000000000002 /* DetachedFolderDragIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetachedFolderDragIcon.swift; sourceTree = ""; }; B05553C10000000000000002 /* DetachedFolderPathLookupCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetachedFolderPathLookupCache.swift; sourceTree = ""; }; B0555304B0555304B0555304 /* DetachedFolderPathLookupCacheTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetachedFolderPathLookupCacheTests.swift; sourceTree = ""; }; @@ -2592,6 +2608,10 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = 6313B6A1 /* PaneMemoryWarning.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaneMemoryWarning.swift; sourceTree = ""; }; E30760090000000000000001 /* PassthroughWindowOverlayContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PassthroughWindowOverlayContainerView.swift; sourceTree = ""; }; A5001424 /* PDFPreviewChromeDebugWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Panels/PDFPreviewChromeDebugWindowController.swift; sourceTree = ""; }; + 5B21C4E25B21C4E25B21C4E2 /* PerAgentSidebarStatusDisplacementTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerAgentSidebarStatusDisplacementTests.swift; sourceTree = ""; }; + 3EDCC62AF23B380D1227E261 /* PerAgentSidebarStatusPersistenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerAgentSidebarStatusPersistenceTests.swift; sourceTree = ""; }; + C414665C5461092EFE64FE11 /* PerAgentSidebarStatusRowClearingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerAgentSidebarStatusRowClearingTests.swift; sourceTree = ""; }; + EF3A0288F87945DC8889FE91 /* PerAgentSidebarStatusRowTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PerAgentSidebarStatusRowTests.swift; sourceTree = ""; }; D1F0A00400000000000000D2 /* PhoneForwardingMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneForwardingMode.swift; sourceTree = ""; }; D1F0A00100000000000000A2 /* PhonePushClient.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PhonePushClient.swift; sourceTree = ""; }; D1F0A00100000000000000A4 /* PhonePushPayload.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PhonePushPayload.swift; sourceTree = ""; }; @@ -2836,6 +2856,11 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C3467AB10000000000000002 /* ShortcutWhenClauseTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShortcutWhenClauseTests.swift; sourceTree = ""; }; A6AC71030000000000000001 /* SidebarAgentActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarAgentActivityIndicator.swift; sourceTree = ""; }; A6AC71050000000000000001 /* SidebarAgentActivitySummary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarAgentActivitySummary.swift; sourceTree = ""; }; + 5E409BA6FC74C8E2681694F1 /* SidebarAgentGraphiteRowViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarAgentGraphiteRowViews.swift; sourceTree = ""; }; + 4722F35D10C94D12ADC4D017 /* SidebarAgentRowsVariantLab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarAgentRowsVariantLab.swift; sourceTree = ""; }; + 1D2990638B9E75D4B02AF14F /* SidebarAgentStatusRowsSummary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarAgentStatusRowsSummary.swift; sourceTree = ""; }; + 7A11AA067A11AA067A11AA06 /* SidebarAgentStatusRowViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarAgentStatusRowViews.swift; sourceTree = ""; }; + 9322B0029322B0029322B002 /* SidebarAgentSurfaceNameTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarAgentSurfaceNameTests.swift; sourceTree = ""; }; 243632BA1DBBA36FD46E0610 /* SidebarAppearanceSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarAppearanceSupport.swift; sourceTree = ""; }; D7AB34310000000000000004 /* SidebarBonsplitTabDropDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarBonsplitTabDropDelegate.swift; sourceTree = ""; }; D7AB34300000000000000004 /* SidebarBonsplitTabWorkspaceDropOverlay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarBonsplitTabWorkspaceDropOverlay.swift; sourceTree = ""; }; @@ -2856,6 +2881,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = F1C3F1DBF6BF5D7223C4A30C /* SidebarMarkdownRendererTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarMarkdownRendererTests.swift; sourceTree = ""; }; A6AC73F20000000000000002 /* SidebarMediaActivityIndicators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarMediaActivityIndicators.swift; sourceTree = ""; }; C0DE5F210000000000000002 /* SidebarMetadataMarkdownRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarMetadataMarkdownRenderer.swift; sourceTree = ""; }; + 7A11AA047A11AA047A11AA04 /* SidebarMetadataRowViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarMetadataRowViews.swift; sourceTree = ""; }; BC39DE4B96D1931C52AF7D68 /* SidebarOrderingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarOrderingTests.swift; sourceTree = ""; }; EA1F00000000000000000002 /* SidebarPathFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarPathFormatter.swift; sourceTree = ""; }; C0DEF0A30000000000000002 /* SidebarPortDisplayText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarPortDisplayText.swift; sourceTree = ""; }; @@ -2870,6 +2896,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = AABBCC000000000000000209 /* SidebarRowDragGate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarRowDragGate.swift; sourceTree = ""; }; C0DE35010000000000000002 /* SidebarScrim.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarScrim.swift; sourceTree = ""; }; C9A57514C9A57514C9A57514 /* SidebarScrollViewConfiguratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarScrollViewConfiguratorTests.swift; sourceTree = ""; }; + 221E4C0E77F96E7A38811AEE /* SidebarSelectedWorkspaceScrollPolicyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarSelectedWorkspaceScrollPolicyTests.swift; sourceTree = ""; }; 9AD52285508B1D6A9875E7B3 /* SidebarSelectionState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarSelectionState.swift; sourceTree = ""; }; D1614EAD3CCF70A177A51BD1 /* SidebarState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarState.swift; sourceTree = ""; }; D7344F010000000000000002 /* SidebarTabDragPayload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarTabDragPayload.swift; sourceTree = ""; }; @@ -2900,6 +2927,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = D35450070000000000000008 /* SidebarWorkspaceRowHoverReconciler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarWorkspaceRowHoverReconciler.swift; sourceTree = ""; }; D3545007000000000000000A /* SidebarWorkspaceRowHoverReconcilerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarWorkspaceRowHoverReconcilerView.swift; sourceTree = ""; }; D3545007000000000000000C /* SidebarWorkspaceRowHoverTrackingModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarWorkspaceRowHoverTrackingModifier.swift; sourceTree = ""; }; + B96BD18955B1A751A8493637 /* SidebarWorkspaceRowInteractionStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarWorkspaceRowInteractionStateTests.swift; sourceTree = ""; }; D35450030000000000000004 /* SidebarWorkspaceRowMenuTrackingReconciler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarWorkspaceRowMenuTrackingReconciler.swift; sourceTree = ""; }; D35450030000000000000006 /* SidebarWorkspaceRowMenuTrackingReconcilerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sidebar/SidebarWorkspaceRowMenuTrackingReconcilerView.swift; sourceTree = ""; }; C9A57506C9A57506C9A57506 /* SidebarWorkspaceScrollLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarWorkspaceScrollLayoutTests.swift; sourceTree = ""; }; @@ -3179,6 +3207,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = D7632B14A1B2C3D4E5F60718 /* WKWebView+CmuxPrintOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Panels/WKWebView+CmuxPrintOperation.swift"; sourceTree = ""; }; C0DE43000000000000000008 /* Workspace+AgentChat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+AgentChat.swift"; sourceTree = ""; }; A6AC73020000000000000002 /* Workspace+AgentLifecycle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+AgentLifecycle.swift"; sourceTree = ""; }; + 9A0B71D29A0B71D29A0B71D2 /* Workspace+AgentPIDOwnership.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+AgentPIDOwnership.swift"; sourceTree = ""; }; CA52C0150000000000000000 /* Workspace+CanvasLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+CanvasLayout.swift"; sourceTree = ""; }; C54860020000000000000002 /* Workspace+CmuxNavigationDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+CmuxNavigationDescriptor.swift"; sourceTree = ""; }; A5FB120E /* Workspace+CustomLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+CustomLayout.swift"; sourceTree = ""; }; @@ -3195,6 +3224,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C3744E020000000000000001 /* Workspace+PanelLifecycle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+PanelLifecycle.swift"; sourceTree = ""; }; D77340010000000000000001 /* Workspace+RemoteTmuxTabOrder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+RemoteTmuxTabOrder.swift"; sourceTree = ""; }; C548600A000000000000002 /* Workspace+SessionRestoreIdentity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+SessionRestoreIdentity.swift"; sourceTree = ""; }; + 7A11AA027A11AA027A11AA02 /* Workspace+SidebarAgentStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+SidebarAgentStatus.swift"; sourceTree = ""; }; C7268002000000000000002 /* Workspace+SidebarDirectories.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+SidebarDirectories.swift"; sourceTree = ""; }; CA52C0170000000000000000 /* Workspace+SurfaceNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+SurfaceNavigation.swift"; sourceTree = ""; }; E3B7A400000000000000020B /* Workspace+WorkspaceSurfaceTreeReading.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Workspace+WorkspaceSurfaceTreeReading.swift"; sourceTree = ""; }; @@ -3838,6 +3868,12 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C0DE43000000000000000008 /* Workspace+AgentChat.swift */, C3744E040000000000000001 /* AgentPIDProcessIdentity.swift */, 6799A0026799A0026799A002 /* WorkspaceSidebarAgentRuntimeObservationModel.swift */, + 7A11AA027A11AA027A11AA02 /* Workspace+SidebarAgentStatus.swift */, + 7A11AA047A11AA047A11AA04 /* SidebarMetadataRowViews.swift */, + 7A11AA067A11AA067A11AA06 /* SidebarAgentStatusRowViews.swift */, + 5E409BA6FC74C8E2681694F1 /* SidebarAgentGraphiteRowViews.swift */, + 4722F35D10C94D12ADC4D017 /* SidebarAgentRowsVariantLab.swift */, + 1D2990638B9E75D4B02AF14F /* SidebarAgentStatusRowsSummary.swift */, A91C0D0E0000000000000001 /* TerminalTabAgentIcon.swift */, C0A1E5CE01C0A1E5CE01A002 /* CoalesceLatestPublisher.swift */, 5659A0025659A0025659A002 /* WorkspaceSidebarObservation.swift */, @@ -3846,6 +3882,8 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = F0ACC0DE000000000000000A /* Workspace+ForkAgentConversationAvailability.swift */, F0ACC0DE000000000000000C /* WorkspaceForkAgentConversationAvailability.swift */, F0ACC0DE0000000000000004 /* Workspace+ForkConversationContextMenu.swift */, + 6D3C42A26D3C42A26D3C42A2 /* DebugWindowsMenu.swift */, + 9A0B71D29A0B71D29A0B71D2 /* Workspace+AgentPIDOwnership.swift */, C3744E020000000000000001 /* Workspace+PanelLifecycle.swift */, A6AC73020000000000000002 /* Workspace+AgentLifecycle.swift */, 42C2726A34F27E7A43B77368 /* Workspace+CustomSidebarPullRequests.swift */, @@ -4656,6 +4694,10 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = A9E040000000000000000001 /* CodexAppServerSessionTests.swift */, D72260010000000000000002 /* AgentHibernationPortalVisibilityTests.swift */, D36A00020000000000000002 /* AgentHibernationTests.swift */, + 5B21C4E25B21C4E25B21C4E2 /* PerAgentSidebarStatusDisplacementTests.swift */, + 3EDCC62AF23B380D1227E261 /* PerAgentSidebarStatusPersistenceTests.swift */, + EF3A0288F87945DC8889FE91 /* PerAgentSidebarStatusRowTests.swift */, + 9322B0029322B0029322B002 /* SidebarAgentSurfaceNameTests.swift */, D36A00050000000000000002 /* RendererRealizationPlannerTests.swift */, C58410010000000000000002 /* RenderableSystemSymbolTests.swift */, DCDC0000000000000000B002 /* DockControlDefinitionDecodingTests.swift */, @@ -4798,6 +4840,9 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = 46792DAA478444ED87B17B31 /* AutoNamingHookPayloadAdapterTests.swift */, CE7000000000000000000002 /* ClaudeWrapperResumeEnvironmentTests.swift */, F016B5C09357B3226FA2E014 /* SidebarWorkspaceSnapshotRefreshPolicyTests.swift */, + B96BD18955B1A751A8493637 /* SidebarWorkspaceRowInteractionStateTests.swift */, + 221E4C0E77F96E7A38811AEE /* SidebarSelectedWorkspaceScrollPolicyTests.swift */, + C414665C5461092EFE64FE11 /* PerAgentSidebarStatusRowClearingTests.swift */, A6AC73040000000000000002 /* SidebarWorkspaceSnapshotAgentActivityTests.swift */, C9A57514C9A57514C9A57514 /* SidebarScrollViewConfiguratorTests.swift */, C9A57506C9A57506C9A57506 /* SidebarWorkspaceScrollLayoutTests.swift */, @@ -5743,6 +5788,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C57B00090000000000000001 /* CustomSidebarPanelView.swift in Sources */, DEBDADADADADADADAD000001 /* DebugDogfoodCredentialResolver.swift in Sources */, A500D010A1B2C3D4E5F60718 /* DebugLogging.swift in Sources */, + 6D3C42A16D3C42A16D3C42A1 /* DebugWindowsMenu.swift in Sources */, A5001F000000000000000001 /* DetachedFolderDragIcon.swift in Sources */, B05553C10000000000000001 /* DetachedFolderPathLookupCache.swift in Sources */, DE71CE000000000000000004 /* DeviceRegistryClient.swift in Sources */, @@ -6150,6 +6196,10 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = 5C3E0454B6C24B02A2F091A8 /* ShortcutRoutingSupport.swift in Sources */, A6AC71020000000000000001 /* SidebarAgentActivityIndicator.swift in Sources */, A6AC71040000000000000001 /* SidebarAgentActivitySummary.swift in Sources */, + 492FBAC7FCA33879352B4204 /* SidebarAgentGraphiteRowViews.swift in Sources */, + 14FE4CD3BCAD423796E56EE5 /* SidebarAgentRowsVariantLab.swift in Sources */, + 2FB188449942360CAB895143 /* SidebarAgentStatusRowsSummary.swift in Sources */, + 7A11AA057A11AA057A11AA05 /* SidebarAgentStatusRowViews.swift in Sources */, 211A75777F433ED8BA5AE208 /* SidebarAppearanceSupport.swift in Sources */, D7AB34310000000000000003 /* SidebarBonsplitTabDropDelegate.swift in Sources */, D7AB34300000000000000003 /* SidebarBonsplitTabWorkspaceDropOverlay.swift in Sources */, @@ -6165,6 +6215,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = 5732A0125732A0125732A012 /* SidebarLazyContractProbeKey.swift in Sources */, A6AC73F20000000000000001 /* SidebarMediaActivityIndicators.swift in Sources */, C0DE5F210000000000000001 /* SidebarMetadataMarkdownRenderer.swift in Sources */, + 7A11AA037A11AA037A11AA03 /* SidebarMetadataRowViews.swift in Sources */, EA1F00000000000000000001 /* SidebarPathFormatter.swift in Sources */, C0DEF0A30000000000000001 /* SidebarPortDisplayText.swift in Sources */, C0DEA7710000000000000005 /* SidebarProBadge.swift in Sources */, @@ -6403,6 +6454,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = D7632B13A1B2C3D4E5F60718 /* WKWebView+CmuxPrintOperation.swift in Sources */, C0DE43000000000000000007 /* Workspace+AgentChat.swift in Sources */, A6AC73020000000000000001 /* Workspace+AgentLifecycle.swift in Sources */, + 9A0B71D19A0B71D19A0B71D1 /* Workspace+AgentPIDOwnership.swift in Sources */, CA52B0150000000000000000 /* Workspace+CanvasLayout.swift in Sources */, C54860020000000000000001 /* Workspace+CmuxNavigationDescriptor.swift in Sources */, A5FB120D /* Workspace+CustomLayout.swift in Sources */, @@ -6419,6 +6471,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C3744E010000000000000001 /* Workspace+PanelLifecycle.swift in Sources */, D77340010000000000000002 /* Workspace+RemoteTmuxTabOrder.swift in Sources */, C548600A000000000000001 /* Workspace+SessionRestoreIdentity.swift in Sources */, + 7A11AA017A11AA017A11AA01 /* Workspace+SidebarAgentStatus.swift in Sources */, C7268002000000000000001 /* Workspace+SidebarDirectories.swift in Sources */, CA52B0170000000000000000 /* Workspace+SurfaceNavigation.swift in Sources */, E3B7A400000000000000020A /* Workspace+WorkspaceSurfaceTreeReading.swift in Sources */, @@ -6852,6 +6905,10 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = A5E01203A1B2C3D4E5F60718 /* OpenCodeHookRegressionTests.swift in Sources */, C44550000000000000000001 /* PanelOwnedNativeViewSessionTests.swift in Sources */, 6313FACE0000000000000000 /* PaneMemoryGuardrailTests.swift in Sources */, + 5B21C4E15B21C4E15B21C4E1 /* PerAgentSidebarStatusDisplacementTests.swift in Sources */, + 2255A23ACD5B366E35B6ED0F /* PerAgentSidebarStatusPersistenceTests.swift in Sources */, + 263D65B017D9E9AC6F525C27 /* PerAgentSidebarStatusRowClearingTests.swift in Sources */, + DEC515B488104031B49F68F0 /* PerAgentSidebarStatusRowTests.swift in Sources */, D1F0A00300000000000000C1 /* PhonePushPresenceGateTests.swift in Sources */, B3575000000000000000000A /* PiVaultAgentPersistenceTests.swift in Sources */, B1D5CEE0407545B6B57E3B0E /* PortalHitTestingPerformanceTests.swift in Sources */, @@ -6927,6 +6984,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = 6042A0016042A0016042A001 /* ShortcutHintModifierPolicyTests.swift in Sources */, F6001000A1B2C3D4E5F60718 /* ShortcutUnbindingTests.swift in Sources */, C3467AB10000000000000001 /* ShortcutWhenClauseTests.swift in Sources */, + 9322B0019322B0019322B001 /* SidebarAgentSurfaceNameTests.swift in Sources */, 51D800000000000000000001 /* SidebarIdentifierFormattingTests.swift in Sources */, AABBCC000000000000000206 /* SidebarInlineRenameKeyResolverTests.swift in Sources */, D41A7C01D41A7C01D41A7C01 /* SidebarLazyLayoutScaleTests.swift in Sources */, @@ -6935,6 +6993,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C0DE48000000000000000001 /* SidebarProviderMenuRegressionTests.swift in Sources */, 5B0C00010000000000000003 /* SidebarResizerOcclusionResolverTests.swift in Sources */, C9A57513C9A57513C9A57513 /* SidebarScrollViewConfiguratorTests.swift in Sources */, + 51CA9864B90D2721F384B327 /* SidebarSelectedWorkspaceScrollPolicyTests.swift in Sources */, D73440010000000000000001 /* SidebarTabDragPayloadProviderTests.swift in Sources */, D7AB34300000000000000105 /* SidebarTabDropIndicatorPredicateTests.swift in Sources */, CA39C0304FE351A21C372429 /* SidebarWidthPolicyTests.swift in Sources */, @@ -6942,6 +7001,7 @@ C0DE71B10000000000000002 /* AppDelegate+AgentChatNotifications.swift */ = {isa = C135190000000000000000B1 /* SidebarWorkspaceGroupConfigOpenerTests.swift in Sources */, C9A57303C9A57303C9A57303 /* SidebarWorkspaceGroupHeaderMetricsTests.swift in Sources */, C9A57305C9A57305C9A57305 /* SidebarWorkspaceReorderDropOverlayHitTestingTests.swift in Sources */, + 2E58C01936DF355241CC6911 /* SidebarWorkspaceRowInteractionStateTests.swift in Sources */, C9A57505C9A57505C9A57505 /* SidebarWorkspaceScrollLayoutTests.swift in Sources */, C0DE56010000000000000001 /* SidebarWorkspaceSelectionAnchorPolicyTests.swift in Sources */, A6AC73040000000000000001 /* SidebarWorkspaceSnapshotAgentActivityTests.swift in Sources */, diff --git a/cmuxTests/AgentSessionAutoResumeSwiftTests.swift b/cmuxTests/AgentSessionAutoResumeSwiftTests.swift index 640945188540..e51b2c340484 100644 --- a/cmuxTests/AgentSessionAutoResumeSwiftTests.swift +++ b/cmuxTests/AgentSessionAutoResumeSwiftTests.swift @@ -57,7 +57,8 @@ struct AgentSessionAutoResumeSwiftTests { statusEntries: [:], agentPIDs: [pidKey: livePid], agentPIDProcessIdentities: [pidKey: savedIdentity], - agentPIDKeys: [pidKey] + agentPIDKeys: [pidKey], + dynamicAgentRowKeys: [] ) ) diff --git a/cmuxTests/DockTerminalReattachTests.swift b/cmuxTests/DockTerminalReattachTests.swift index 36af7be52a8e..cc37c33d3596 100644 --- a/cmuxTests/DockTerminalReattachTests.swift +++ b/cmuxTests/DockTerminalReattachTests.swift @@ -339,7 +339,8 @@ extension DockSocketLifecycleTests { statusEntries: [:], agentPIDs: ["claude": deadPid], agentPIDProcessIdentities: [:], - agentPIDKeys: ["claude"] + agentPIDKeys: ["claude"], + dynamicAgentRowKeys: [] ) ) @@ -396,7 +397,8 @@ extension DockSocketLifecycleTests { statusEntries: [:], agentPIDs: ["claude": livePid], agentPIDProcessIdentities: ["claude": mismatchedIdentity], - agentPIDKeys: ["claude"] + agentPIDKeys: ["claude"], + dynamicAgentRowKeys: [] ) ) @@ -441,7 +443,8 @@ extension DockSocketLifecycleTests { statusEntries: [:], agentPIDs: ["claude": livePid], agentPIDProcessIdentities: ["claude": currentIdentity], - agentPIDKeys: ["claude"] + agentPIDKeys: ["claude"], + dynamicAgentRowKeys: [] ) ) diff --git a/cmuxTests/PerAgentSidebarStatusDisplacementTests.swift b/cmuxTests/PerAgentSidebarStatusDisplacementTests.swift new file mode 100644 index 000000000000..651b3ed01846 --- /dev/null +++ b/cmuxTests/PerAgentSidebarStatusDisplacementTests.swift @@ -0,0 +1,121 @@ +import CmuxSidebar +import Foundation +import Testing + +#if canImport(cmux_DEV) +@testable import cmux_DEV +#elseif canImport(cmux) +@testable import cmux +#endif + +/// Bare shared PID key displacement and same-pane agent replacement: a +/// claude-style hook reports ONE bare key per agent type per workspace, so +/// ownership moves between panes; displaced panes must keep their own rows, +/// workspace-scoped clears must reap synthesized displacement keys, and a +/// different agent replacing a no-pid panel-scoped status must drop it. +@MainActor +struct PerAgentSidebarStatusDisplacementTests { + private func makeEntry( + key: String, + value: String, + timestamp: Date = Date() + ) -> SidebarStatusEntry { + SidebarStatusEntry( + key: key, + value: value, + icon: "bolt.fill", + color: "#4C8DFF", + timestamp: timestamp + ) + } + + @Test + func testDisplacedBareKeyPaneKeepsRowWithItsOwnPid() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + // Pane A reports first with the bare shared key (real claude hook shape). + workspace.recordAgentPID(key: "claude_code", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.setAgentLifecycle(key: "claude_code", panelId: firstPanelId, lifecycle: .running) + // Pane B's report displaces A's bare-key ownership. + workspace.recordAgentPID(key: "claude_code", pid: 222, panelId: secondPanelId, refreshPorts: false) + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.count == 2) + #expect(Set(rows.map(\.panelId)) == [firstPanelId, secondPanelId]) + // A's runtime moved to a synthesized key with its own pid intact, so + // the liveness sweep still owns its cleanup. + let synthesizedKey = Workspace.synthesizedDisplacedPIDKey(statusKey: "claude_code", panelId: firstPanelId) + #expect(workspace.agentPIDs[synthesizedKey] == 111) + #expect(workspace.agentPIDs["claude_code"] == 222) + #expect(workspace.agentLifecycleStatesByPanelId[firstPanelId]?["claude_code"] == .running) + + // A reports again: the bare key returns to A, the synthesized key is + // reaped, and A's panel-scoped entry survives the key-shape change. + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Running"), panelId: firstPanelId) + workspace.recordAgentPID(key: "claude_code", pid: 111, panelId: firstPanelId, refreshPorts: false) + #expect(workspace.agentPIDs[synthesizedKey] == nil) + #expect(workspace.statusEntriesByPanelId[firstPanelId]?["claude_code"]?.value == "Running") + // The key-shape change is the SAME runtime re-keying, not an exit: + // the pane's lifecycle must survive too, or the state dot and summary + // counts go blank until the next lifecycle hook. + #expect(workspace.agentLifecycleStatesByPanelId[firstPanelId]?["claude_code"] == .running) + #expect(workspace.sidebarAgentStatusRows().count == 2) + } + + @Test + func testWorkspaceScopedStatusClearReapsDisplacedRuntimes() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + workspace.recordAgentPID(key: "claude_code", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.setAgentLifecycle(key: "claude_code", panelId: firstPanelId, lifecycle: .running) + workspace.recordAgentPID(key: "claude_code", pid: 222, panelId: secondPanelId, refreshPorts: false) + workspace.setAgentLifecycle(key: "claude_code", panelId: secondPanelId, lifecycle: .running) + #expect(workspace.sidebarAgentStatusRows().count == 2) + + // The `clear_status ` contract: remove the key from the WHOLE + // workspace. The displaced pane's synthesized runtime and both panes' + // lifecycles must go too, or its row reappears with lifecycle text. + _ = workspace.statusEntries.removeValue(forKey: "claude_code") + _ = workspace.clearPanelStatusEntries(statusKey: "claude_code") + workspace.clearAgentRuntimes(forStatusKey: "claude_code", refreshPorts: false) + + #expect(workspace.sidebarAgentStatusRows().isEmpty) + let synthesizedKey = Workspace.synthesizedDisplacedPIDKey(statusKey: "claude_code", panelId: firstPanelId) + #expect(workspace.agentPIDs[synthesizedKey] == nil) + #expect(workspace.agentPIDs["claude_code"] == nil) + #expect(workspace.agentPIDPanelIdsByKey.isEmpty) + #expect(workspace.agentPIDKeysByPanelId.isEmpty) + #expect(workspace.agentLifecycleStatesByPanelId[firstPanelId]?["claude_code"] == nil) + #expect(workspace.agentLifecycleStatesByPanelId[secondPanelId]?["claude_code"] == nil) + } + + @Test + func testDifferentAgentReplacesNoPIDPanelScopedStatus() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + + // codex reported only a panel-scoped status (set_status --panel with + // no --pid) plus a lifecycle; it never recorded a pid on the pane. + workspace.statusEntries["codex"] = makeEntry(key: "codex", value: "Old codex text") + workspace.recordPanelStatusEntry(makeEntry(key: "codex", value: "Old codex text"), panelId: panelId) + workspace.setAgentLifecycle(key: "codex", panelId: panelId, lifecycle: .idle) + + // claude replaces it on the same pane: the stale codex entry, + // lifecycle, and orphaned workspace-level slot must all go, or the + // pane's row keeps showing the dead agent's text (a nil claude entry + // loses to any codex entry in the row chooser). + workspace.recordAgentPID(key: "claude_code", pid: 111, panelId: panelId, refreshPorts: false) + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.map(\.statusKey) == ["claude_code"]) + #expect(workspace.statusEntriesByPanelId[panelId]?["codex"] == nil) + #expect(workspace.agentLifecycleStatesByPanelId[panelId]?["codex"] == nil) + #expect(workspace.statusEntries["codex"] == nil) + } +} diff --git a/cmuxTests/PerAgentSidebarStatusPersistenceTests.swift b/cmuxTests/PerAgentSidebarStatusPersistenceTests.swift new file mode 100644 index 000000000000..0d2d504535ec --- /dev/null +++ b/cmuxTests/PerAgentSidebarStatusPersistenceTests.swift @@ -0,0 +1,130 @@ +import CmuxSidebar +import Foundation +import Testing + +#if canImport(cmux_DEV) +@testable import cmux_DEV +#elseif canImport(cmux) +@testable import cmux +#endif + +/// Session persistence for per-pane agent status rows: panel-scoped entries +/// and lifecycles must survive relaunch bound to the restored pane, and any +/// panel-scoped change must dirty the session autosave fingerprint. +@MainActor +struct PerAgentSidebarStatusPersistenceTests { + private func makeEntry( + key: String, + value: String, + timestamp: Date = Date() + ) -> SidebarStatusEntry { + SidebarStatusEntry( + key: key, + value: value, + icon: "bolt.fill", + color: "#4C8DFF", + timestamp: timestamp + ) + } + + @Test + func testRestoredPanelSnapshotSeedsRowWithPaneBinding() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + + let terminal = SessionTerminalPanelSnapshot( + agentStatusEntries: [ + SessionStatusEntrySnapshot( + key: "claude_code", + value: "Claude is waiting for your input", + icon: "exclamationmark.bubble.fill", + color: "#FF9F0A", + timestamp: 1_000 + ) + ], + agentLifecyclesByStatusKey: ["claude_code": "running"] + ) + workspace.restorePanelScopedAgentStatus(terminal: terminal, panelId: panelId) + + let row = try #require(workspace.sidebarAgentStatusRows().first) + // The restored row is bound to the live pane, so clicking it can + // focus that pane immediately after relaunch. + #expect(row.panelId == panelId) + #expect(row.value == "Claude is waiting for your input") + // Captured "running" must not survive restore: the resumed agent sits + // at its prompt, so a restored Running pill would stick until the + // next hook fires. + #expect(row.lifecycle == .unknown) + + // The seeded state round-trips back out into the next snapshot. + #expect(workspace.panelScopedAgentStatusSnapshots(panelId: panelId)?.first?.key == "claude_code") + #expect(workspace.panelScopedAgentLifecycleSnapshots(panelId: panelId)?["claude_code"] == "unknown") + } + + @Test + func testRestoreSessionSnapshotSeedsPanelScopedRowsAfterEphemeralClears() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + workspace.recordPanelStatusEntry( + SidebarStatusEntry( + key: "codex", + value: "**Reviewing** PR", + icon: "bolt.fill", + color: "#4C8DFF", + url: URL(string: "https://github.com/manaflow-ai/cmux/pull/7559"), + priority: 7, + format: .markdown, + timestamp: Date(timeIntervalSince1970: 500) + ), + panelId: panelId + ) + workspace.setAgentLifecycle(key: "codex", panelId: panelId, lifecycle: .needsInput) + let snapshot = workspace.sessionSnapshot(includeScrollback: false) + + let restored = Workspace() + let oldToNewPanelIds = restored.restoreSessionSnapshot(snapshot) + let restoredPanelId = try #require(oldToNewPanelIds[panelId]) + + // restoreSessionSnapshot clears statusEntries/agent PIDs/lifecycles + // AFTER restorePane, so the seed must run after those clears. Seeding + // during panel creation shipped exactly this bug: the clears wiped + // the rows before the sidebar ever saw them. + let row = try #require(restored.sidebarAgentStatusRows().first) + #expect(row.panelId == restoredPanelId) + #expect(row.statusKey == "codex") + #expect(row.value == "**Reviewing** PR") + #expect(row.lifecycle == .needsInput) + // Behavior fields survive the round-trip: a markdown/clickable/ + // high-priority row must not degrade to plain/unclickable/default + // sort order after relaunch. + #expect(row.url == URL(string: "https://github.com/manaflow-ai/cmux/pull/7559")) + #expect(row.priority == 7) + #expect(row.format == .markdown) + } + + @Test + func testPanelScopedStatusValueChangeDirtiesAutosaveFingerprint() throws { + let manager = TabManager() + let workspace = try #require(manager.selectedWorkspace) + let panelId = try #require(workspace.focusedPanelId) + + workspace.recordPanelStatusEntry( + makeEntry(key: "claude_code", value: "Running", timestamp: Date(timeIntervalSince1970: 100)), + panelId: panelId + ) + let runningFingerprint = manager.sessionAutosaveFingerprint() + + // Value-only change: the entry count is unchanged, so a count-based + // fingerprint never goes dirty and the autosave keeps persisting the + // stale row text until an unrelated change happens to land. + workspace.recordPanelStatusEntry( + makeEntry(key: "claude_code", value: "Waiting for input", timestamp: Date(timeIntervalSince1970: 200)), + panelId: panelId + ) + #expect(manager.sessionAutosaveFingerprint() != runningFingerprint) + + let beforeLifecycleChange = manager.sessionAutosaveFingerprint() + workspace.setAgentLifecycle(key: "claude_code", panelId: panelId, lifecycle: .needsInput) + #expect(manager.sessionAutosaveFingerprint() != beforeLifecycleChange) + } +} diff --git a/cmuxTests/PerAgentSidebarStatusRowClearingTests.swift b/cmuxTests/PerAgentSidebarStatusRowClearingTests.swift new file mode 100644 index 000000000000..09108d79b23c --- /dev/null +++ b/cmuxTests/PerAgentSidebarStatusRowClearingTests.swift @@ -0,0 +1,184 @@ +import CmuxSidebar +import Foundation +import Testing + +#if canImport(cmux_DEV) +@testable import cmux_DEV +#elseif canImport(cmux) +@testable import cmux +#endif + +/// Continuation of `PerAgentSidebarStatusRowTests`, split to satisfy the +/// new-file length budget: bare-key exit-hook clears, dead-agent replacement, +/// and the rows summary accent. +@MainActor +struct PerAgentSidebarStatusRowClearingTests { + private func makeEntry( + key: String, + value: String, + timestamp: Date = Date() + ) -> SidebarStatusEntry { + SidebarStatusEntry( + key: key, + value: value, + icon: "bolt.fill", + color: "#4C8DFF", + timestamp: timestamp + ) + } + + @Test + func testBareKeyExitHookFromNonOwnerPaneClearsOnlyThatPanesRow() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + // Real bare-key hook sequence: both panes report the shared + // `claude_code` key, ownership migrates to the last reporter. + workspace.recordAgentPID(key: "claude_code", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Running"), panelId: firstPanelId) + workspace.setAgentLifecycle(key: "claude_code", panelId: firstPanelId, lifecycle: .running) + + workspace.recordAgentPID(key: "claude_code", pid: 222, panelId: secondPanelId, refreshPorts: false) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Waiting"), panelId: secondPanelId) + workspace.setAgentLifecycle(key: "claude_code", panelId: secondPanelId, lifecycle: .needsInput) + + // Pane A exits: its hook sends `clear_agent_pid claude_code --panel=A + // --clear-status` although pane B now owns the key. The clear must + // drop A's own row state without touching B's runtime. + #expect(workspace.clearAgentPID(key: "claude_code", panelId: firstPanelId, clearStatus: true, refreshPorts: false)) + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.map(\.panelId) == [secondPanelId]) + #expect(workspace.statusEntriesByPanelId[firstPanelId]?["claude_code"] == nil) + #expect(workspace.agentLifecycleStatesByPanelId[firstPanelId]?["claude_code"] == nil) + #expect(workspace.agentPIDs["claude_code"] == 222) + #expect(workspace.agentPIDPanelIdsByKey["claude_code"] == secondPanelId) + #expect(workspace.statusEntriesByPanelId[secondPanelId]?["claude_code"]?.value == "Waiting") + } + + @Test + func testClosingPanelWithoutPIDClearsSoleOwnerWorkspaceStatus() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + // `set_status --panel` without `--pid`: the workspace slot and the + // panel copy are both written, but there is no PID ownership for the + // runtime cleanup to sweep. + let entry = makeEntry(key: "claude_code", value: "Running") + workspace.recordPanelStatusEntry(entry, panelId: secondPanelId) + workspace.statusEntries["claude_code"] = entry + + _ = workspace.discardClosedPanelLifecycleState( + panelId: secondPanelId, + paneId: nil, + panel: workspace.panels[secondPanelId], + origin: "test", + closePanel: false, + publishSurfaceClosedEvent: false, + clearSurfaceNotifications: false, + requestTransferredRemoteCleanup: false + ) + + // The closed pane was the key's only plausible owner, so the stale + // workspace-level slot must not survive to be adopted by a future + // same-type agent pane through the sole-owner fallback. + #expect(workspace.statusEntries["claude_code"] == nil) + } + + @Test + func testClosingPanelKeepsWorkspaceStatusWhenAnotherPaneOwnsKey() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + let entry = makeEntry(key: "claude_code", value: "Running") + workspace.recordPanelStatusEntry(entry, panelId: firstPanelId) + workspace.recordPanelStatusEntry(entry, panelId: secondPanelId) + workspace.statusEntries["claude_code"] = entry + + _ = workspace.discardClosedPanelLifecycleState( + panelId: secondPanelId, + paneId: nil, + panel: workspace.panels[secondPanelId], + origin: "test", + closePanel: false, + publishSurfaceClosedEvent: false, + clearSurfaceNotifications: false, + requestTransferredRemoteCleanup: false + ) + + // The first pane still owns the key, so the workspace-level slot + // stays for its sole-owner fallback. + #expect(workspace.statusEntries["claude_code"]?.value == "Running") + #expect(workspace.statusEntriesByPanelId[firstPanelId]?["claude_code"]?.value == "Running") + } + + @Test + func testAmbiguousSharedKeyRowDoesNotInheritWorkspaceSortFreshness() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + workspace.recordAgentPID(key: "claude_code.first", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.recordAgentPID(key: "claude_code.second", pid: 222, panelId: secondPanelId, refreshPorts: false) + // Only the second pane has a panel-scoped entry; the workspace slot + // is newer and high-priority but ambiguous between the two panes. + workspace.recordPanelStatusEntry( + makeEntry(key: "claude_code", value: "Idle", timestamp: Date(timeIntervalSince1970: 100)), + panelId: secondPanelId + ) + workspace.statusEntries["claude_code"] = SidebarStatusEntry( + key: "claude_code", + value: "Running", + priority: 500, + timestamp: Date(timeIntervalSince1970: 9_999) + ) + + let rows = workspace.sidebarAgentStatusRows() + let rowsByPanel = Dictionary(uniqueKeysWithValues: rows.map { ($0.panelId, $0) }) + // The pane without its own entry must not borrow the ambiguous + // workspace entry's freshness for sorting. + #expect(rowsByPanel[firstPanelId]?.priority == 0) + #expect(rowsByPanel[firstPanelId]?.timestamp == .distantPast) + #expect(rows.first?.panelId == secondPanelId) + } + + @Test + func testAccordionSummaryCounts() { + func row(lifecycle: AgentHibernationLifecycleState?) -> SidebarAgentStatusRow { + SidebarAgentStatusRow( + panelId: UUID(), + statusKey: "claude_code", + value: nil, + icon: nil, + color: nil, + url: nil, + format: .plain, + lifecycle: lifecycle, + paneLabel: nil, + priority: 0, + timestamp: Date(timeIntervalSince1970: 0) + ) + } + + let summary = SidebarAgentStatusRowsSummary(rows: [ + row(lifecycle: .running), + row(lifecycle: .needsInput), + row(lifecycle: .idle), + ]) + #expect(summary.agentCount == 3) + #expect(summary.needsInputCount == 1) + #expect(summary.runningCount == 1) + #expect(summary.accentColorHex == "#FF9F0A") + + let runningOnly = SidebarAgentStatusRowsSummary(rows: [row(lifecycle: .running)]) + #expect(runningOnly.accentColorHex == "#4C8DFF") + #expect(SidebarAgentStatusRowsSummary(rows: [row(lifecycle: .idle)]).accentColorHex == nil) + } +} diff --git a/cmuxTests/PerAgentSidebarStatusRowTests.swift b/cmuxTests/PerAgentSidebarStatusRowTests.swift new file mode 100644 index 000000000000..65ce82de15f1 --- /dev/null +++ b/cmuxTests/PerAgentSidebarStatusRowTests.swift @@ -0,0 +1,367 @@ +import CmuxSidebar +import Foundation +import Testing + +#if canImport(cmux_DEV) +@testable import cmux_DEV +#elseif canImport(cmux) +@testable import cmux +#endif + +/// Per-pane agent status rows (sidebar): several agents in one workspace must +/// each keep their own row instead of collapsing into one last-write-wins +/// status pill per agent type. +@MainActor +struct PerAgentSidebarStatusRowTests { + private func makeEntry( + key: String, + value: String, + timestamp: Date = Date() + ) -> SidebarStatusEntry { + SidebarStatusEntry( + key: key, + value: value, + icon: "bolt.fill", + color: "#4C8DFF", + timestamp: timestamp + ) + } + + @Test + func testIdenticalPanelStatusReportDoesNotReplaceStoredEntry() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + + let first = makeEntry(key: "claude_code", value: "Running", timestamp: Date(timeIntervalSince1970: 100)) + workspace.recordPanelStatusEntry(first, panelId: panelId) + let repeated = makeEntry(key: "claude_code", value: "Running", timestamp: Date(timeIntervalSince1970: 200)) + workspace.recordPanelStatusEntry(repeated, panelId: panelId) + // Same display content, newer timestamp: dropped so agent heartbeats + // do not invalidate the sidebar snapshot. + #expect(workspace.statusEntriesByPanelId[panelId]?["claude_code"] == first) + + let changed = makeEntry(key: "claude_code", value: "Idle", timestamp: Date(timeIntervalSince1970: 300)) + workspace.recordPanelStatusEntry(changed, panelId: panelId) + #expect(workspace.statusEntriesByPanelId[panelId]?["claude_code"] == changed) + } + + @Test + func testAmbiguousWorkspaceStatusIsNotAttributedDuringTransfer() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + workspace.recordAgentPID(key: "claude_code.first", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.recordAgentPID(key: "claude_code.second", pid: 222, panelId: secondPanelId, refreshPorts: false) + // Only the workspace-level last-write-wins slot has text; either pane + // could have written it, so it must not ride along with a transfer. + workspace.statusEntries["claude_code"] = makeEntry(key: "claude_code", value: "Running") + + let runtimeState = try #require(workspace.agentRuntimeState(forPanelId: secondPanelId)) + #expect(runtimeState.statusEntries["claude_code"] == nil) + } + + @Test + func testTwoAgentsOfSameTypeKeepSeparateRows() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + workspace.recordAgentPID(key: "claude_code.first", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.recordAgentPID(key: "claude_code.second", pid: 222, panelId: secondPanelId, refreshPorts: false) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Running"), panelId: firstPanelId) + workspace.recordPanelStatusEntry( + makeEntry(key: "claude_code", value: "Claude is waiting for your input"), + panelId: secondPanelId + ) + // Workspace-level slot only kept the most recent write. + workspace.statusEntries["claude_code"] = makeEntry( + key: "claude_code", + value: "Claude is waiting for your input" + ) + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.count == 2) + #expect(Set(rows.map(\.panelId)) == [firstPanelId, secondPanelId]) + let valuesByPanel = Dictionary(uniqueKeysWithValues: rows.map { ($0.panelId, $0.value) }) + #expect(valuesByPanel[firstPanelId] == "Running") + #expect(valuesByPanel[secondPanelId] == "Claude is waiting for your input") + } + + @Test + func testSoleOwnerFallsBackToWorkspaceEntry() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + + workspace.recordAgentPID(key: "claude_code.only", pid: 111, panelId: panelId, refreshPorts: false) + workspace.statusEntries["claude_code"] = makeEntry(key: "claude_code", value: "Running") + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.count == 1) + #expect(rows.first?.panelId == panelId) + #expect(rows.first?.value == "Running") + } + + @Test + func testSharedKeyWithoutPanelEntriesUsesPerPanelLifecycleNotWorkspaceText() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + workspace.recordAgentPID(key: "claude_code.first", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.recordAgentPID(key: "claude_code.second", pid: 222, panelId: secondPanelId, refreshPorts: false) + workspace.setAgentLifecycle(key: "claude_code", panelId: firstPanelId, lifecycle: .running) + workspace.setAgentLifecycle(key: "claude_code", panelId: secondPanelId, lifecycle: .needsInput) + workspace.statusEntries["claude_code"] = makeEntry(key: "claude_code", value: "Running") + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.count == 2) + let byPanel = Dictionary(uniqueKeysWithValues: rows.map { ($0.panelId, $0) }) + // The ambiguous workspace-level text must not be attributed to either pane. + #expect(byPanel[firstPanelId]?.value == nil) + #expect(byPanel[secondPanelId]?.value == nil) + // Nor its decorations: the last writer's icon/color must not bleed + // onto the other pane's row. + #expect(byPanel[firstPanelId]?.icon == nil) + #expect(byPanel[secondPanelId]?.icon == nil) + #expect(byPanel[firstPanelId]?.color == nil) + #expect(byPanel[secondPanelId]?.color == nil) + #expect(byPanel[firstPanelId]?.lifecycle == .running) + #expect(byPanel[secondPanelId]?.lifecycle == .needsInput) + } + + @Test + func testRowCarriesReportedValueFormat() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + + workspace.recordAgentPID(key: "claude_code", pid: 111, panelId: panelId, refreshPorts: false) + workspace.recordPanelStatusEntry( + SidebarStatusEntry(key: "claude_code", value: "**bold** status", format: .markdown), + panelId: panelId + ) + + // The row must carry the reported value's format so markdown statuses + // keep their inline rendering after moving out of the metadata rows. + let row = try #require(workspace.sidebarAgentStatusRows().first) + #expect(row.value == "**bold** status") + #expect(row.format == .markdown) + } + + @Test + func testRegisteredDynamicAgentKeyProducesRowWithReporterContentAndClearsRuntime() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + let key = "third-party-agent" + let entry = SidebarStatusEntry( + key: key, + value: "Running checks", + icon: "text:TP", + color: "#34C759", + timestamp: Date(timeIntervalSince1970: 100) + ) + + workspace.registerDynamicAgentRowKey(key) + workspace.statusEntries[key] = entry + workspace.recordAgentPID(key: key, pid: 111, panelId: panelId, refreshPorts: false) + workspace.recordPanelStatusEntry(entry, panelId: panelId) + workspace.setAgentLifecycle(key: key, panelId: panelId, lifecycle: .running) + + let row = try #require(workspace.sidebarAgentStatusRows().first) + #expect(row.statusKey == key) + #expect(row.panelId == panelId) + #expect(row.value == "Running checks") + #expect(row.icon == "text:TP") + #expect(row.color == "#34C759") + #expect(row.lifecycle == .running) + #expect(workspace.dynamicAgentRowKeys.contains(key)) + + #expect(workspace.clearAgentPID(key: key, panelId: panelId, clearStatus: true, refreshPorts: false)) + #expect(workspace.sidebarAgentStatusRows().isEmpty) + #expect(!workspace.dynamicAgentRowKeys.contains(key)) + #expect(workspace.statusEntries[key] == nil) + #expect(workspace.statusEntriesByPanelId[panelId]?[key] == nil) + #expect(workspace.agentLifecycleStatesByPanelId[panelId]?[key] == nil) + } + + @Test + func testUnregisteredCustomKeyRemainsMetadataPill() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + let key = "unregistered-agent" + let entry = SidebarStatusEntry( + key: key, + value: "metadata only", + icon: "text:UA", + color: "#8E8E93", + timestamp: Date(timeIntervalSince1970: 100) + ) + + workspace.statusEntries[key] = entry + workspace.recordPanelStatusEntry(entry, panelId: panelId) + + #expect(workspace.sidebarAgentStatusRows().isEmpty) + #expect(workspace.statusEntriesByPanelId[panelId]?[key] == nil) + #expect(workspace.sidebarStatusEntriesVisibleForDisplay().contains(entry)) + } + + @Test + func testDynamicKeyRowEligibilityTransfersOnlyWhenRegistered() throws { + let source = Workspace() + let panelId = try #require(source.focusedPanelId) + let key = "third-party-agent" + let entry = SidebarStatusEntry( + key: key, + value: "Running checks", + icon: "emoji:🤖", + timestamp: Date(timeIntervalSince1970: 100) + ) + source.registerDynamicAgentRowKey(key) + source.statusEntries[key] = entry + source.recordAgentPID(key: key, pid: 111, panelId: panelId, refreshPorts: false) + source.recordPanelStatusEntry(entry, panelId: panelId) + + // A registered dynamic key carries its row eligibility across a pane + // transfer. + let runtimeState = try #require(source.agentRuntimeState(forPanelId: panelId)) + #expect(runtimeState.dynamicAgentRowKeys.contains(key)) + let destination = Workspace() + destination.adoptDetachedAgentRuntimeState(runtimeState) + #expect(destination.dynamicAgentRowKeys.contains(key)) + #expect(destination.sidebarAgentStatusRows().first?.statusKey == key) + + // An adopted runtime whose keys were never validated must stay a + // metadata pill in the destination, exactly as at the source. + let unvalidated = Workspace.DetachedAgentRuntimeState( + panelId: panelId, + statusEntries: [key: entry], + agentPIDs: [key: 111], + agentPIDProcessIdentities: [:], + agentPIDKeys: [key], + dynamicAgentRowKeys: [] + ) + let strictDestination = Workspace() + strictDestination.adoptDetachedAgentRuntimeState(unvalidated) + #expect(!strictDestination.dynamicAgentRowKeys.contains(key)) + #expect(strictDestination.sidebarAgentStatusRows().isEmpty) + } + + @Test + func testBareSharedPIDKeyHookSequenceKeepsBothPanesRows() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + // Mirrors the real Claude Code hook sequence, which shares ONE bare + // PID key per agent type across all panes of a workspace + // (`set_agent_pid claude_code --panel ...` then + // `set_status claude_code ... --pid --panel ...`). Bare-key ownership + // migrates to the last reporting pane, so the panel-scoped entry must + // keep the earlier pane's row alive. + workspace.recordAgentPID(key: "claude_code", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Running"), panelId: firstPanelId) + workspace.setAgentLifecycle(key: "claude_code", panelId: firstPanelId, lifecycle: .running) + + workspace.recordAgentPID(key: "claude_code", pid: 222, panelId: secondPanelId, refreshPorts: false) + workspace.recordPanelStatusEntry( + makeEntry(key: "claude_code", value: "Claude is waiting for your input"), + panelId: secondPanelId + ) + workspace.setAgentLifecycle(key: "claude_code", panelId: secondPanelId, lifecycle: .needsInput) + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.count == 2) + let valuesByPanel = Dictionary(uniqueKeysWithValues: rows.map { ($0.panelId, $0.value) }) + #expect(valuesByPanel[firstPanelId] == "Running") + #expect(valuesByPanel[secondPanelId] == "Claude is waiting for your input") + let rowsByPanel = Dictionary(uniqueKeysWithValues: rows.map { ($0.panelId, $0) }) + #expect(rowsByPanel[firstPanelId]?.lifecycle == .running) + #expect(rowsByPanel[secondPanelId]?.lifecycle == .needsInput) + } + + @Test + func testAgentReplacementOnSamePanelKeepsFreshPanelEntry() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + + workspace.recordAgentPID(key: "claude_code.old", pid: 111, panelId: panelId, refreshPorts: false) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Old session"), panelId: panelId) + + // A new session replacing the agent on the same panel: PID recording + // runs first (evicting the stale runtime, which clears its panel + // entry), then the new report's panel-scoped write. This is the upsert + // order the control-socket path uses; writing the panel copy first + // would let the eviction delete the fresh entry. + workspace.recordAgentPID(key: "claude_code.new", pid: 222, panelId: panelId, refreshPorts: false) + #expect(workspace.statusEntriesByPanelId[panelId]?["claude_code"] == nil) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "New session"), panelId: panelId) + + #expect(workspace.statusEntriesByPanelId[panelId]?["claude_code"]?.value == "New session") + #expect(workspace.sidebarAgentStatusRows().first?.value == "New session") + } + + @Test + func testClearingAgentPIDRemovesThatPanelsRow() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + + workspace.recordAgentPID(key: "claude_code.first", pid: 111, panelId: firstPanelId, refreshPorts: false) + workspace.recordAgentPID(key: "claude_code.second", pid: 222, panelId: secondPanelId, refreshPorts: false) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Running"), panelId: firstPanelId) + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Idle"), panelId: secondPanelId) + + #expect( + workspace.clearAgentPID(key: "claude_code.first", panelId: firstPanelId, clearStatus: true, refreshPorts: false) + ) + + let rows = workspace.sidebarAgentStatusRows() + #expect(rows.map(\.panelId) == [secondPanelId]) + #expect(workspace.statusEntriesByPanelId[firstPanelId]?["claude_code"] == nil) + #expect(workspace.statusEntriesByPanelId[secondPanelId]?["claude_code"]?.value == "Idle") + } + + @Test + func testDetachedRuntimeTransferCarriesPanelScopedEntry() throws { + let source = Workspace() + let panelId = try #require(source.focusedPanelId) + source.recordAgentPID(key: "claude_code.moved", pid: 111, panelId: panelId, refreshPorts: false) + source.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Running"), panelId: panelId) + + let runtimeState = try #require(source.agentRuntimeState(forPanelId: panelId)) + #expect(runtimeState.statusEntries["claude_code"]?.value == "Running") + + let destination = Workspace() + destination.adoptDetachedAgentRuntimeState(runtimeState) + #expect(destination.statusEntriesByPanelId[panelId]?["claude_code"]?.value == "Running") + #expect(destination.statusEntries["claude_code"]?.value == "Running") + } + + @Test + func testClosingPanelDropsPanelScopedEntries() throws { + let workspace = Workspace() + let firstPanelId = try #require(workspace.focusedPanelId) + let paneId = try #require(workspace.paneId(forPanelId: firstPanelId)) + let secondPanelId = try #require(workspace.newTerminalSurface(inPane: paneId, focus: false)).id + workspace.recordPanelStatusEntry(makeEntry(key: "claude_code", value: "Running"), panelId: secondPanelId) + + _ = workspace.discardClosedPanelLifecycleState( + panelId: secondPanelId, + paneId: nil, + panel: workspace.panels[secondPanelId], + origin: "test", + closePanel: false, + publishSurfaceClosedEvent: false, + clearSurfaceNotifications: false, + requestTransferredRemoteCleanup: false + ) + + #expect(workspace.statusEntriesByPanelId[secondPanelId] == nil) + #expect(workspace.sidebarAgentStatusRows().isEmpty) + } +} diff --git a/cmuxTests/SidebarAgentSurfaceNameTests.swift b/cmuxTests/SidebarAgentSurfaceNameTests.swift new file mode 100644 index 000000000000..ee690e4612f0 --- /dev/null +++ b/cmuxTests/SidebarAgentSurfaceNameTests.swift @@ -0,0 +1,88 @@ +import Foundation +import Testing + +#if canImport(cmux_DEV) +@testable import cmux_DEV +#elseif canImport(cmux) +@testable import cmux +#endif + +@MainActor +struct SidebarAgentSurfaceNameTests { + @Test + func userSetSurfaceNameIsAppendedWithoutChangingUnnamedRowText() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + workspace.recordAgentPID( + key: "claude_code.only", + pid: 111, + panelId: panelId, + refreshPorts: false + ) + workspace.panelTitles[panelId] = "workers" + + #expect(try #require(workspace.sidebarAgentStatusRows().first).paneLabel == "workers") + + #expect(workspace.setPanelCustomTitle(panelId: panelId, title: " fix-pr93 ")) + #expect( + try #require(workspace.sidebarAgentStatusRows().first).paneLabel + == "workers · fix-pr93" + ) + + #expect(workspace.setPanelCustomTitle(panelId: panelId, title: nil)) + #expect(try #require(workspace.sidebarAgentStatusRows().first).paneLabel == "workers") + } + + @Test + func autoGeneratedTitleRemainsTheBaseUntilUserClaimsIt() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + workspace.recordAgentPID( + key: "claude_code.only", + pid: 111, + panelId: panelId, + refreshPorts: false + ) + workspace.panelTitles[panelId] = "workers" + + #expect( + workspace.setPanelCustomTitle( + panelId: panelId, + title: "Generated topic", + source: .auto + ) + ) + #expect( + try #require(workspace.sidebarAgentStatusRows().first).paneLabel + == "Generated topic" + ) + + #expect( + workspace.setPanelCustomTitle( + panelId: panelId, + title: "Generated topic", + source: .user + ) + ) + #expect( + try #require(workspace.sidebarAgentStatusRows().first).paneLabel + == "workers · Generated topic" + ) + } + + @Test + func duplicateSurfaceNameIsNotRenderedTwice() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + workspace.recordAgentPID( + key: "claude_code.only", + pid: 111, + panelId: panelId, + refreshPorts: false + ) + workspace.panelTitles[panelId] = "fix-pr93" + + #expect(workspace.setPanelCustomTitle(panelId: panelId, title: "fix-pr93")) + #expect(try #require(workspace.sidebarAgentStatusRows().first).paneLabel == "fix-pr93") + } +} diff --git a/cmuxTests/SidebarSelectedWorkspaceScrollPolicyTests.swift b/cmuxTests/SidebarSelectedWorkspaceScrollPolicyTests.swift new file mode 100644 index 000000000000..9de3601befd4 --- /dev/null +++ b/cmuxTests/SidebarSelectedWorkspaceScrollPolicyTests.swift @@ -0,0 +1,100 @@ +import CmuxWorkspaces +import Foundation +import Testing + +#if canImport(cmux_DEV) +@testable import cmux_DEV +#elseif canImport(cmux) +@testable import cmux +#endif + +/// Sidebar selected-workspace scroll policy tests, split from the snapshot +/// refresh policy test file to satisfy the file-length budget. +@Suite struct SidebarSelectedWorkspaceScrollPolicyTests { + @Test func skipsScrollWhenSelectedWorkspaceIdIsNil() { + #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( + selectedWorkspaceId: nil as String?, + oldWorkspaceIds: ["a"], + newWorkspaceIds: ["a"] + )) + } + + @Test func requestsScrollWhenSelectedWorkspaceFirstAppears() { + #expect(SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( + selectedWorkspaceId: "b", + oldWorkspaceIds: ["a"], + newWorkspaceIds: ["a", "b"] + )) + } + + @Test func requestsScrollWhenSelectedWorkspaceMovesToTop() { + #expect(SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( + selectedWorkspaceId: "c", + oldWorkspaceIds: ["a", "b", "c"], + newWorkspaceIds: ["c", "a", "b"] + )) + } + + @Test func requestsScrollWhenAnotherReorderShiftsSelectedWorkspaceIndex() { + #expect(SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( + selectedWorkspaceId: "b", + oldWorkspaceIds: ["a", "b", "c"], + newWorkspaceIds: ["c", "a", "b"] + )) + } + + @Test func skipsScrollWhenWorkspaceBeforeSelectedWorkspaceCloses() { + #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace(selectedWorkspaceId: "d", oldWorkspaceIds: ["a", "b", "c", "d"], newWorkspaceIds: ["a", "c", "d"])) + } + @Test func skipsScrollWhenReorderLeavesSelectedWorkspaceIndexUnchanged() { + #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( + selectedWorkspaceId: "a", + oldWorkspaceIds: ["a", "b", "c"], + newWorkspaceIds: ["a", "c", "b"] + )) + } + + @Test func skipsScrollWhenSelectedWorkspaceIsMissing() { + #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( + selectedWorkspaceId: "b", + oldWorkspaceIds: ["a", "b"], + newWorkspaceIds: ["a", "c"] + )) + } + + @Test func scrollTargetIsSelfWithoutGroup() { + let workspaceId = UUID() + #expect(SidebarSelectedWorkspaceScrollPolicy.scrollTargetWorkspaceId( + selectedWorkspaceId: workspaceId, + group: nil + ) == workspaceId) + } + + @Test func scrollTargetIsSelfInExpandedGroup() { + let workspaceId = UUID() + #expect(SidebarSelectedWorkspaceScrollPolicy.scrollTargetWorkspaceId( + selectedWorkspaceId: workspaceId, + group: makeGroup(isCollapsed: false, anchorWorkspaceId: UUID()) + ) == workspaceId) + } + + @Test func scrollTargetIsGroupAnchorWhenGroupIsCollapsed() { + let anchorId = UUID() + #expect(SidebarSelectedWorkspaceScrollPolicy.scrollTargetWorkspaceId( + selectedWorkspaceId: UUID(), + group: makeGroup(isCollapsed: true, anchorWorkspaceId: anchorId) + ) == anchorId) + } + + private func makeGroup(isCollapsed: Bool, anchorWorkspaceId: UUID) -> WorkspaceGroup { + WorkspaceGroup( + id: UUID(), + name: "group", + isCollapsed: isCollapsed, + isPinned: false, + anchorWorkspaceId: anchorWorkspaceId, + customColor: nil, + iconSymbol: nil + ) + } +} diff --git a/cmuxTests/SidebarWorkspaceRowInteractionStateTests.swift b/cmuxTests/SidebarWorkspaceRowInteractionStateTests.swift new file mode 100644 index 000000000000..708a76b916b8 --- /dev/null +++ b/cmuxTests/SidebarWorkspaceRowInteractionStateTests.swift @@ -0,0 +1,232 @@ +import AppKit +import Testing + +#if canImport(cmux_DEV) +@testable import cmux_DEV +#elseif canImport(cmux) +@testable import cmux +#endif + +/// Sidebar row interaction tests, split from the snapshot refresh policy test +/// file to satisfy the file-length budget. +@Suite struct SidebarWorkspaceRowInteractionStateTests { + @Test func appKitMenuTrackingEndClearsStaleContextMenuVisibility() { + var state = SidebarWorkspaceRowInteractionState() + + state.contextMenuDidAppear() + #expect(state.contextMenuVisible) + + let didEndTracking = state.contextMenuTrackingDidEnd(pointerInsideRow: true) + #expect(didEndTracking) + state.setPointerHovering(true) + + #expect( + state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "AppKit menu tracking ending must clear stale SwiftUI context-menu visibility so later hover can reveal row affordances." + ) + } + + @Test func appKitMenuTrackingEndUsesReconciledPointerExit() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + state.contextMenuDidAppear() + + let didEndTracking = state.contextMenuTrackingDidEnd(pointerInsideRow: false) + #expect(didEndTracking) + + #expect( + !state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "If the pointer leaves through the context menu, AppKit menu tracking reconciliation must keep the row affordance hidden." + ) + } + + @Test @MainActor func menuTrackingReconcilerIgnoresSubmenuEndNotifications() { + let rootMenu = NSMenu() + let submenu = NSMenu() + let item = NSMenuItem(title: "submenu", action: nil, keyEquivalent: "") + rootMenu.addItem(item) + rootMenu.setSubmenu(submenu, for: item) + + #expect(SidebarWorkspaceRowMenuTrackingReconcilerView.shouldReconcileMenuEnd(object: rootMenu)) + #expect(!SidebarWorkspaceRowMenuTrackingReconcilerView.shouldReconcileMenuEnd(object: submenu)) + #expect(!SidebarWorkspaceRowMenuTrackingReconcilerView.shouldReconcileMenuEnd(object: nil)) + } + + @Test func hoverDuringContextMenuStaysHiddenUntilDismissal() { + var state = SidebarWorkspaceRowInteractionState() + + state.contextMenuDidAppear() + state.setPointerHovering(true) + + #expect( + !state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "Pointer hover updates observed during the context-menu lifecycle must not reveal the close affordance under the menu." + ) + + state.contextMenuDidDisappear() + + #expect( + state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "Once the context menu dismisses, the last observed pointer position may reveal the close affordance." + ) + } + + @Test func contextMenuDismissalRestoresHoverWithoutPointerMovement() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + state.contextMenuDidAppear() + state.contextMenuDidDisappear() + + #expect( + state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "Closing a context menu without moving the pointer must restore the row hover affordance." + ) + } + + @Test func pointerExitWhileContextMenuIsVisibleStaysHiddenAfterDismissal() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + state.contextMenuDidAppear() + state.contextMenuTrackingObserverDidInstall() + state.setPointerHovering(false) + state.contextMenuDidDisappear() + + #expect( + !state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "Pointer exit remains authoritative even when it is observed during the context-menu lifecycle." + ) + } + + @Test func swiftUIOnlyFastContextMenuDismissalKeepsInitialHoverFallback() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + state.contextMenuDidAppear() + state.setPointerHovering(false) + state.contextMenuDidDisappear() + + #expect( + state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "A SwiftUI hover-exit caused by the menu taking focus must not erase the initial hover fallback before the AppKit reconciler mounts." + ) + } + + @Test func noHoverDoesNotRevealCloseButtonWhileContextMenuIsVisible() { + var state = SidebarWorkspaceRowInteractionState() + + state.contextMenuDidAppear() + state.setPointerHovering(false) + + #expect( + !state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "A visible context menu must not make the close affordance visible when the pointer is not hovering." + ) + } + + @Test @MainActor func hoverReconcilerRestoresCloseButtonAfterLifecycleHoverReset() { + var state = SidebarWorkspaceRowInteractionState() + + let view = SidebarWorkspaceRowHoverReconcilerView() + view.frame = NSRect(x: 0, y: 0, width: 120, height: 28) + view.onPointerHoverChanged = { state.setPointerHovering($0) } + + view.reconcilePointerLocation(pointInView: NSPoint(x: 60, y: 14)) + #expect(state.shouldShowCloseButton(canCloseWorkspace: true, shortcutHintModeActive: false)) + + state.setPointerHovering(false) + #expect(!state.shouldShowCloseButton(canCloseWorkspace: true, shortcutHintModeActive: false)) + + view.reconcilePointerLocation(pointInView: NSPoint(x: 60, y: 14)) + + #expect( + state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "When sidebar updates or row reuse clear SwiftUI hover state while the pointer is still inside the row, the AppKit hover reconciler must restore the close affordance without waiting for another mouse move." + ) + } + + @Test func contextMenuAppearanceHidesExistingCloseButtonUntilPointerIsReconciled() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + #expect(state.shouldShowCloseButton(canCloseWorkspace: true, shortcutHintModeActive: false)) + + state.contextMenuDidAppear() + + #expect( + !state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "Opening a context menu must clear the row close affordance until tracking reports the pointer is still inside." + ) + } + + @Test func contextMenuDismissalCanRevealAfterPointerReconciliation() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + state.contextMenuDidAppear() + state.contextMenuDidDisappear() + state.setPointerHovering(true) + + #expect( + state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: false + ), + "Closing the context menu may reveal the close affordance again only after pointer tracking reconciles inside the row." + ) + } + + @Test func closeButtonHiddenWhenWorkspaceCannotBeClosed() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + + #expect(!state.shouldShowCloseButton( + canCloseWorkspace: false, + shortcutHintModeActive: false + )) + } + + @Test func closeButtonHiddenDuringShortcutHintMode() { + var state = SidebarWorkspaceRowInteractionState() + + state.setPointerHovering(true) + + #expect(!state.shouldShowCloseButton( + canCloseWorkspace: true, + shortcutHintModeActive: true + )) + } +} diff --git a/cmuxTests/SidebarWorkspaceSnapshotRefreshPolicyTests.swift b/cmuxTests/SidebarWorkspaceSnapshotRefreshPolicyTests.swift index d463b13adfa2..4175f987fad1 100644 --- a/cmuxTests/SidebarWorkspaceSnapshotRefreshPolicyTests.swift +++ b/cmuxTests/SidebarWorkspaceSnapshotRefreshPolicyTests.swift @@ -11,12 +11,14 @@ import Testing @Suite struct SidebarWorkspaceSnapshotRefreshPolicyTests { @Test func contextMenuPinChangeUpdatesDisplayedFieldsAndDefersNoisyFields() { + let currentAgentRows = [Self.agentStatusRow(value: "Running")] let current = Self.snapshot( title: "lmao", isPinned: false, customColorHex: nil, remoteConnectionStatusText: "Connected", latestConversationMessage: "old message", + agentStatusRows: currentAgentRows, listeningPorts: [3000], finderDirectoryPath: "/old" ) @@ -26,6 +28,7 @@ import Testing customColorHex: nil, remoteConnectionStatusText: "Disconnected", latestConversationMessage: "new message", + agentStatusRows: [], listeningPorts: [3000, 4000], finderDirectoryPath: nil ) @@ -44,6 +47,9 @@ import Testing #expect(decision.workspaceSnapshotStorage?.remoteConnectionStatusText == "Connected") #expect(decision.workspaceSnapshotStorage?.latestConversationMessage == "old message") #expect(decision.workspaceSnapshotStorage?.listeningPorts == [3000]) + // Agent rows are noisy telemetry: they must survive the immediate + // context-menu refresh unchanged, like metadataEntries/listeningPorts. + #expect(decision.workspaceSnapshotStorage?.agentStatusRows == currentAgentRows) #expect(decision.workspaceSnapshotStorage?.finderDirectoryPath == nil) #expect(decision.pendingWorkspaceSnapshot == next) #expect(decision.hasDeferredWorkspaceObservationInvalidation) @@ -127,6 +133,7 @@ import Testing customColorHex: String? = nil, remoteConnectionStatusText: String = "Disconnected", latestConversationMessage: String? = nil, + agentStatusRows: [SidebarAgentStatusRow] = [], listeningPorts: [Int] = [], finderDirectoryPath: String? = nil, mediaActivity: BrowserMediaActivity = BrowserMediaActivity(), @@ -145,6 +152,7 @@ import Testing copyableSidebarSSHError: nil, latestConversationMessage: latestConversationMessage, metadataEntries: [], + agentStatusRows: agentStatusRows, metadataBlocks: [], latestLog: nil, progress: nil, @@ -161,6 +169,22 @@ import Testing ) } + static func agentStatusRow(value: String) -> SidebarAgentStatusRow { + SidebarAgentStatusRow( + panelId: UUID(), + statusKey: "claude_code", + value: value, + icon: nil, + color: nil, + url: nil, + format: .plain, + lifecycle: nil, + paneLabel: nil, + priority: 0, + timestamp: Date(timeIntervalSince1970: 0) + ) + } + static func presentationKey( showsWorkspaceDescription: Bool = true, usesVerticalBranchLayout: Bool = true, @@ -186,314 +210,3 @@ import Testing ) } } - -@Suite struct SidebarSelectedWorkspaceScrollPolicyTests { - @Test func skipsScrollWhenSelectedWorkspaceIdIsNil() { - #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( - selectedWorkspaceId: nil as String?, - oldWorkspaceIds: ["a"], - newWorkspaceIds: ["a"] - )) - } - - @Test func requestsScrollWhenSelectedWorkspaceFirstAppears() { - #expect(SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( - selectedWorkspaceId: "b", - oldWorkspaceIds: ["a"], - newWorkspaceIds: ["a", "b"] - )) - } - - @Test func requestsScrollWhenSelectedWorkspaceMovesToTop() { - #expect(SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( - selectedWorkspaceId: "c", - oldWorkspaceIds: ["a", "b", "c"], - newWorkspaceIds: ["c", "a", "b"] - )) - } - - @Test func requestsScrollWhenAnotherReorderShiftsSelectedWorkspaceIndex() { - #expect(SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( - selectedWorkspaceId: "b", - oldWorkspaceIds: ["a", "b", "c"], - newWorkspaceIds: ["c", "a", "b"] - )) - } - - @Test func skipsScrollWhenWorkspaceBeforeSelectedWorkspaceCloses() { - #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace(selectedWorkspaceId: "d", oldWorkspaceIds: ["a", "b", "c", "d"], newWorkspaceIds: ["a", "c", "d"])) - } - @Test func skipsScrollWhenReorderLeavesSelectedWorkspaceIndexUnchanged() { - #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( - selectedWorkspaceId: "a", - oldWorkspaceIds: ["a", "b", "c"], - newWorkspaceIds: ["a", "c", "b"] - )) - } - - @Test func skipsScrollWhenSelectedWorkspaceIsMissing() { - #expect(!SidebarSelectedWorkspaceScrollPolicy.shouldScrollSelectedWorkspace( - selectedWorkspaceId: "b", - oldWorkspaceIds: ["a", "b"], - newWorkspaceIds: ["a", "c"] - )) - } - - @Test func scrollTargetIsSelfWithoutGroup() { - let workspaceId = UUID() - #expect(SidebarSelectedWorkspaceScrollPolicy.scrollTargetWorkspaceId( - selectedWorkspaceId: workspaceId, - group: nil - ) == workspaceId) - } - - @Test func scrollTargetIsSelfInExpandedGroup() { - let workspaceId = UUID() - #expect(SidebarSelectedWorkspaceScrollPolicy.scrollTargetWorkspaceId( - selectedWorkspaceId: workspaceId, - group: makeGroup(isCollapsed: false, anchorWorkspaceId: UUID()) - ) == workspaceId) - } - - @Test func scrollTargetIsGroupAnchorWhenGroupIsCollapsed() { - let anchorId = UUID() - #expect(SidebarSelectedWorkspaceScrollPolicy.scrollTargetWorkspaceId( - selectedWorkspaceId: UUID(), - group: makeGroup(isCollapsed: true, anchorWorkspaceId: anchorId) - ) == anchorId) - } - - private func makeGroup(isCollapsed: Bool, anchorWorkspaceId: UUID) -> WorkspaceGroup { - WorkspaceGroup( - id: UUID(), - name: "group", - isCollapsed: isCollapsed, - isPinned: false, - anchorWorkspaceId: anchorWorkspaceId, - customColor: nil, - iconSymbol: nil - ) - } -} - -@Suite struct SidebarWorkspaceRowInteractionStateTests { - @Test func appKitMenuTrackingEndClearsStaleContextMenuVisibility() { - var state = SidebarWorkspaceRowInteractionState() - - state.contextMenuDidAppear() - #expect(state.contextMenuVisible) - - let didEndTracking = state.contextMenuTrackingDidEnd(pointerInsideRow: true) - #expect(didEndTracking) - state.setPointerHovering(true) - - #expect( - state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "AppKit menu tracking ending must clear stale SwiftUI context-menu visibility so later hover can reveal row affordances." - ) - } - - @Test func appKitMenuTrackingEndUsesReconciledPointerExit() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - state.contextMenuDidAppear() - - let didEndTracking = state.contextMenuTrackingDidEnd(pointerInsideRow: false) - #expect(didEndTracking) - - #expect( - !state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "If the pointer leaves through the context menu, AppKit menu tracking reconciliation must keep the row affordance hidden." - ) - } - - @Test @MainActor func menuTrackingReconcilerIgnoresSubmenuEndNotifications() { - let rootMenu = NSMenu() - let submenu = NSMenu() - let item = NSMenuItem(title: "submenu", action: nil, keyEquivalent: "") - rootMenu.addItem(item) - rootMenu.setSubmenu(submenu, for: item) - - #expect(SidebarWorkspaceRowMenuTrackingReconcilerView.shouldReconcileMenuEnd(object: rootMenu)) - #expect(!SidebarWorkspaceRowMenuTrackingReconcilerView.shouldReconcileMenuEnd(object: submenu)) - #expect(!SidebarWorkspaceRowMenuTrackingReconcilerView.shouldReconcileMenuEnd(object: nil)) - } - - @Test func hoverDuringContextMenuStaysHiddenUntilDismissal() { - var state = SidebarWorkspaceRowInteractionState() - - state.contextMenuDidAppear() - state.setPointerHovering(true) - - #expect( - !state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "Pointer hover updates observed during the context-menu lifecycle must not reveal the close affordance under the menu." - ) - - state.contextMenuDidDisappear() - - #expect( - state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "Once the context menu dismisses, the last observed pointer position may reveal the close affordance." - ) - } - - @Test func contextMenuDismissalRestoresHoverWithoutPointerMovement() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - state.contextMenuDidAppear() - state.contextMenuDidDisappear() - - #expect( - state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "Closing a context menu without moving the pointer must restore the row hover affordance." - ) - } - - @Test func pointerExitWhileContextMenuIsVisibleStaysHiddenAfterDismissal() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - state.contextMenuDidAppear() - state.contextMenuTrackingObserverDidInstall() - state.setPointerHovering(false) - state.contextMenuDidDisappear() - - #expect( - !state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "Pointer exit remains authoritative even when it is observed during the context-menu lifecycle." - ) - } - - @Test func swiftUIOnlyFastContextMenuDismissalKeepsInitialHoverFallback() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - state.contextMenuDidAppear() - state.setPointerHovering(false) - state.contextMenuDidDisappear() - - #expect( - state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "A SwiftUI hover-exit caused by the menu taking focus must not erase the initial hover fallback before the AppKit reconciler mounts." - ) - } - - @Test func noHoverDoesNotRevealCloseButtonWhileContextMenuIsVisible() { - var state = SidebarWorkspaceRowInteractionState() - - state.contextMenuDidAppear() - state.setPointerHovering(false) - - #expect( - !state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "A visible context menu must not make the close affordance visible when the pointer is not hovering." - ) - } - - @Test @MainActor func hoverReconcilerRestoresCloseButtonAfterLifecycleHoverReset() { - var state = SidebarWorkspaceRowInteractionState() - - let view = SidebarWorkspaceRowHoverReconcilerView() - view.frame = NSRect(x: 0, y: 0, width: 120, height: 28) - view.onPointerHoverChanged = { state.setPointerHovering($0) } - - view.reconcilePointerLocation(pointInView: NSPoint(x: 60, y: 14)) - #expect(state.shouldShowCloseButton(canCloseWorkspace: true, shortcutHintModeActive: false)) - - state.setPointerHovering(false) - #expect(!state.shouldShowCloseButton(canCloseWorkspace: true, shortcutHintModeActive: false)) - - view.reconcilePointerLocation(pointInView: NSPoint(x: 60, y: 14)) - - #expect( - state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "When sidebar updates or row reuse clear SwiftUI hover state while the pointer is still inside the row, the AppKit hover reconciler must restore the close affordance without waiting for another mouse move." - ) - } - - @Test func contextMenuAppearanceHidesExistingCloseButtonUntilPointerIsReconciled() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - #expect(state.shouldShowCloseButton(canCloseWorkspace: true, shortcutHintModeActive: false)) - - state.contextMenuDidAppear() - - #expect( - !state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "Opening a context menu must clear the row close affordance until tracking reports the pointer is still inside." - ) - } - - @Test func contextMenuDismissalCanRevealAfterPointerReconciliation() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - state.contextMenuDidAppear() - state.contextMenuDidDisappear() - state.setPointerHovering(true) - - #expect( - state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: false - ), - "Closing the context menu may reveal the close affordance again only after pointer tracking reconciles inside the row." - ) - } - - @Test func closeButtonHiddenWhenWorkspaceCannotBeClosed() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - - #expect(!state.shouldShowCloseButton( - canCloseWorkspace: false, - shortcutHintModeActive: false - )) - } - - @Test func closeButtonHiddenDuringShortcutHintMode() { - var state = SidebarWorkspaceRowInteractionState() - - state.setPointerHovering(true) - - #expect(!state.shouldShowCloseButton( - canCloseWorkspace: true, - shortcutHintModeActive: true - )) - } -} diff --git a/cmuxTests/WorkspaceSidebarObservationTests.swift b/cmuxTests/WorkspaceSidebarObservationTests.swift index e0eb1f70fd9b..2febced2d604 100644 --- a/cmuxTests/WorkspaceSidebarObservationTests.swift +++ b/cmuxTests/WorkspaceSidebarObservationTests.swift @@ -367,6 +367,41 @@ struct WorkspaceSidebarObservationTests { ) == 2 ) } + + @Test func sidebarObservationPublisherEmitsForSameTextCustomTitleProvenanceChange() throws { + let workspace = Workspace() + let panelId = try #require(workspace.focusedPanelId) + workspace.panelTitles[panelId] = "workers" + #expect( + workspace.setPanelCustomTitle( + panelId: panelId, + title: "Generated topic", + source: .auto + ) + ) + + var publishCount = 0 + let cancellable = workspace.sidebarObservationPublisher.sink { + publishCount += 1 + } + defer { cancellable.cancel() } + publishCount = 0 + + #expect( + workspace.setPanelCustomTitle( + panelId: panelId, + title: "Generated topic", + source: .user + ) + ) + #expect( + publishCount == 1, + "A same-text auto-to-user title claim must invalidate the sidebar snapshot." + ) + #expect( + workspace.sidebarAgentStatusRows().first?.paneLabel == "workers · Generated topic" + ) + } } // Mutable flag captured by Observation's Sendable onChange closure in this test.