@lattices/cli 0.4.14 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/README.md +5 -7
  2. package/apps/mac/Info.plist +4 -4
  3. package/apps/mac/Lattices.app/Contents/Info.plist +4 -12
  4. package/apps/mac/Lattices.app/Contents/MacOS/Lattices +0 -0
  5. package/bin/lattices-app.ts +110 -17
  6. package/bin/lattices-build +125 -0
  7. package/bin/lattices-dev +89 -16
  8. package/bin/lattices.ts +977 -16
  9. package/docs/agents.md +81 -4
  10. package/docs/ai-chat-ux-review.md +416 -0
  11. package/docs/api.md +135 -3
  12. package/docs/app.md +30 -8
  13. package/docs/config.md +4 -0
  14. package/docs/mouse-gestures.md +60 -1
  15. package/docs/proposals/LAT-004-interactive-overlay-actors.md +1 -1
  16. package/docs/proposals/LAT-005-action-runtime-product-spine.md +914 -0
  17. package/docs/proposals/LAT-006-mira-in-lattices.md +553 -0
  18. package/docs/proposals/LAT-007-unified-app-shell.md +128 -0
  19. package/docs/reference/dewey.config.ts +2 -2
  20. package/docs/release.md +171 -0
  21. package/docs/repo-structure.md +5 -5
  22. package/docs/voice.md +11 -27
  23. package/package.json +11 -10
  24. package/apps/mac/Package.swift +0 -27
  25. package/apps/mac/Sources/AppShell/App.swift +0 -26
  26. package/apps/mac/Sources/AppShell/AppActivationCoordinator.swift +0 -27
  27. package/apps/mac/Sources/AppShell/AppDelegate.swift +0 -189
  28. package/apps/mac/Sources/AppShell/AppServicesBootstrap.swift +0 -25
  29. package/apps/mac/Sources/AppShell/AppShellView.swift +0 -171
  30. package/apps/mac/Sources/AppShell/AppUpdater.swift +0 -305
  31. package/apps/mac/Sources/AppShell/CliActionLauncher.swift +0 -50
  32. package/apps/mac/Sources/AppShell/HomeDashboardView.swift +0 -133
  33. package/apps/mac/Sources/AppShell/HotkeyBootstrap.swift +0 -87
  34. package/apps/mac/Sources/AppShell/KeyRecorderView.swift +0 -210
  35. package/apps/mac/Sources/AppShell/LatticesRuntime.swift +0 -104
  36. package/apps/mac/Sources/AppShell/MainView.swift +0 -847
  37. package/apps/mac/Sources/AppShell/MainWindow.swift +0 -83
  38. package/apps/mac/Sources/AppShell/MenuBarController.swift +0 -177
  39. package/apps/mac/Sources/AppShell/OnboardingView.swift +0 -483
  40. package/apps/mac/Sources/AppShell/PermissionsAssistantView.swift +0 -366
  41. package/apps/mac/Sources/AppShell/PermissionsAssistantWindow.swift +0 -70
  42. package/apps/mac/Sources/AppShell/Preferences.swift +0 -297
  43. package/apps/mac/Sources/AppShell/SettingsView.swift +0 -3163
  44. package/apps/mac/Sources/AppShell/SettingsWindow.swift +0 -34
  45. package/apps/mac/Sources/AppShell/WorkspaceInspectorPresenter.swift +0 -13
  46. package/apps/mac/Sources/Core/Actions/HotkeyManager.swift +0 -256
  47. package/apps/mac/Sources/Core/Actions/HotkeyStore.swift +0 -399
  48. package/apps/mac/Sources/Core/Actions/IntentEngine.swift +0 -988
  49. package/apps/mac/Sources/Core/Actions/IntentSchema.swift +0 -94
  50. package/apps/mac/Sources/Core/Actions/Intents/CreateLayerIntent.swift +0 -54
  51. package/apps/mac/Sources/Core/Actions/Intents/DistributeIntent.swift +0 -56
  52. package/apps/mac/Sources/Core/Actions/Intents/FocusIntent.swift +0 -69
  53. package/apps/mac/Sources/Core/Actions/Intents/HelpIntent.swift +0 -41
  54. package/apps/mac/Sources/Core/Actions/Intents/KillIntent.swift +0 -47
  55. package/apps/mac/Sources/Core/Actions/Intents/LatticeIntent.swift +0 -53
  56. package/apps/mac/Sources/Core/Actions/Intents/LaunchIntent.swift +0 -67
  57. package/apps/mac/Sources/Core/Actions/Intents/ListSessionsIntent.swift +0 -32
  58. package/apps/mac/Sources/Core/Actions/Intents/ListWindowsIntent.swift +0 -30
  59. package/apps/mac/Sources/Core/Actions/Intents/ScanIntent.swift +0 -52
  60. package/apps/mac/Sources/Core/Actions/Intents/SearchIntent.swift +0 -190
  61. package/apps/mac/Sources/Core/Actions/Intents/SwitchLayerIntent.swift +0 -50
  62. package/apps/mac/Sources/Core/Actions/Intents/TileIntent.swift +0 -61
  63. package/apps/mac/Sources/Core/Actions/PaletteCommand.swift +0 -439
  64. package/apps/mac/Sources/Core/Actions/VoiceIntentResolver.swift +0 -713
  65. package/apps/mac/Sources/Core/Companion/CompanionActivityLog.swift +0 -70
  66. package/apps/mac/Sources/Core/Companion/CompanionKeyboardController.swift +0 -141
  67. package/apps/mac/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +0 -454
  68. package/apps/mac/Sources/Core/Companion/LatticesCompanionCockpit.swift +0 -555
  69. package/apps/mac/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +0 -629
  70. package/apps/mac/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +0 -204
  71. package/apps/mac/Sources/Core/Companion/LatticesDeckHost.swift +0 -1463
  72. package/apps/mac/Sources/Core/Daemon/DaemonProtocol.swift +0 -114
  73. package/apps/mac/Sources/Core/Daemon/DaemonServer.swift +0 -427
  74. package/apps/mac/Sources/Core/Daemon/LatticesApi.swift +0 -2965
  75. package/apps/mac/Sources/Core/Desktop/AccessibilityTextExtractor.swift +0 -111
  76. package/apps/mac/Sources/Core/Desktop/AppTypeClassifier.swift +0 -106
  77. package/apps/mac/Sources/Core/Desktop/DesktopModel.swift +0 -331
  78. package/apps/mac/Sources/Core/Desktop/DesktopModelTypes.swift +0 -73
  79. package/apps/mac/Sources/Core/Desktop/InventoryManager.swift +0 -35
  80. package/apps/mac/Sources/Core/Desktop/InventoryPath.swift +0 -43
  81. package/apps/mac/Sources/Core/Desktop/MouseFinder.swift +0 -527
  82. package/apps/mac/Sources/Core/Desktop/OcrModel.swift +0 -467
  83. package/apps/mac/Sources/Core/Desktop/OcrStore.swift +0 -329
  84. package/apps/mac/Sources/Core/Desktop/PlacementSpec.swift +0 -195
  85. package/apps/mac/Sources/Core/Desktop/SessionWindowLocator.swift +0 -139
  86. package/apps/mac/Sources/Core/Desktop/TilePickerView.swift +0 -209
  87. package/apps/mac/Sources/Core/Desktop/WindowCapture.swift +0 -33
  88. package/apps/mac/Sources/Core/Desktop/WindowDragSnapController.swift +0 -429
  89. package/apps/mac/Sources/Core/Desktop/WindowPreviewCard.swift +0 -100
  90. package/apps/mac/Sources/Core/Desktop/WindowPreviewStore.swift +0 -112
  91. package/apps/mac/Sources/Core/Desktop/WindowSelectionStore.swift +0 -76
  92. package/apps/mac/Sources/Core/Desktop/WindowTiler.swift +0 -2222
  93. package/apps/mac/Sources/Core/Input/EventTapBreaker.swift +0 -124
  94. package/apps/mac/Sources/Core/Input/EventTapThread.swift +0 -54
  95. package/apps/mac/Sources/Core/Input/InputCaptureResetCenter.swift +0 -20
  96. package/apps/mac/Sources/Core/Input/KeyboardRemapConfig.swift +0 -69
  97. package/apps/mac/Sources/Core/Input/KeyboardRemapController.swift +0 -346
  98. package/apps/mac/Sources/Core/Input/KeyboardRemapStore.swift +0 -141
  99. package/apps/mac/Sources/Core/Input/MouseGestureConfig.swift +0 -499
  100. package/apps/mac/Sources/Core/Input/MouseGestureController.swift +0 -2583
  101. package/apps/mac/Sources/Core/Input/MouseInputDeviceStore.swift +0 -98
  102. package/apps/mac/Sources/Core/Input/MouseInputEventViewer.swift +0 -272
  103. package/apps/mac/Sources/Core/Input/MouseShortcutStore.swift +0 -170
  104. package/apps/mac/Sources/Core/Input/SecureEventInputMonitor.swift +0 -39
  105. package/apps/mac/Sources/Core/Input/ShapeRecognizer.swift +0 -624
  106. package/apps/mac/Sources/Core/Input/TapBudgetMeter.swift +0 -56
  107. package/apps/mac/Sources/Core/Overlays/AppWindowShell.swift +0 -63
  108. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeState.swift +0 -1566
  109. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeView.swift +0 -1927
  110. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeWindow.swift +0 -196
  111. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteView.swift +0 -307
  112. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +0 -67
  113. package/apps/mac/Sources/Core/Overlays/HUD/CheatSheetHUD.swift +0 -576
  114. package/apps/mac/Sources/Core/Overlays/HUD/HUDBottomBar.swift +0 -279
  115. package/apps/mac/Sources/Core/Overlays/HUD/HUDController.swift +0 -1158
  116. package/apps/mac/Sources/Core/Overlays/HUD/HUDLeftBar.swift +0 -849
  117. package/apps/mac/Sources/Core/Overlays/HUD/HUDMinimap.swift +0 -179
  118. package/apps/mac/Sources/Core/Overlays/HUD/HUDRightBar.swift +0 -596
  119. package/apps/mac/Sources/Core/Overlays/HUD/HUDState.swift +0 -367
  120. package/apps/mac/Sources/Core/Overlays/HUD/HUDTopBar.swift +0 -243
  121. package/apps/mac/Sources/Core/Overlays/HUD/LauncherHUD.swift +0 -334
  122. package/apps/mac/Sources/Core/Overlays/HUD/LayerBezel.swift +0 -203
  123. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchState.swift +0 -280
  124. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchView.swift +0 -422
  125. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchWindow.swift +0 -94
  126. package/apps/mac/Sources/Core/Overlays/OverlayPanelShell.swift +0 -241
  127. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapState.swift +0 -3135
  128. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapView.swift +0 -3977
  129. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapWindowController.swift +0 -119
  130. package/apps/mac/Sources/Core/Overlays/ScreenOverlayCanvasController.swift +0 -1217
  131. package/apps/mac/Sources/Core/Overlays/Voice/VoiceCommandWindow.swift +0 -1575
  132. package/apps/mac/Sources/Core/Pi/PiAuthNextStepCard.swift +0 -148
  133. package/apps/mac/Sources/Core/Pi/PiAuthPromptCard.swift +0 -90
  134. package/apps/mac/Sources/Core/Pi/PiChatDock.swift +0 -564
  135. package/apps/mac/Sources/Core/Pi/PiChatSession.swift +0 -1948
  136. package/apps/mac/Sources/Core/Pi/PiInstallCallout.swift +0 -86
  137. package/apps/mac/Sources/Core/Pi/PiProviderSetupCallout.swift +0 -99
  138. package/apps/mac/Sources/Core/Pi/PiWorkspaceView.swift +0 -510
  139. package/apps/mac/Sources/Core/System/Capability.swift +0 -79
  140. package/apps/mac/Sources/Core/System/DiagnosticLog.swift +0 -373
  141. package/apps/mac/Sources/Core/System/EventBus.swift +0 -31
  142. package/apps/mac/Sources/Core/System/PermissionChecker.swift +0 -224
  143. package/apps/mac/Sources/Core/System/ProcessModel.swift +0 -199
  144. package/apps/mac/Sources/Core/System/ProcessQuery.swift +0 -151
  145. package/apps/mac/Sources/Core/System/SystemTelemetryMonitor.swift +0 -273
  146. package/apps/mac/Sources/Core/Voice/AdvisorLearningStore.swift +0 -90
  147. package/apps/mac/Sources/Core/Voice/AgentSession.swift +0 -377
  148. package/apps/mac/Sources/Core/Voice/AudioProvider.swift +0 -555
  149. package/apps/mac/Sources/Core/Voice/HandsOffSession.swift +0 -839
  150. package/apps/mac/Sources/Core/Voice/VoiceChatView.swift +0 -192
  151. package/apps/mac/Sources/Core/Voice/VoxClient.swift +0 -454
  152. package/apps/mac/Sources/Core/Workspace/Project.swift +0 -28
  153. package/apps/mac/Sources/Core/Workspace/ProjectScanner.swift +0 -141
  154. package/apps/mac/Sources/Core/Workspace/SessionLayerStore.swift +0 -285
  155. package/apps/mac/Sources/Core/Workspace/SessionManager.swift +0 -75
  156. package/apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift +0 -259
  157. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalQuery.swift +0 -156
  158. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalSynthesizer.swift +0 -200
  159. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxModel.swift +0 -60
  160. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxQuery.swift +0 -105
  161. package/apps/mac/Sources/Core/Workspace/WorkspaceManager.swift +0 -1027
  162. package/apps/mac/Sources/UI/ActionRow.swift +0 -78
  163. package/apps/mac/Sources/UI/OrphanRow.swift +0 -129
  164. package/apps/mac/Sources/UI/ProjectRow.swift +0 -368
  165. package/apps/mac/Sources/UI/TabGroupRow.swift +0 -178
  166. package/apps/mac/Sources/UI/Theme.swift +0 -164
  167. package/apps/mac/Tests/StageDragTests.swift +0 -333
  168. package/apps/mac/Tests/StageJoinTests.swift +0 -313
  169. package/apps/mac/Tests/StageManagerTests.swift +0 -280
  170. package/apps/mac/Tests/StageTileTests.swift +0 -353
  171. package/swift/Package.swift +0 -20
  172. package/swift/Sources/DeckKit/DeckAction.swift +0 -51
  173. package/swift/Sources/DeckKit/DeckBridgeSecurity.swift +0 -152
  174. package/swift/Sources/DeckKit/DeckCockpit.swift +0 -82
  175. package/swift/Sources/DeckKit/DeckHost.swift +0 -7
  176. package/swift/Sources/DeckKit/DeckManifest.swift +0 -145
  177. package/swift/Sources/DeckKit/DeckRuntimeSnapshot.swift +0 -533
  178. package/swift/Sources/DeckKit/DeckTrackpad.swift +0 -63
  179. package/swift/Sources/DeckKit/DeckValue.swift +0 -93
  180. package/swift/Sources/DeckKit/DeckVoiceError.swift +0 -88
  181. package/swift/Tests/DeckKitTests/DeckKitTests.swift +0 -286
@@ -1,78 +0,0 @@
1
- import SwiftUI
2
-
3
- /// A single action row with shortcut badge, label, optional icon, and hotkey hint.
4
- struct ActionRow: View {
5
- let label: String
6
- var detail: String? = nil
7
- var hotkeyTokens: [String] = []
8
- var icon: String? = nil
9
- var accentColor: Color = Palette.textDim
10
- var action: () -> Void
11
-
12
- @State private var isHovered = false
13
-
14
- var body: some View {
15
- Button(action: action) {
16
- HStack(spacing: 10) {
17
- // Icon
18
- if let icon {
19
- ZStack {
20
- RoundedRectangle(cornerRadius: 5)
21
- .fill(accentColor.opacity(isHovered ? 0.18 : 0.12))
22
- Image(systemName: icon)
23
- .font(.system(size: 11, weight: .medium))
24
- .foregroundColor(isHovered ? Palette.text : accentColor)
25
- }
26
- .frame(width: 22, height: 22)
27
- }
28
-
29
- // Label
30
- VStack(alignment: .leading, spacing: detail == nil ? 0 : 2) {
31
- Text(label)
32
- .font(Typo.body(12))
33
- .foregroundColor(isHovered ? Palette.text : Palette.textDim)
34
- .lineLimit(1)
35
-
36
- if let detail {
37
- Text(detail)
38
- .font(Typo.mono(9))
39
- .foregroundColor(Palette.textMuted)
40
- .lineLimit(1)
41
- }
42
- }
43
-
44
- Spacer()
45
-
46
- // Hotkey
47
- if !hotkeyTokens.isEmpty {
48
- HStack(spacing: 4) {
49
- ForEach(hotkeyTokens, id: \.self) { token in
50
- Text(token)
51
- .font(Typo.monoBold(8))
52
- .foregroundColor(Palette.textMuted)
53
- .padding(.horizontal, token.count > 3 ? 6 : 5)
54
- .padding(.vertical, 3)
55
- .background(
56
- RoundedRectangle(cornerRadius: 4)
57
- .fill(Palette.surface)
58
- .overlay(
59
- RoundedRectangle(cornerRadius: 4)
60
- .strokeBorder(Palette.border, lineWidth: 0.5)
61
- )
62
- )
63
- }
64
- }
65
- }
66
- }
67
- .padding(.horizontal, 12)
68
- .padding(.vertical, 8)
69
- .background(
70
- RoundedRectangle(cornerRadius: 5)
71
- .fill(isHovered ? Palette.surfaceHov : Color.clear)
72
- )
73
- .contentShape(Rectangle())
74
- }
75
- .buttonStyle(.plain)
76
- .onHover { isHovered = $0 }
77
- }
78
- }
@@ -1,129 +0,0 @@
1
- import SwiftUI
2
-
3
- struct OrphanRow: View {
4
- let session: TmuxSession
5
- var onAttach: () -> Void
6
- var onKill: () -> Void
7
-
8
- @State private var isHovered = false
9
- @State private var isExpanded = false
10
-
11
- private var commandSummary: String {
12
- let commands = session.panes
13
- .map(\.currentCommand)
14
- .filter { !$0.isEmpty }
15
- let unique = commands.count <= 3 ? commands : Array(commands.prefix(3)) + ["..."]
16
- return "\(session.panes.count) pane\(session.panes.count == 1 ? "" : "s") \u{2014} \(unique.joined(separator: ", "))"
17
- }
18
-
19
- var body: some View {
20
- VStack(spacing: 0) {
21
- // Header row
22
- HStack(spacing: 10) {
23
- // Status bar — amber for orphan
24
- RoundedRectangle(cornerRadius: 1)
25
- .fill(Palette.detach)
26
- .frame(width: 3, height: 32)
27
-
28
- // Expand chevron
29
- Button {
30
- withAnimation(.easeOut(duration: 0.15)) { isExpanded.toggle() }
31
- } label: {
32
- Image(systemName: isExpanded ? "chevron.down" : "chevron.right")
33
- .font(.system(size: 9, weight: .semibold))
34
- .foregroundColor(Palette.textMuted)
35
- .frame(width: 14)
36
- }
37
- .buttonStyle(.plain)
38
-
39
- // Info
40
- VStack(alignment: .leading, spacing: 3) {
41
- HStack(spacing: 6) {
42
- Text(session.name)
43
- .font(Typo.heading(13))
44
- .foregroundColor(Palette.text)
45
- .lineLimit(1)
46
-
47
- if session.attached {
48
- Text("attached")
49
- .font(Typo.mono(9))
50
- .foregroundColor(Palette.detach)
51
- .padding(.horizontal, 5)
52
- .padding(.vertical, 1)
53
- .background(
54
- RoundedRectangle(cornerRadius: 3)
55
- .fill(Palette.detach.opacity(0.12))
56
- )
57
- }
58
- }
59
-
60
- Text(commandSummary)
61
- .font(Typo.mono(10))
62
- .foregroundColor(Palette.textMuted)
63
- .lineLimit(1)
64
- }
65
-
66
- Spacer()
67
-
68
- // Actions
69
- HStack(spacing: 4) {
70
- Button(action: onKill) {
71
- Text("Kill")
72
- .angularButton(Palette.kill, filled: false)
73
- }
74
- .buttonStyle(.plain)
75
-
76
- Button(action: onAttach) {
77
- Text("Attach")
78
- .angularButton(Palette.running)
79
- }
80
- .buttonStyle(.plain)
81
- }
82
- }
83
- .padding(.horizontal, 10)
84
- .padding(.vertical, 8)
85
- .glassCard(hovered: isHovered)
86
-
87
- // Expanded pane list
88
- if isExpanded {
89
- VStack(spacing: 2) {
90
- ForEach(session.panes) { pane in
91
- paneRow(pane)
92
- }
93
- }
94
- .padding(.leading, 36)
95
- .padding(.trailing, 10)
96
- .padding(.vertical, 4)
97
- .transition(.opacity.combined(with: .move(edge: .top)))
98
- }
99
- }
100
- .contentShape(Rectangle())
101
- .onHover { isHovered = $0 }
102
- .contextMenu {
103
- Button("Attach") { onAttach() }
104
- Divider()
105
- Button("Kill Session") { onKill() }
106
- }
107
- }
108
-
109
- private func paneRow(_ pane: TmuxPane) -> some View {
110
- HStack(spacing: 8) {
111
- Circle()
112
- .fill(pane.isActive ? Palette.detach.opacity(0.7) : Palette.textMuted)
113
- .frame(width: 5, height: 5)
114
-
115
- Text(pane.title.isEmpty ? pane.currentCommand : pane.title)
116
- .font(Typo.mono(11))
117
- .foregroundColor(Palette.text)
118
- .lineLimit(1)
119
-
120
- Spacer()
121
-
122
- Text(pane.currentCommand)
123
- .font(Typo.mono(9))
124
- .foregroundColor(Palette.textDim)
125
- }
126
- .padding(.horizontal, 8)
127
- .padding(.vertical, 4)
128
- }
129
- }
@@ -1,368 +0,0 @@
1
- import SwiftUI
2
-
3
- struct ProjectRow: View {
4
- let project: Project
5
- let onLaunch: () -> Void
6
- let onDetach: () -> Void
7
- let onKill: () -> Void
8
- let onSync: () -> Void
9
- let onRestart: (String?) -> Void
10
-
11
- @State private var isHovered = false
12
- @State private var showCoach = false
13
- @State private var showTilePicker = false
14
- @State private var contextSpaces: [SpaceInfo] = []
15
- @State private var windowInfo: WindowTiler.WindowInfo?
16
-
17
- var body: some View {
18
- VStack(spacing: 0) {
19
- HStack(spacing: 10) {
20
- // Status bar
21
- RoundedRectangle(cornerRadius: 1)
22
- .fill(project.isRunning ? Palette.running : Palette.border)
23
- .frame(width: 3, height: 32)
24
-
25
- // Info — tap to highlight window
26
- VStack(alignment: .leading, spacing: 3) {
27
- Text(project.name)
28
- .font(Typo.heading(13))
29
- .foregroundColor(Palette.text)
30
- .lineLimit(1)
31
-
32
- HStack(spacing: 6) {
33
- if !project.paneSummary.isEmpty {
34
- Text(project.paneSummary)
35
- .font(Typo.mono(10))
36
- .foregroundColor(Palette.textMuted)
37
- .lineLimit(1)
38
- } else if let cmd = project.devCommand {
39
- Text(cmd)
40
- .font(Typo.mono(10))
41
- .foregroundColor(Palette.textMuted)
42
- .lineLimit(1)
43
- }
44
-
45
- if project.isRunning, let info = windowInfo {
46
- Spacer(minLength: 4)
47
- locationBadge(info)
48
- }
49
- }
50
- }
51
- .contentShape(Rectangle())
52
- .onTapGesture {
53
- if project.isRunning {
54
- WindowTiler.highlightWindow(session: project.sessionName)
55
- }
56
- }
57
-
58
- Spacer()
59
-
60
- // Actions
61
- HStack(spacing: 4) {
62
- if project.isRunning {
63
- Button(action: {
64
- withAnimation(.easeOut(duration: 0.15)) { showTilePicker.toggle() }
65
- if !showTilePicker {
66
- // Picker just opened — highlight the window
67
- WindowTiler.highlightWindow(session: project.sessionName)
68
- } else {
69
- WindowHighlight.shared.dismiss()
70
- }
71
- }) {
72
- Image(systemName: "rectangle.split.2x1")
73
- .font(.system(size: 10))
74
- .angularButton(Palette.textDim, filled: false)
75
- }
76
- .buttonStyle(.plain)
77
-
78
- Button(action: { handleDetach() }) {
79
- Text("Detach")
80
- .angularButton(Palette.detach, filled: false)
81
- }
82
- .buttonStyle(.plain)
83
- }
84
-
85
- Button(action: onLaunch) {
86
- Text(project.isRunning ? "Attach" : "Launch")
87
- .angularButton(project.isRunning ? Palette.running : Palette.launch)
88
- }
89
- .buttonStyle(.plain)
90
- }
91
- }
92
- .padding(.horizontal, 10)
93
- .padding(.vertical, 8)
94
- .glassCard(hovered: isHovered)
95
-
96
- // Coach card
97
- if showCoach {
98
- CoachView {
99
- withAnimation(.easeOut(duration: 0.15)) { showCoach = false }
100
- }
101
- .transition(.opacity.combined(with: .move(edge: .top)))
102
- .padding(.top, 4)
103
- }
104
-
105
- // Tile picker
106
- if showTilePicker {
107
- TilePickerView(
108
- sessionName: project.sessionName,
109
- terminal: Preferences.shared.terminal,
110
- onSelect: { position in
111
- WindowHighlight.shared.dismiss()
112
- WindowTiler.tile(
113
- session: project.sessionName,
114
- terminal: Preferences.shared.terminal,
115
- to: position
116
- )
117
- withAnimation(.easeOut(duration: 0.15)) { showTilePicker = false }
118
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { refreshWindowInfo() }
119
- },
120
- onGoToSpace: { spaceId in
121
- WindowHighlight.shared.dismiss()
122
- let result = WindowTiler.moveWindowToSpace(
123
- session: project.sessionName,
124
- terminal: Preferences.shared.terminal,
125
- spaceId: spaceId
126
- )
127
- if case .success = result {
128
- WindowTiler.switchToSpace(spaceId: spaceId)
129
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
130
- WindowTiler.highlightWindow(session: project.sessionName)
131
- }
132
- } else if case .alreadyOnSpace = result {
133
- WindowTiler.switchToSpace(spaceId: spaceId)
134
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
135
- WindowTiler.highlightWindow(session: project.sessionName)
136
- }
137
- }
138
- withAnimation(.easeOut(duration: 0.15)) { showTilePicker = false }
139
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { refreshWindowInfo() }
140
- },
141
- onDismiss: {
142
- WindowHighlight.shared.dismiss()
143
- withAnimation(.easeOut(duration: 0.15)) { showTilePicker = false }
144
- }
145
- )
146
- .transition(.opacity.combined(with: .move(edge: .top)))
147
- .padding(.top, 4)
148
- }
149
- }
150
- .contentShape(Rectangle())
151
- .onHover { isHovered = $0 }
152
- .onAppear {
153
- if project.isRunning {
154
- contextSpaces = WindowTiler.getDisplaySpaces().flatMap(\.spaces)
155
- refreshWindowInfo()
156
- }
157
- }
158
- .contextMenu {
159
- if project.isRunning {
160
- Button("Attach") { onLaunch() }
161
- Button {
162
- WindowTiler.navigateToWindow(
163
- session: project.sessionName,
164
- terminal: Preferences.shared.terminal
165
- )
166
- } label: {
167
- Label("Go to Window", systemImage: "macwindow")
168
- }
169
- Button("Detach") { onDetach() }
170
- Menu("Tile Window") {
171
- ForEach(TilePosition.allCases) { tile in
172
- Button {
173
- WindowTiler.tile(
174
- session: project.sessionName,
175
- terminal: Preferences.shared.terminal,
176
- to: tile
177
- )
178
- } label: {
179
- Label(tile.label, systemImage: tile.icon)
180
- }
181
- }
182
- }
183
- if !contextSpaces.isEmpty {
184
- Menu("Go to Space") {
185
- ForEach(contextSpaces) { space in
186
- Button {
187
- let result = WindowTiler.moveWindowToSpace(
188
- session: project.sessionName,
189
- terminal: Preferences.shared.terminal,
190
- spaceId: space.id
191
- )
192
- if case .success = result {
193
- WindowTiler.switchToSpace(spaceId: space.id)
194
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
195
- WindowTiler.highlightWindow(session: project.sessionName)
196
- }
197
- }
198
- } label: {
199
- Label(
200
- "Space \(space.index)\(space.isCurrent ? " (current)" : "")",
201
- systemImage: space.isCurrent ? "desktopcomputer" : "rectangle.on.rectangle"
202
- )
203
- }
204
- }
205
- }
206
- }
207
- Divider()
208
- Button("Sync Session") { onSync() }
209
- Menu("Restart Pane") {
210
- ForEach(project.paneNames, id: \.self) { name in
211
- Button(name) { onRestart(name) }
212
- }
213
- }
214
- Divider()
215
- Button("Kill Session") { onKill() }
216
- } else {
217
- Button("Launch") { onLaunch() }
218
- }
219
- }
220
- }
221
-
222
- // MARK: - Location Badge
223
-
224
- @ViewBuilder
225
- private func locationBadge(_ info: WindowTiler.WindowInfo) -> some View {
226
- HStack(spacing: 3) {
227
- // Multi-display prefix
228
- if NSScreen.screens.count > 1 && info.displayIndex > 0 {
229
- Text("D\(info.displayIndex + 1)")
230
- .font(Typo.mono(9))
231
- .foregroundColor(Palette.textMuted)
232
- Text("\u{00B7}")
233
- .font(Typo.mono(9))
234
- .foregroundColor(Palette.textMuted)
235
- }
236
-
237
- // Space number
238
- Text(circledDigit(info.spaceIndex))
239
- .font(.system(size: 10))
240
- .foregroundColor(Palette.textDim)
241
-
242
- // Tile position icon
243
- if let tile = info.tilePosition {
244
- Image(systemName: tile.icon)
245
- .font(.system(size: 9))
246
- .foregroundColor(Palette.textMuted)
247
- }
248
- }
249
- .padding(.horizontal, 5)
250
- .padding(.vertical, 2)
251
- .background(
252
- RoundedRectangle(cornerRadius: 4)
253
- .fill(Palette.surface.opacity(0.6))
254
- )
255
- .contentShape(Rectangle())
256
- .onTapGesture {
257
- WindowTiler.navigateToWindow(
258
- session: project.sessionName,
259
- terminal: Preferences.shared.terminal
260
- )
261
- }
262
- }
263
-
264
- private func circledDigit(_ n: Int) -> String {
265
- let digits = ["\u{2776}","\u{2777}","\u{2778}","\u{2779}","\u{277A}","\u{277B}","\u{277C}","\u{277D}","\u{277E}"]
266
- return n >= 1 && n <= 9 ? digits[n - 1] : "S\(n)"
267
- }
268
-
269
- private func refreshWindowInfo() {
270
- guard project.isRunning else { windowInfo = nil; return }
271
- DispatchQueue.global(qos: .userInitiated).async {
272
- let info = WindowTiler.getWindowInfo(
273
- session: project.sessionName,
274
- terminal: Preferences.shared.terminal
275
- )
276
- DispatchQueue.main.async { windowInfo = info }
277
- }
278
- }
279
-
280
- private func handleDetach() {
281
- if Preferences.shared.mode == .learning {
282
- withAnimation(.easeOut(duration: 0.15)) { showCoach.toggle() }
283
- } else {
284
- onDetach()
285
- }
286
- }
287
- }
288
-
289
- // MARK: - Coach view
290
-
291
- struct CoachView: View {
292
- let onDismiss: () -> Void
293
-
294
- var body: some View {
295
- VStack(alignment: .leading, spacing: 10) {
296
- HStack {
297
- Text("TMUX SHORTCUTS")
298
- .font(Typo.pixel(12))
299
- .foregroundColor(Palette.running)
300
- Spacer()
301
- Button(action: onDismiss) {
302
- Image(systemName: "xmark")
303
- .font(.system(size: 8, weight: .bold))
304
- .foregroundColor(Palette.textDim)
305
- .frame(width: 18, height: 18)
306
- .background(
307
- RoundedRectangle(cornerRadius: 3)
308
- .fill(Palette.surface)
309
- )
310
- }
311
- .buttonStyle(.plain)
312
- }
313
-
314
- VStack(spacing: 6) {
315
- KeyCombo(keys: ["Ctrl+B", "D"], label: "Detach", color: Palette.detach)
316
- KeyCombo(keys: ["Ctrl+B", "X"], label: "Kill pane", color: Palette.kill)
317
- KeyCombo(keys: ["Ctrl+B", "\u{2190}\u{2192}"], label: "Switch pane", color: Palette.text)
318
- }
319
-
320
- Text("Session stays alive after detaching")
321
- .font(Typo.caption(10))
322
- .foregroundColor(Palette.textMuted)
323
- }
324
- .padding(12)
325
- .background(
326
- RoundedRectangle(cornerRadius: 6)
327
- .fill(Palette.surface)
328
- .overlay(
329
- RoundedRectangle(cornerRadius: 6)
330
- .strokeBorder(Palette.borderLit, lineWidth: 0.5)
331
- )
332
- )
333
- }
334
- }
335
-
336
- struct KeyCombo: View {
337
- let keys: [String]
338
- let label: String
339
- var color: Color = .secondary
340
-
341
- var body: some View {
342
- HStack(spacing: 6) {
343
- HStack(spacing: 3) {
344
- ForEach(keys, id: \.self) { key in
345
- Text(key)
346
- .font(Typo.geistMonoBold(10))
347
- .foregroundColor(Palette.text)
348
- .padding(.horizontal, 6)
349
- .padding(.vertical, 3)
350
- .background(
351
- RoundedRectangle(cornerRadius: 3)
352
- .fill(Palette.bg)
353
- .overlay(
354
- RoundedRectangle(cornerRadius: 3)
355
- .strokeBorder(Palette.border, lineWidth: 0.5)
356
- )
357
- )
358
- }
359
- }
360
-
361
- Text(label)
362
- .font(Typo.caption(11))
363
- .foregroundColor(color)
364
-
365
- Spacer()
366
- }
367
- }
368
- }