@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,576 +0,0 @@
1
- import AppKit
2
- import SwiftUI
3
-
4
- // MARK: - CheatSheetHUD (singleton window controller)
5
-
6
- final class CheatSheetHUD {
7
- static let shared = CheatSheetHUD()
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 {
17
- dismiss()
18
- } else {
19
- show()
20
- }
21
- }
22
-
23
- func show() {
24
- guard panel == nil else { return }
25
-
26
- let view = CheatSheetView()
27
- .preferredColorScheme(.dark)
28
-
29
- let hosting = NSHostingView(rootView: view)
30
-
31
- let p = NSPanel(
32
- contentRect: NSRect(x: 0, y: 0, width: 520, height: 480),
33
- styleMask: [.borderless, .nonactivatingPanel],
34
- backing: .buffered,
35
- defer: false
36
- )
37
- p.isOpaque = false
38
- p.backgroundColor = .clear
39
- p.level = .floating
40
- p.hasShadow = true
41
- p.hidesOnDeactivate = false
42
- p.isReleasedWhenClosed = false
43
- p.isMovableByWindowBackground = false
44
- p.contentView = hosting
45
-
46
- // Center on the screen containing the mouse cursor
47
- let mouseLocation = NSEvent.mouseLocation
48
- let screen = NSScreen.screens.first(where: { $0.frame.contains(mouseLocation) }) ?? NSScreen.main ?? NSScreen.screens.first!
49
- let screenFrame = screen.visibleFrame
50
- let x = screenFrame.midX - 260
51
- let y = screenFrame.midY - 240
52
- p.setFrameOrigin(NSPoint(x: x, y: y))
53
-
54
- p.alphaValue = 0
55
- p.orderFrontRegardless()
56
-
57
- NSAnimationContext.runAnimationGroup { ctx in
58
- ctx.duration = 0.15
59
- p.animator().alphaValue = 1.0
60
- }
61
-
62
- self.panel = p
63
- installMonitors()
64
- }
65
-
66
- func dismiss() {
67
- guard let p = panel else { return }
68
- removeMonitors()
69
- TileZoneOverlay.shared.dismiss()
70
-
71
- NSAnimationContext.runAnimationGroup({ ctx in
72
- ctx.duration = 0.2
73
- p.animator().alphaValue = 0
74
- }) { [weak self] in
75
- p.orderOut(nil)
76
- self?.panel = nil
77
- }
78
- }
79
-
80
- // MARK: - Event monitors
81
-
82
- private func installMonitors() {
83
- // Key handling (global — panel is non-activating so keys go to frontmost app)
84
- localMonitor = NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { [weak self] event in
85
- if event.keyCode == 53 { // Escape
86
- self?.dismiss()
87
- } else if event.keyCode == 49 { // Space — toggle voice command
88
- let audio = AudioLayer.shared
89
- if audio.isListening {
90
- audio.stopVoiceCommand()
91
- } else {
92
- audio.startVoiceCommand()
93
- }
94
- }
95
- }
96
-
97
- // Click outside dismisses
98
- globalMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self] _ in
99
- self?.dismiss()
100
- }
101
- }
102
-
103
- private func removeMonitors() {
104
- if let m = localMonitor { NSEvent.removeMonitor(m); localMonitor = nil }
105
- if let m = globalMonitor { NSEvent.removeMonitor(m); globalMonitor = nil }
106
- }
107
-
108
- }
109
-
110
- // MARK: - CheatSheetView
111
-
112
- struct CheatSheetView: View {
113
- @ObservedObject private var hotkeyStore = HotkeyStore.shared
114
- @ObservedObject private var audioLayer = AudioLayer.shared
115
- @State private var hoveredAction: HotkeyAction?
116
-
117
- var body: some View {
118
- VStack(spacing: 0) {
119
- // Title
120
- HStack {
121
- Text("KEYBOARD SHORTCUTS")
122
- .font(Typo.pixel(14))
123
- .foregroundColor(Palette.textDim)
124
- .tracking(1)
125
- Spacer()
126
- }
127
- .padding(.horizontal, 20)
128
- .padding(.top, 16)
129
- .padding(.bottom, 10)
130
-
131
- Rectangle().fill(Palette.border).frame(height: 0.5)
132
-
133
- // Two-column body
134
- HStack(alignment: .top, spacing: 20) {
135
- // Left column: Tiling
136
- tilingColumn
137
-
138
- Rectangle().fill(Palette.border).frame(width: 0.5)
139
-
140
- // Right column: App + tmux
141
- VStack(alignment: .leading, spacing: 16) {
142
- appColumn
143
- Rectangle().fill(Palette.border).frame(height: 0.5)
144
- tmuxColumn
145
- }
146
- .frame(maxWidth: .infinity, alignment: .leading)
147
- }
148
- .padding(.horizontal, 20)
149
- .padding(.vertical, 14)
150
-
151
- Spacer(minLength: 0)
152
-
153
- // Voice feedback strip
154
- if audioLayer.isListening || audioLayer.lastTranscript != nil || audioLayer.executionResult != nil {
155
- Rectangle().fill(Palette.border).frame(height: 0.5)
156
- voiceFeedback
157
- }
158
-
159
- Rectangle().fill(Palette.border).frame(height: 0.5)
160
-
161
- // Footer
162
- HStack(spacing: 20) {
163
- Spacer()
164
- HStack(spacing: 6) {
165
- keyBadge("Space")
166
- Image(systemName: audioLayer.isListening ? "mic.fill" : "mic")
167
- .font(.system(size: 11))
168
- .foregroundColor(audioLayer.isListening ? Palette.running : Palette.text)
169
- Text(audioLayer.isListening ? "Listening..." : "Voice")
170
- .font(Typo.geistMono(11))
171
- .foregroundColor(audioLayer.isListening ? Palette.running : Palette.text)
172
- }
173
- HStack(spacing: 6) {
174
- keyBadge("ESC")
175
- Text("Dismiss")
176
- .font(Typo.geistMono(11))
177
- .foregroundColor(Palette.textMuted)
178
- }
179
- Spacer()
180
- }
181
- .padding(.vertical, 10)
182
- }
183
- .frame(width: 520, height: 480)
184
- .background(
185
- RoundedRectangle(cornerRadius: 12)
186
- .fill(Palette.bg)
187
- .overlay(
188
- RoundedRectangle(cornerRadius: 12)
189
- .strokeBorder(Palette.borderLit, lineWidth: 0.5)
190
- )
191
- )
192
- .clipShape(RoundedRectangle(cornerRadius: 12))
193
- }
194
-
195
- // MARK: - Tiling Column
196
-
197
- private var tilingColumn: some View {
198
- VStack(alignment: .leading, spacing: 10) {
199
- columnHeader("Tiling")
200
-
201
- // Modifier prefix
202
- HStack(spacing: 3) {
203
- keyBadge("Ctrl")
204
- keyBadge("Option")
205
- Text("+")
206
- .font(Typo.caption(11))
207
- .foregroundColor(Palette.textMuted)
208
- }
209
-
210
- // 3x3 grid
211
- VStack(spacing: 2) {
212
- HStack(spacing: 2) {
213
- tileCell(action: .tileTopLeft, label: "TL")
214
- tileCell(action: .tileTop, label: "Top")
215
- tileCell(action: .tileTopRight, label: "TR")
216
- }
217
- HStack(spacing: 2) {
218
- tileCell(action: .tileLeft, label: "Left")
219
- tileCell(action: .tileMaximize, label: "Max")
220
- tileCell(action: .tileRight, label: "Right")
221
- }
222
- HStack(spacing: 2) {
223
- tileCell(action: .tileBottomLeft, label: "BL")
224
- tileCell(action: .tileBottom, label: "Bot")
225
- tileCell(action: .tileBottomRight, label: "BR")
226
- }
227
- }
228
- .padding(6)
229
- .background(
230
- RoundedRectangle(cornerRadius: 6)
231
- .fill(Color.black.opacity(0.25))
232
- .overlay(
233
- RoundedRectangle(cornerRadius: 6)
234
- .strokeBorder(Palette.border, lineWidth: 0.5)
235
- )
236
- )
237
-
238
- // Thirds row
239
- HStack(spacing: 2) {
240
- tileCell(action: .tileLeftThird, label: "\u{2153}L")
241
- tileCell(action: .tileCenterThird, label: "\u{2153}C")
242
- tileCell(action: .tileRightThird, label: "\u{2153}R")
243
- }
244
- .padding(6)
245
- .background(
246
- RoundedRectangle(cornerRadius: 6)
247
- .fill(Color.black.opacity(0.25))
248
- .overlay(
249
- RoundedRectangle(cornerRadius: 6)
250
- .strokeBorder(Palette.border, lineWidth: 0.5)
251
- )
252
- )
253
-
254
- // Center + Distribute
255
- shortcutRow(action: .tileCenter)
256
- shortcutRow(action: .tileDistribute)
257
- shortcutRow(action: .tileTypeGrid)
258
- shortcutRow(action: .tileOrganize)
259
-
260
- // Hovered shortcut detail
261
- if let hovered = hoveredAction, let binding = hotkeyStore.bindings[hovered] {
262
- HStack(spacing: 3) {
263
- ForEach(binding.displayParts, id: \.self) { part in
264
- keyBadge(part)
265
- }
266
- Text("→ \(hovered.label)")
267
- .font(Typo.caption(11))
268
- .foregroundColor(Palette.textDim)
269
- }
270
- .transition(.opacity)
271
- .animation(.easeInOut(duration: 0.1), value: hoveredAction)
272
- }
273
- }
274
- .frame(maxWidth: .infinity, alignment: .leading)
275
- .onHover { over in
276
- if !over {
277
- hoveredAction = nil
278
- TileZoneOverlay.shared.dismiss()
279
- }
280
- }
281
- .onDisappear {
282
- hoveredAction = nil
283
- TileZoneOverlay.shared.dismiss()
284
- }
285
- }
286
-
287
- // MARK: - Voice Feedback
288
-
289
- private var voiceFeedback: some View {
290
- VStack(alignment: .leading, spacing: 6) {
291
- if audioLayer.isListening {
292
- HStack(spacing: 8) {
293
- Circle()
294
- .fill(Palette.running)
295
- .frame(width: 8, height: 8)
296
- Text("Listening...")
297
- .font(Typo.geistMono(12))
298
- .foregroundColor(Palette.running)
299
- Spacer()
300
- Text("Press Space to stop")
301
- .font(Typo.caption(10))
302
- .foregroundColor(Palette.textMuted)
303
- }
304
- } else if let transcript = audioLayer.lastTranscript {
305
- // Show what was heard
306
- HStack(spacing: 6) {
307
- Image(systemName: "quote.opening")
308
- .font(.system(size: 10))
309
- .foregroundColor(Palette.textMuted)
310
- Text(transcript)
311
- .font(Typo.geistMono(12))
312
- .foregroundColor(Palette.text)
313
- .lineLimit(1)
314
- }
315
-
316
- // Show matched intent + result
317
- if let intent = audioLayer.matchedIntent {
318
- HStack(spacing: 6) {
319
- Image(systemName: "arrow.right")
320
- .font(.system(size: 9))
321
- .foregroundColor(Palette.textMuted)
322
- Text(intent.replacingOccurrences(of: "_", with: " "))
323
- .font(Typo.geistMonoBold(11))
324
- .foregroundColor(Palette.text)
325
-
326
- if !audioLayer.matchedSlots.isEmpty {
327
- let slotText = audioLayer.matchedSlots
328
- .map { "\($0.key): \($0.value)" }
329
- .joined(separator: ", ")
330
- Text(slotText)
331
- .font(Typo.caption(10))
332
- .foregroundColor(Palette.textDim)
333
- }
334
-
335
- Spacer()
336
-
337
- if let result = audioLayer.executionResult {
338
- Text(result == "ok" ? "Done" : result)
339
- .font(Typo.caption(10))
340
- .foregroundColor(result == "ok" ? Palette.running : Palette.kill)
341
- }
342
- }
343
- } else if let result = audioLayer.executionResult {
344
- HStack(spacing: 6) {
345
- Image(systemName: "questionmark.circle")
346
- .font(.system(size: 10))
347
- .foregroundColor(Palette.textMuted)
348
- Text(result)
349
- .font(Typo.caption(10))
350
- .foregroundColor(Palette.textMuted)
351
- }
352
- }
353
- }
354
- }
355
- .padding(.horizontal, 20)
356
- .padding(.vertical, 10)
357
- .background(Color.black.opacity(0.15))
358
- .animation(.easeInOut(duration: 0.15), value: audioLayer.isListening)
359
- .animation(.easeInOut(duration: 0.15), value: audioLayer.lastTranscript)
360
- }
361
-
362
- // MARK: - App Column
363
-
364
- private var appColumn: some View {
365
- VStack(alignment: .leading, spacing: 8) {
366
- columnHeader("App")
367
-
368
- shortcutRow(action: .palette)
369
- shortcutRow(action: .unifiedWindow)
370
- shortcutRow(action: .bezel)
371
- shortcutRow(action: .hud)
372
- shortcutRow(action: .voiceCommand)
373
- shortcutRow(action: .cheatSheet)
374
- }
375
- }
376
-
377
- // MARK: - tmux Column
378
-
379
- private var tmuxColumn: some View {
380
- VStack(alignment: .leading, spacing: 6) {
381
- columnHeader("Inside tmux")
382
-
383
- tmuxRow("Detach", keys: ["Ctrl+B", "D"])
384
- tmuxRow("Kill pane", keys: ["Ctrl+B", "X"])
385
- tmuxRow("Pane left", keys: ["Ctrl+B", "\u{2190}"])
386
- tmuxRow("Pane right", keys: ["Ctrl+B", "\u{2192}"])
387
- tmuxRow("Zoom toggle", keys: ["Ctrl+B", "Z"])
388
- tmuxRow("Scroll mode", keys: ["Ctrl+B", "["])
389
- }
390
- }
391
-
392
- // MARK: - Shared components
393
-
394
- private func columnHeader(_ title: String) -> some View {
395
- Text(title.uppercased())
396
- .font(Typo.pixel(12))
397
- .foregroundColor(Palette.textDim)
398
- .tracking(1)
399
- }
400
-
401
- private func tileCell(action: HotkeyAction, label: String) -> some View {
402
- let binding = hotkeyStore.bindings[action]
403
- let badgeText = binding?.displayParts.last ?? ""
404
- let isHovered = hoveredAction == action
405
-
406
- return VStack(spacing: 2) {
407
- Text(badgeText)
408
- .font(Typo.geistMonoBold(12))
409
- .foregroundColor(isHovered ? Color.blue : Palette.text)
410
- Text(label)
411
- .font(Typo.caption(8))
412
- .foregroundColor(isHovered ? Palette.text : Palette.textMuted)
413
- }
414
- .frame(maxWidth: .infinity)
415
- .frame(height: 38)
416
- .background(
417
- RoundedRectangle(cornerRadius: 4)
418
- .fill(isHovered ? Color.blue.opacity(0.15) : Palette.surface)
419
- .overlay(
420
- RoundedRectangle(cornerRadius: 4)
421
- .strokeBorder(isHovered ? Color.blue.opacity(0.5) : Palette.border, lineWidth: 0.5)
422
- )
423
- )
424
- .onHover { over in
425
- if over {
426
- hoveredAction = action
427
- if let pos = action.tilePosition {
428
- TileZoneOverlay.shared.show(position: pos)
429
- }
430
- }
431
- }
432
- }
433
-
434
- private func shortcutRow(action: HotkeyAction) -> some View {
435
- let binding = hotkeyStore.bindings[action]
436
- return HStack(spacing: 8) {
437
- if let parts = binding?.displayParts {
438
- HStack(spacing: 3) {
439
- ForEach(parts, id: \.self) { part in
440
- keyBadge(part)
441
- }
442
- }
443
- }
444
- Text(action.label)
445
- .font(Typo.caption(11))
446
- .foregroundColor(Palette.textDim)
447
- Spacer()
448
- }
449
- }
450
-
451
- private func tmuxRow(_ label: String, keys: [String]) -> some View {
452
- HStack(spacing: 8) {
453
- HStack(spacing: 3) {
454
- ForEach(keys, id: \.self) { key in
455
- keyBadge(key)
456
- }
457
- }
458
- Text(label)
459
- .font(Typo.caption(11))
460
- .foregroundColor(Palette.textDim)
461
- Spacer()
462
- }
463
- }
464
-
465
- private func keyBadge(_ key: String) -> some View {
466
- Text(key)
467
- .font(Typo.geistMonoBold(10))
468
- .foregroundColor(Palette.text)
469
- .padding(.horizontal, 6)
470
- .padding(.vertical, 3)
471
- .background(
472
- RoundedRectangle(cornerRadius: 3)
473
- .fill(Palette.surface)
474
- .overlay(
475
- RoundedRectangle(cornerRadius: 3)
476
- .strokeBorder(Palette.border, lineWidth: 0.5)
477
- )
478
- )
479
- }
480
- }
481
-
482
- // MARK: - HotkeyAction → TilePosition mapping
483
-
484
- extension HotkeyAction {
485
- var tilePosition: TilePosition? {
486
- switch self {
487
- case .tileLeft: return .left
488
- case .tileRight: return .right
489
- case .tileTop: return .top
490
- case .tileBottom: return .bottom
491
- case .tileTopLeft: return .topLeft
492
- case .tileTopRight: return .topRight
493
- case .tileBottomLeft: return .bottomLeft
494
- case .tileBottomRight: return .bottomRight
495
- case .tileMaximize: return .maximize
496
- case .tileCenter: return .center
497
- case .tileLeftThird: return .leftThird
498
- case .tileCenterThird: return .centerThird
499
- case .tileRightThird: return .rightThird
500
- default: return nil
501
- }
502
- }
503
- }
504
-
505
- // MARK: - TileZoneOverlay
506
-
507
- final class TileZoneOverlay {
508
- static let shared = TileZoneOverlay()
509
-
510
- private var panel: NSPanel?
511
-
512
- func show(position: TilePosition) {
513
- // Instant teardown (no animation) when switching between cells
514
- if let p = panel {
515
- p.orderOut(nil)
516
- self.panel = nil
517
- }
518
-
519
- // Use the screen where the mouse is (same as CheatSheetHUD)
520
- let mouseLocation = NSEvent.mouseLocation
521
- let screen = NSScreen.screens.first(where: { $0.frame.contains(mouseLocation) }) ?? NSScreen.main ?? NSScreen.screens.first!
522
- let visible = screen.visibleFrame
523
-
524
- let (fx, fy, fw, fh) = position.rect
525
- // visibleFrame origin is bottom-left in AppKit coordinates
526
- let zoneRect = NSRect(
527
- x: visible.origin.x + visible.width * fx,
528
- y: visible.origin.y + visible.height * (1 - fy - fh),
529
- width: visible.width * fw,
530
- height: visible.height * fh
531
- )
532
-
533
- let p = NSPanel(
534
- contentRect: zoneRect,
535
- styleMask: [.borderless, .nonactivatingPanel],
536
- backing: .buffered,
537
- defer: false
538
- )
539
- p.isOpaque = false
540
- p.backgroundColor = .clear
541
- p.level = .floating
542
- p.hasShadow = false
543
- p.hidesOnDeactivate = false
544
- p.isReleasedWhenClosed = false
545
- p.ignoresMouseEvents = true
546
-
547
- let overlay = NSView(frame: NSRect(origin: .zero, size: zoneRect.size))
548
- overlay.wantsLayer = true
549
- overlay.layer?.backgroundColor = NSColor.systemBlue.withAlphaComponent(0.08).cgColor
550
- overlay.layer?.borderColor = NSColor.systemBlue.withAlphaComponent(0.4).cgColor
551
- overlay.layer?.borderWidth = 2
552
- overlay.layer?.cornerRadius = 8
553
- p.contentView = overlay
554
-
555
- p.alphaValue = 0
556
- p.orderFrontRegardless()
557
-
558
- NSAnimationContext.runAnimationGroup { ctx in
559
- ctx.duration = 0.12
560
- p.animator().alphaValue = 1.0
561
- }
562
-
563
- self.panel = p
564
- }
565
-
566
- func dismiss() {
567
- guard let p = panel else { return }
568
- NSAnimationContext.runAnimationGroup({ ctx in
569
- ctx.duration = 0.1
570
- p.animator().alphaValue = 0
571
- }) { [weak self] in
572
- p.orderOut(nil)
573
- self?.panel = nil
574
- }
575
- }
576
- }