@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,334 +0,0 @@
1
- import AppKit
2
- import SwiftUI
3
-
4
- // MARK: - LauncherHUD (singleton window controller)
5
-
6
- final class LauncherHUD {
7
- static let shared = LauncherHUD()
8
-
9
- private var panel: NSPanel?
10
- private var localMonitor: Any?
11
- private var globalMonitor: Any?
12
-
13
- var isVisible: Bool { panel?.isVisible ?? false }
14
-
15
- func toggle() {
16
- if isVisible { dismiss() } else { show() }
17
- }
18
-
19
- func show() {
20
- guard panel == nil else { return }
21
-
22
- // Ensure projects are fresh
23
- ProjectScanner.shared.scan()
24
-
25
- let view = LauncherView(dismiss: { [weak self] in self?.dismiss() })
26
- .preferredColorScheme(.dark)
27
-
28
- let p = OverlayPanelShell.makePanel(
29
- config: .init(
30
- size: NSSize(width: 420, height: 480),
31
- styleMask: [.borderless, .nonactivatingPanel],
32
- background: .clear,
33
- hidesOnDeactivate: false,
34
- isMovableByWindowBackground: false
35
- ),
36
- rootView: view
37
- )
38
- OverlayPanelShell.position(p, placement: .mouseScreenCentered(yOffsetRatio: 0.08))
39
-
40
- p.alphaValue = 0
41
- OverlayPanelShell.present(p, activate: false, makeKey: false, orderFrontRegardless: true)
42
-
43
- NSAnimationContext.runAnimationGroup { ctx in
44
- ctx.duration = 0.12
45
- p.animator().alphaValue = 1.0
46
- }
47
-
48
- self.panel = p
49
- installMonitors()
50
- }
51
-
52
- func dismiss() {
53
- guard let p = panel else { return }
54
- removeMonitors()
55
-
56
- NSAnimationContext.runAnimationGroup({ ctx in
57
- ctx.duration = 0.15
58
- p.animator().alphaValue = 0
59
- }) { [weak self] in
60
- p.orderOut(nil)
61
- self?.panel = nil
62
- }
63
- }
64
-
65
- // MARK: - Event monitors
66
-
67
- private func installMonitors() {
68
- localMonitor = NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { [weak self] event in
69
- if event.keyCode == 53 { // Escape
70
- self?.dismiss()
71
- }
72
- }
73
- globalMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self] event in
74
- // Don't dismiss if clicking inside the panel
75
- guard let panel = self?.panel else { return }
76
- if !panel.frame.contains(NSEvent.mouseLocation) {
77
- self?.dismiss()
78
- }
79
- }
80
- }
81
-
82
- private func removeMonitors() {
83
- if let m = localMonitor { NSEvent.removeMonitor(m); localMonitor = nil }
84
- if let m = globalMonitor { NSEvent.removeMonitor(m); globalMonitor = nil }
85
- }
86
- }
87
-
88
- // MARK: - LauncherView
89
-
90
- struct LauncherView: View {
91
- var dismiss: () -> Void
92
-
93
- @ObservedObject private var scanner = ProjectScanner.shared
94
- @ObservedObject private var tmux = TmuxModel.shared
95
- @State private var query = ""
96
- @State private var selectedIndex = 0
97
- @State private var hoveredId: String?
98
-
99
- private var filtered: [Project] {
100
- if query.isEmpty { return scanner.projects }
101
- let q = query.lowercased()
102
- return scanner.projects.filter {
103
- $0.name.lowercased().contains(q) ||
104
- $0.paneSummary.lowercased().contains(q)
105
- }
106
- }
107
-
108
- var body: some View {
109
- VStack(spacing: 0) {
110
- // Search bar
111
- HStack(spacing: 10) {
112
- Image(systemName: "magnifyingglass")
113
- .font(.system(size: 13))
114
- .foregroundColor(Palette.textMuted)
115
-
116
- ZStack(alignment: .leading) {
117
- if query.isEmpty {
118
- Text("Launch a project...")
119
- .font(Typo.mono(13))
120
- .foregroundColor(Palette.textMuted)
121
- }
122
- TextField("", text: $query)
123
- .font(Typo.mono(13))
124
- .foregroundColor(Palette.text)
125
- .textFieldStyle(.plain)
126
- .onSubmit { launchSelected() }
127
- }
128
-
129
- if !query.isEmpty {
130
- Button {
131
- query = ""
132
- selectedIndex = 0
133
- } label: {
134
- Image(systemName: "xmark.circle.fill")
135
- .font(.system(size: 12))
136
- .foregroundColor(Palette.textMuted)
137
- }
138
- .buttonStyle(.plain)
139
- }
140
- }
141
- .padding(.horizontal, 16)
142
- .padding(.vertical, 12)
143
-
144
- Rectangle().fill(Palette.border).frame(height: 0.5)
145
-
146
- // Project list
147
- if filtered.isEmpty {
148
- Spacer()
149
- VStack(spacing: 8) {
150
- Image(systemName: "folder.badge.questionmark")
151
- .font(.system(size: 24))
152
- .foregroundColor(Palette.textMuted)
153
- Text(scanner.projects.isEmpty ? "No projects found" : "No matches")
154
- .font(Typo.mono(12))
155
- .foregroundColor(Palette.textMuted)
156
- if scanner.projects.isEmpty {
157
- Text("Add .lattices.json to your projects")
158
- .font(Typo.mono(10))
159
- .foregroundColor(Palette.textMuted.opacity(0.6))
160
- }
161
- }
162
- Spacer()
163
- } else {
164
- ScrollViewReader { proxy in
165
- ScrollView {
166
- LazyVStack(spacing: 2) {
167
- ForEach(Array(filtered.enumerated()), id: \.element.id) { index, project in
168
- projectRow(project, index: index)
169
- .id(project.id)
170
- }
171
- }
172
- .padding(.vertical, 6)
173
- .padding(.horizontal, 8)
174
- }
175
- .onChange(of: selectedIndex) { newVal in
176
- if let project = filtered[safe: newVal] {
177
- proxy.scrollTo(project.id, anchor: .center)
178
- }
179
- }
180
- }
181
- }
182
-
183
- Rectangle().fill(Palette.border).frame(height: 0.5)
184
-
185
- // Footer
186
- HStack(spacing: 16) {
187
- HStack(spacing: 4) {
188
- keyBadge("↑↓")
189
- Text("Navigate")
190
- .font(Typo.mono(10))
191
- .foregroundColor(Palette.textMuted)
192
- }
193
- HStack(spacing: 4) {
194
- keyBadge("↵")
195
- Text("Launch")
196
- .font(Typo.mono(10))
197
- .foregroundColor(Palette.textMuted)
198
- }
199
- HStack(spacing: 4) {
200
- keyBadge("ESC")
201
- Text("Close")
202
- .font(Typo.mono(10))
203
- .foregroundColor(Palette.textMuted)
204
- }
205
- Spacer()
206
- Text("\(filtered.count) project\(filtered.count == 1 ? "" : "s")")
207
- .font(Typo.mono(10))
208
- .foregroundColor(Palette.textMuted)
209
- }
210
- .padding(.horizontal, 16)
211
- .padding(.vertical, 8)
212
- }
213
- .frame(width: 420, height: 480)
214
- .background(
215
- RoundedRectangle(cornerRadius: 12)
216
- .fill(Palette.bg)
217
- .overlay(
218
- RoundedRectangle(cornerRadius: 12)
219
- .strokeBorder(Palette.borderLit, lineWidth: 0.5)
220
- )
221
- )
222
- .clipShape(RoundedRectangle(cornerRadius: 12))
223
- .onChange(of: query) { _ in selectedIndex = 0 }
224
- }
225
-
226
- // MARK: - Project row
227
-
228
- private func projectRow(_ project: Project, index: Int) -> some View {
229
- let isSelected = index == selectedIndex
230
- let isHovered = hoveredId == project.id
231
-
232
- return Button {
233
- launch(project)
234
- } label: {
235
- HStack(spacing: 10) {
236
- // Status dot
237
- Circle()
238
- .fill(project.isRunning ? Palette.running : Palette.textMuted.opacity(0.3))
239
- .frame(width: 7, height: 7)
240
-
241
- // Name + pane info
242
- VStack(alignment: .leading, spacing: 2) {
243
- Text(project.name)
244
- .font(Typo.monoBold(12))
245
- .foregroundColor(Palette.text)
246
- .lineLimit(1)
247
-
248
- HStack(spacing: 6) {
249
- if !project.paneSummary.isEmpty {
250
- let summary = project.paneSummary
251
- Text(summary)
252
- .font(Typo.mono(10))
253
- .foregroundColor(Palette.textDim)
254
- .lineLimit(1)
255
- }
256
- }
257
- }
258
-
259
- Spacer()
260
-
261
- // Status badge
262
- if project.isRunning {
263
- Text("running")
264
- .font(Typo.mono(9))
265
- .foregroundColor(Palette.running)
266
- .padding(.horizontal, 6)
267
- .padding(.vertical, 2)
268
- .background(
269
- RoundedRectangle(cornerRadius: 3)
270
- .fill(Palette.running.opacity(0.10))
271
- )
272
- } else {
273
- Image(systemName: "play.fill")
274
- .font(.system(size: 9))
275
- .foregroundColor(isSelected || isHovered ? Palette.text : Palette.textMuted)
276
- }
277
- }
278
- .padding(.horizontal, 10)
279
- .padding(.vertical, 8)
280
- .background(
281
- RoundedRectangle(cornerRadius: 6)
282
- .fill(isSelected ? Palette.surfaceHov : (isHovered ? Palette.surface : Color.clear))
283
- .overlay(
284
- RoundedRectangle(cornerRadius: 6)
285
- .strokeBorder(isSelected ? Palette.borderLit : Color.clear, lineWidth: 0.5)
286
- )
287
- )
288
- }
289
- .buttonStyle(.plain)
290
- .onHover { over in hoveredId = over ? project.id : nil }
291
- }
292
-
293
- // MARK: - Actions
294
-
295
- private func moveSelection(_ delta: Int) {
296
- let count = filtered.count
297
- guard count > 0 else { return }
298
- selectedIndex = (selectedIndex + delta + count) % count
299
- }
300
-
301
- private func launchSelected() {
302
- guard let project = filtered[safe: selectedIndex] else { return }
303
- launch(project)
304
- }
305
-
306
- private func launch(_ project: Project) {
307
- SessionManager.launch(project: project)
308
- dismiss()
309
- }
310
-
311
- private func keyBadge(_ key: String) -> some View {
312
- Text(key)
313
- .font(Typo.geistMonoBold(9))
314
- .foregroundColor(Palette.text)
315
- .padding(.horizontal, 5)
316
- .padding(.vertical, 2)
317
- .background(
318
- RoundedRectangle(cornerRadius: 3)
319
- .fill(Palette.surface)
320
- .overlay(
321
- RoundedRectangle(cornerRadius: 3)
322
- .strokeBorder(Palette.border, lineWidth: 0.5)
323
- )
324
- )
325
- }
326
- }
327
-
328
- // MARK: - Safe array subscript
329
-
330
- private extension Array {
331
- subscript(safe index: Int) -> Element? {
332
- indices.contains(index) ? self[index] : nil
333
- }
334
- }
@@ -1,203 +0,0 @@
1
- import AppKit
2
- import SwiftUI
3
-
4
- // MARK: - Layer Switch HUD
5
-
6
- /// A notch-style pill that briefly shows the active layer name when switching.
7
- final class LayerBezel {
8
- static let shared = LayerBezel()
9
-
10
- private var panel: NSPanel?
11
- private var dismissTimer: Timer?
12
- /// Cached pill width per layer count — stable once computed for a workspace
13
- private var cachedWidth: CGFloat?
14
- private var cachedLayerSignature: String?
15
-
16
- /// Show the layer bezel for a given layer label and index.
17
- func show(label: String, index: Int, total: Int, allLabels: [String]) {
18
- dismissTimer?.invalidate()
19
-
20
- guard let screen = NSScreen.main ?? NSScreen.screens.first else { return }
21
- let screenFrame = screen.frame
22
-
23
- let pillWidth = stableWidth(for: allLabels, total: total)
24
- let pillHeight: CGFloat = 64
25
-
26
- // Position: centered on screen, upper third
27
- let x = screenFrame.origin.x + (screenFrame.width - pillWidth) / 2
28
- let y = screenFrame.origin.y + screenFrame.height * 0.65
29
-
30
- let pillFrame = NSRect(x: x, y: y, width: pillWidth, height: pillHeight)
31
-
32
- let view = LayerBezelView(label: label, index: index, total: total)
33
- let hostingView = NSHostingView(rootView: view)
34
-
35
- if panel == nil {
36
- let p = NSPanel(
37
- contentRect: pillFrame,
38
- styleMask: [.borderless, .nonactivatingPanel],
39
- backing: .buffered,
40
- defer: false
41
- )
42
- p.isOpaque = false
43
- p.backgroundColor = .clear
44
- p.level = .statusBar
45
- p.hasShadow = false
46
- p.hidesOnDeactivate = false
47
- p.isReleasedWhenClosed = false
48
- p.isMovable = false
49
- p.collectionBehavior = [.canJoinAllSpaces, .stationary, .fullScreenAuxiliary]
50
- p.ignoresMouseEvents = true
51
- panel = p
52
- }
53
-
54
- guard let p = panel else { return }
55
-
56
- p.contentView = hostingView
57
- p.setFrame(pillFrame, display: false)
58
- p.alphaValue = 0
59
- p.orderFrontRegardless()
60
-
61
- NSAnimationContext.runAnimationGroup { ctx in
62
- ctx.duration = 0.15
63
- p.animator().alphaValue = 1.0
64
- }
65
-
66
- dismissTimer = Timer.scheduledTimer(withTimeInterval: 1.5, repeats: false) { [weak self] _ in
67
- self?.dismiss()
68
- }
69
- }
70
-
71
- func dismiss() {
72
- guard let p = panel, p.isVisible else { return }
73
- NSAnimationContext.runAnimationGroup({ ctx in
74
- ctx.duration = 0.3
75
- p.animator().alphaValue = 0
76
- }, completionHandler: {
77
- p.orderOut(nil)
78
- })
79
- }
80
-
81
- /// Invalidate cached width (call when workspace config changes)
82
- func invalidateCache() {
83
- cachedWidth = nil
84
- cachedLayerSignature = nil
85
- }
86
-
87
- // MARK: - Width Heuristics
88
-
89
- /// Compute a stable pill width based on the longest layer label.
90
- /// Cached so the pill never resizes between switches within the same workspace.
91
- private func stableWidth(for allLabels: [String], total: Int) -> CGFloat {
92
- let signature = allLabels.joined(separator: "|") + ":\(total)"
93
- if let cached = cachedWidth, cachedLayerSignature == signature {
94
- return cached
95
- }
96
-
97
- // Measure the widest label using the actual font
98
- let font = NSFont(name: "NewYork-RegularItalic", size: 24)
99
- ?? NSFont.systemFont(ofSize: 24, weight: .medium)
100
- let attrs: [NSAttributedString.Key: Any] = [.font: font]
101
-
102
- var maxTextWidth: CGFloat = 0
103
- for label in allLabels {
104
- let size = (label as NSString).size(withAttributes: attrs)
105
- maxTextWidth = max(maxTextWidth, ceil(size.width))
106
- }
107
-
108
- // dots width: 7px per dot + 5px spacing
109
- let dotsWidth = CGFloat(total) * 7 + CGFloat(max(0, total - 1)) * 5
110
- // divider + spacing
111
- let dividerWidth: CGFloat = 1 + 14 * 2
112
- // horizontal padding
113
- let hPadding: CGFloat = 36 * 2
114
-
115
- let contentWidth = dotsWidth + dividerWidth + maxTextWidth + hPadding
116
-
117
- // Minimum 360, round up to nearest 20 for visual stability
118
- let rawWidth = max(360, contentWidth)
119
- let width = ceil(rawWidth / 20) * 20
120
-
121
- cachedWidth = width
122
- cachedLayerSignature = signature
123
- return width
124
- }
125
- }
126
-
127
- // MARK: - Bezel View
128
-
129
- struct LayerBezelView: View {
130
- let label: String
131
- let index: Int
132
- let total: Int
133
-
134
- private var layerFont: Font {
135
- // New York Italic — Apple's serif font
136
- if let descriptor = NSFontDescriptor(fontAttributes: [
137
- .family: "New York",
138
- .traits: [NSFontDescriptor.TraitKey.symbolic: NSFontDescriptor.SymbolicTraits.italic.rawValue]
139
- ]).withDesign(.serif) {
140
- return Font(NSFont(descriptor: descriptor, size: 24) ?? .systemFont(ofSize: 24))
141
- }
142
- return .system(size: 24, weight: .medium, design: .serif).italic()
143
- }
144
-
145
- var body: some View {
146
- HStack(spacing: 14) {
147
- // Layer index dots
148
- HStack(spacing: 5) {
149
- ForEach(0..<total, id: \.self) { i in
150
- Circle()
151
- .fill(i == index ? Color.white : Color.white.opacity(0.25))
152
- .frame(width: 7, height: 7)
153
- }
154
- }
155
-
156
- // Divider
157
- Rectangle()
158
- .fill(Color.white.opacity(0.15))
159
- .frame(width: 1, height: 20)
160
-
161
- // Layer name
162
- Text(label)
163
- .font(layerFont)
164
- .foregroundStyle(
165
- .linearGradient(
166
- colors: [.white, .white.opacity(0.85)],
167
- startPoint: .leading,
168
- endPoint: .trailing
169
- )
170
- )
171
- }
172
- .padding(.horizontal, 36)
173
- .padding(.vertical, 16)
174
- .frame(maxWidth: .infinity)
175
- .background(
176
- RoundedRectangle(cornerRadius: 28, style: .continuous)
177
- .fill(Color.black)
178
- )
179
- .overlay(
180
- RoundedRectangle(cornerRadius: 28, style: .continuous)
181
- .strokeBorder(
182
- .linearGradient(
183
- colors: [.white.opacity(0.9), .white.opacity(0.22)],
184
- startPoint: .top,
185
- endPoint: .bottom
186
- ),
187
- lineWidth: 0.5
188
- )
189
- )
190
- // Inner glow — top edge highlight
191
- .overlay(
192
- RoundedRectangle(cornerRadius: 28, style: .continuous)
193
- .fill(
194
- .linearGradient(
195
- colors: [.white.opacity(0.08), .clear],
196
- startPoint: .top,
197
- endPoint: .center
198
- )
199
- )
200
- .allowsHitTesting(false)
201
- )
202
- }
203
- }