@lattices/cli 0.4.2 → 0.4.6

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 (146) hide show
  1. package/README.md +3 -0
  2. package/app/Info.plist +2 -2
  3. package/app/Lattices.app/Contents/Info.plist +2 -2
  4. package/app/Lattices.app/Contents/MacOS/Lattices +0 -0
  5. package/app/Package.swift +6 -0
  6. package/app/Sources/AppShell/App.swift +20 -0
  7. package/app/Sources/{AppDelegate.swift → AppShell/AppDelegate.swift} +94 -34
  8. package/app/Sources/{AppShellView.swift → AppShell/AppShellView.swift} +12 -1
  9. package/app/Sources/AppShell/AppUpdater.swift +92 -0
  10. package/app/Sources/AppShell/CliActionLauncher.swift +50 -0
  11. package/app/Sources/{HomeDashboardView.swift → AppShell/HomeDashboardView.swift} +18 -10
  12. package/app/Sources/AppShell/LatticesRuntime.swift +61 -0
  13. package/app/Sources/{MainView.swift → AppShell/MainView.swift} +351 -191
  14. package/app/Sources/{OnboardingView.swift → AppShell/OnboardingView.swift} +30 -16
  15. package/app/Sources/{Preferences.swift → AppShell/Preferences.swift} +78 -0
  16. package/app/Sources/{SettingsView.swift → AppShell/SettingsView.swift} +869 -152
  17. package/app/Sources/{HotkeyStore.swift → Core/Actions/HotkeyStore.swift} +9 -5
  18. package/app/Sources/{IntentEngine.swift → Core/Actions/IntentEngine.swift} +51 -27
  19. package/app/Sources/Core/Actions/IntentSchema.swift +94 -0
  20. package/app/Sources/{Intents → Core/Actions/Intents}/LatticeIntent.swift +0 -25
  21. package/app/Sources/{PaletteCommand.swift → Core/Actions/PaletteCommand.swift} +26 -6
  22. package/app/Sources/{VoiceIntentResolver.swift → Core/Actions/VoiceIntentResolver.swift} +46 -4
  23. package/app/Sources/Core/Companion/CompanionActivityLog.swift +70 -0
  24. package/app/Sources/Core/Companion/CompanionKeyboardController.swift +141 -0
  25. package/app/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +438 -0
  26. package/app/Sources/Core/Companion/LatticesCompanionCockpit.swift +555 -0
  27. package/app/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +594 -0
  28. package/app/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +204 -0
  29. package/app/Sources/Core/Companion/LatticesDeckHost.swift +1463 -0
  30. package/app/Sources/{LatticesApi.swift → Core/Daemon/LatticesApi.swift} +125 -4
  31. package/app/Sources/{AppTypeClassifier.swift → Core/Desktop/AppTypeClassifier.swift} +36 -0
  32. package/app/Sources/{DesktopModel.swift → Core/Desktop/DesktopModel.swift} +6 -8
  33. package/app/Sources/Core/Desktop/MouseFinder.swift +527 -0
  34. package/app/Sources/Core/Desktop/SessionWindowLocator.swift +139 -0
  35. package/app/Sources/Core/Desktop/WindowDragSnapController.swift +628 -0
  36. package/app/Sources/Core/Desktop/WindowPreviewCard.swift +100 -0
  37. package/app/Sources/Core/Desktop/WindowPreviewStore.swift +113 -0
  38. package/app/Sources/Core/Desktop/WindowSelectionStore.swift +76 -0
  39. package/app/Sources/{WindowTiler.swift → Core/Desktop/WindowTiler.swift} +351 -172
  40. package/app/Sources/Core/Input/MouseGestureConfig.swift +364 -0
  41. package/app/Sources/Core/Input/MouseGestureController.swift +1203 -0
  42. package/app/Sources/Core/Input/MouseInputDeviceStore.swift +98 -0
  43. package/app/Sources/Core/Input/MouseInputEventViewer.swift +272 -0
  44. package/app/Sources/Core/Input/MouseShortcutStore.swift +107 -0
  45. package/app/Sources/{CommandModeState.swift → Core/Overlays/CommandMode/CommandModeState.swift} +127 -24
  46. package/app/Sources/{CommandModeView.swift → Core/Overlays/CommandMode/CommandModeView.swift} +492 -79
  47. package/app/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +67 -0
  48. package/app/Sources/{CheatSheetHUD.swift → Core/Overlays/HUD/CheatSheetHUD.swift} +1 -0
  49. package/app/Sources/{HUDRightBar.swift → Core/Overlays/HUD/HUDRightBar.swift} +23 -201
  50. package/app/Sources/{LauncherHUD.swift → Core/Overlays/HUD/LauncherHUD.swift} +12 -26
  51. package/app/Sources/{OmniSearchView.swift → Core/Overlays/OmniSearch/OmniSearchView.swift} +136 -2
  52. package/app/Sources/{OmniSearchWindow.swift → Core/Overlays/OmniSearch/OmniSearchWindow.swift} +21 -32
  53. package/app/Sources/Core/Overlays/OverlayPanelShell.swift +241 -0
  54. package/app/Sources/{ScreenMapState.swift → Core/Overlays/ScreenMap/ScreenMapState.swift} +116 -32
  55. package/app/Sources/{ScreenMapView.swift → Core/Overlays/ScreenMap/ScreenMapView.swift} +510 -524
  56. package/app/Sources/{ScreenMapWindowController.swift → Core/Overlays/ScreenMap/ScreenMapWindowController.swift} +12 -4
  57. package/app/Sources/{VoiceCommandWindow.swift → Core/Overlays/Voice/VoiceCommandWindow.swift} +46 -53
  58. package/app/Sources/Core/Pi/PiAuthNextStepCard.swift +148 -0
  59. package/app/Sources/Core/Pi/PiAuthPromptCard.swift +90 -0
  60. package/app/Sources/{PiChatDock.swift → Core/Pi/PiChatDock.swift} +137 -74
  61. package/app/Sources/{PiChatSession.swift → Core/Pi/PiChatSession.swift} +608 -108
  62. package/app/Sources/Core/Pi/PiInstallCallout.swift +86 -0
  63. package/app/Sources/Core/Pi/PiProviderSetupCallout.swift +99 -0
  64. package/app/Sources/{PiWorkspaceView.swift → Core/Pi/PiWorkspaceView.swift} +174 -77
  65. package/app/Sources/{PermissionChecker.swift → Core/System/PermissionChecker.swift} +76 -2
  66. package/app/Sources/Core/System/SystemTelemetryMonitor.swift +273 -0
  67. package/app/Sources/{HandsOffSession.swift → Core/Voice/HandsOffSession.swift} +15 -4
  68. package/app/Sources/{WorkspaceManager.swift → Core/Workspace/WorkspaceManager.swift} +288 -0
  69. package/bin/assistant-intelligence.ts +874 -0
  70. package/bin/handsoff-infer.ts +16 -209
  71. package/bin/handsoff-worker.ts +45 -258
  72. package/bin/lattices-app.ts +62 -0
  73. package/bin/lattices-dev +4 -0
  74. package/bin/lattices.ts +125 -14
  75. package/docs/agents.md +14 -0
  76. package/docs/api.md +55 -0
  77. package/docs/app.md +3 -0
  78. package/docs/companion-deck.md +180 -0
  79. package/docs/component-extraction-roadmap.md +392 -0
  80. package/docs/config.md +25 -0
  81. package/docs/tiling-reference.md +55 -0
  82. package/docs/voice-error-model.md +73 -0
  83. package/package.json +4 -1
  84. package/app/Sources/App.swift +0 -10
  85. package/app/Sources/CommandPaletteWindow.swift +0 -134
  86. package/app/Sources/MouseFinder.swift +0 -222
  87. /package/app/Sources/{KeyRecorderView.swift → AppShell/KeyRecorderView.swift} +0 -0
  88. /package/app/Sources/{MainWindow.swift → AppShell/MainWindow.swift} +0 -0
  89. /package/app/Sources/{SettingsWindow.swift → AppShell/SettingsWindow.swift} +0 -0
  90. /package/app/Sources/{HotkeyManager.swift → Core/Actions/HotkeyManager.swift} +0 -0
  91. /package/app/Sources/{Intents → Core/Actions/Intents}/CreateLayerIntent.swift +0 -0
  92. /package/app/Sources/{Intents → Core/Actions/Intents}/DistributeIntent.swift +0 -0
  93. /package/app/Sources/{Intents → Core/Actions/Intents}/FocusIntent.swift +0 -0
  94. /package/app/Sources/{Intents → Core/Actions/Intents}/HelpIntent.swift +0 -0
  95. /package/app/Sources/{Intents → Core/Actions/Intents}/KillIntent.swift +0 -0
  96. /package/app/Sources/{Intents → Core/Actions/Intents}/LaunchIntent.swift +0 -0
  97. /package/app/Sources/{Intents → Core/Actions/Intents}/ListSessionsIntent.swift +0 -0
  98. /package/app/Sources/{Intents → Core/Actions/Intents}/ListWindowsIntent.swift +0 -0
  99. /package/app/Sources/{Intents → Core/Actions/Intents}/ScanIntent.swift +0 -0
  100. /package/app/Sources/{Intents → Core/Actions/Intents}/SearchIntent.swift +0 -0
  101. /package/app/Sources/{Intents → Core/Actions/Intents}/SwitchLayerIntent.swift +0 -0
  102. /package/app/Sources/{Intents → Core/Actions/Intents}/TileIntent.swift +0 -0
  103. /package/app/Sources/{DaemonProtocol.swift → Core/Daemon/DaemonProtocol.swift} +0 -0
  104. /package/app/Sources/{DaemonServer.swift → Core/Daemon/DaemonServer.swift} +0 -0
  105. /package/app/Sources/{AccessibilityTextExtractor.swift → Core/Desktop/AccessibilityTextExtractor.swift} +0 -0
  106. /package/app/Sources/{DesktopModelTypes.swift → Core/Desktop/DesktopModelTypes.swift} +0 -0
  107. /package/app/Sources/{InventoryManager.swift → Core/Desktop/InventoryManager.swift} +0 -0
  108. /package/app/Sources/{InventoryPath.swift → Core/Desktop/InventoryPath.swift} +0 -0
  109. /package/app/Sources/{OcrModel.swift → Core/Desktop/OcrModel.swift} +0 -0
  110. /package/app/Sources/{OcrStore.swift → Core/Desktop/OcrStore.swift} +0 -0
  111. /package/app/Sources/{PlacementSpec.swift → Core/Desktop/PlacementSpec.swift} +0 -0
  112. /package/app/Sources/{TilePickerView.swift → Core/Desktop/TilePickerView.swift} +0 -0
  113. /package/app/Sources/{AppWindowShell.swift → Core/Overlays/AppWindowShell.swift} +0 -0
  114. /package/app/Sources/{CommandModeWindow.swift → Core/Overlays/CommandMode/CommandModeWindow.swift} +0 -0
  115. /package/app/Sources/{CommandPaletteView.swift → Core/Overlays/CommandPalette/CommandPaletteView.swift} +0 -0
  116. /package/app/Sources/{HUDBottomBar.swift → Core/Overlays/HUD/HUDBottomBar.swift} +0 -0
  117. /package/app/Sources/{HUDController.swift → Core/Overlays/HUD/HUDController.swift} +0 -0
  118. /package/app/Sources/{HUDLeftBar.swift → Core/Overlays/HUD/HUDLeftBar.swift} +0 -0
  119. /package/app/Sources/{HUDMinimap.swift → Core/Overlays/HUD/HUDMinimap.swift} +0 -0
  120. /package/app/Sources/{HUDState.swift → Core/Overlays/HUD/HUDState.swift} +0 -0
  121. /package/app/Sources/{HUDTopBar.swift → Core/Overlays/HUD/HUDTopBar.swift} +0 -0
  122. /package/app/Sources/{LayerBezel.swift → Core/Overlays/HUD/LayerBezel.swift} +0 -0
  123. /package/app/Sources/{OmniSearchState.swift → Core/Overlays/OmniSearch/OmniSearchState.swift} +0 -0
  124. /package/app/Sources/{DiagnosticLog.swift → Core/System/DiagnosticLog.swift} +0 -0
  125. /package/app/Sources/{EventBus.swift → Core/System/EventBus.swift} +0 -0
  126. /package/app/Sources/{ProcessModel.swift → Core/System/ProcessModel.swift} +0 -0
  127. /package/app/Sources/{ProcessQuery.swift → Core/System/ProcessQuery.swift} +0 -0
  128. /package/app/Sources/{AdvisorLearningStore.swift → Core/Voice/AdvisorLearningStore.swift} +0 -0
  129. /package/app/Sources/{AgentSession.swift → Core/Voice/AgentSession.swift} +0 -0
  130. /package/app/Sources/{AudioProvider.swift → Core/Voice/AudioProvider.swift} +0 -0
  131. /package/app/Sources/{VoiceChatView.swift → Core/Voice/VoiceChatView.swift} +0 -0
  132. /package/app/Sources/{VoxClient.swift → Core/Voice/VoxClient.swift} +0 -0
  133. /package/app/Sources/{Project.swift → Core/Workspace/Project.swift} +0 -0
  134. /package/app/Sources/{ProjectScanner.swift → Core/Workspace/ProjectScanner.swift} +0 -0
  135. /package/app/Sources/{SessionLayerStore.swift → Core/Workspace/SessionLayerStore.swift} +0 -0
  136. /package/app/Sources/{SessionManager.swift → Core/Workspace/SessionManager.swift} +0 -0
  137. /package/app/Sources/{Terminal.swift → Core/Workspace/Terminal/Terminal.swift} +0 -0
  138. /package/app/Sources/{TerminalQuery.swift → Core/Workspace/Terminal/TerminalQuery.swift} +0 -0
  139. /package/app/Sources/{TerminalSynthesizer.swift → Core/Workspace/Terminal/TerminalSynthesizer.swift} +0 -0
  140. /package/app/Sources/{TmuxModel.swift → Core/Workspace/Tmux/TmuxModel.swift} +0 -0
  141. /package/app/Sources/{TmuxQuery.swift → Core/Workspace/Tmux/TmuxQuery.swift} +0 -0
  142. /package/app/Sources/{ActionRow.swift → UI/ActionRow.swift} +0 -0
  143. /package/app/Sources/{OrphanRow.swift → UI/OrphanRow.swift} +0 -0
  144. /package/app/Sources/{ProjectRow.swift → UI/ProjectRow.swift} +0 -0
  145. /package/app/Sources/{TabGroupRow.swift → UI/TabGroupRow.swift} +0 -0
  146. /package/app/Sources/{Theme.swift → UI/Theme.swift} +0 -0
@@ -0,0 +1,204 @@
1
+ import AppKit
2
+ import DeckKit
3
+ import Foundation
4
+
5
+ final class LatticesCompanionTrackpadController {
6
+ static let shared = LatticesCompanionTrackpadController()
7
+
8
+ private init() {}
9
+
10
+ func state(isEnabled: Bool) -> DeckTrackpadState {
11
+ guard isEnabled else {
12
+ return DeckTrackpadState(
13
+ isEnabled: false,
14
+ isAvailable: false,
15
+ statusTitle: "Trackpad Off",
16
+ statusDetail: "Enable the companion trackpad from the Mac Shortcuts settings.",
17
+ pointerScale: 1.6,
18
+ scrollScale: 1.0,
19
+ supportsDragLock: true
20
+ )
21
+ }
22
+
23
+ let trusted = AXIsProcessTrusted()
24
+ return DeckTrackpadState(
25
+ isEnabled: true,
26
+ isAvailable: trusted,
27
+ statusTitle: trusted ? "Trackpad Ready" : "Accessibility Needed",
28
+ statusDetail: trusted
29
+ ? "Move, scroll, click, and drag on your Mac from the iPad surface."
30
+ : "Grant Accessibility permission to Lattices on your Mac to enable pointer control.",
31
+ pointerScale: 1.6,
32
+ scrollScale: 1.0,
33
+ supportsDragLock: true
34
+ )
35
+ }
36
+
37
+ func perform(_ request: DeckTrackpadEventRequest) -> DeckTrackpadEventResult {
38
+ guard AXIsProcessTrusted() else {
39
+ return DeckTrackpadEventResult(ok: false)
40
+ }
41
+
42
+ let ok: Bool
43
+ switch request.event {
44
+ case .move:
45
+ ok = performMouseMove(dx: request.dx, dy: request.dy)
46
+ case .click:
47
+ ok = performMouseClick(button: .left)
48
+ case .rightClick:
49
+ ok = performMouseClick(button: .right)
50
+ case .scroll:
51
+ ok = performMouseScroll(dx: request.dx, dy: request.dy)
52
+ case .mouseDown:
53
+ ok = performMouseButtonState(button: .left, isDown: true)
54
+ case .mouseUp:
55
+ ok = performMouseButtonState(button: .left, isDown: false)
56
+ case .drag:
57
+ ok = performMouseDrag(dx: request.dx, dy: request.dy)
58
+ }
59
+
60
+ return DeckTrackpadEventResult(ok: ok)
61
+ }
62
+ }
63
+
64
+ private extension LatticesCompanionTrackpadController {
65
+ func currentCursorPoint() -> CGPoint {
66
+ CGEvent(source: nil)?.location ?? .zero
67
+ }
68
+
69
+ func clamp(delta: Double) -> CGFloat {
70
+ CGFloat(max(-180, min(180, delta)))
71
+ }
72
+
73
+ func performMouseMove(dx: Double, dy: Double) -> Bool {
74
+ let current = currentCursorPoint()
75
+ let next = CGPoint(
76
+ x: current.x + clamp(delta: dx),
77
+ y: current.y + clamp(delta: dy)
78
+ )
79
+
80
+ // Disassociate so the synthesized warp isn't fought by the physical
81
+ // mouse's last reported position (which was pinning Y to the bottom).
82
+ CGAssociateMouseAndMouseCursorPosition(0)
83
+ CGWarpMouseCursorPosition(next)
84
+
85
+ guard let source = CGEventSource(stateID: .combinedSessionState),
86
+ let event = CGEvent(
87
+ mouseEventSource: source,
88
+ mouseType: .mouseMoved,
89
+ mouseCursorPosition: next,
90
+ mouseButton: .left
91
+ ) else {
92
+ CGAssociateMouseAndMouseCursorPosition(1)
93
+ return false
94
+ }
95
+ event.setIntegerValueField(.mouseEventDeltaX, value: Int64(clamp(delta: dx)))
96
+ event.setIntegerValueField(.mouseEventDeltaY, value: Int64(clamp(delta: dy)))
97
+ event.post(tap: .cghidEventTap)
98
+ CGAssociateMouseAndMouseCursorPosition(1)
99
+ return true
100
+ }
101
+
102
+ func performMouseClick(button: CGMouseButton) -> Bool {
103
+ let pos = currentCursorPoint()
104
+ let downType: CGEventType = button == .left ? .leftMouseDown : .rightMouseDown
105
+ let upType: CGEventType = button == .left ? .leftMouseUp : .rightMouseUp
106
+
107
+ guard let source = CGEventSource(stateID: .combinedSessionState),
108
+ let down = CGEvent(
109
+ mouseEventSource: source,
110
+ mouseType: downType,
111
+ mouseCursorPosition: pos,
112
+ mouseButton: button
113
+ ),
114
+ let up = CGEvent(
115
+ mouseEventSource: source,
116
+ mouseType: upType,
117
+ mouseCursorPosition: pos,
118
+ mouseButton: button
119
+ ) else {
120
+ return false
121
+ }
122
+ down.post(tap: .cghidEventTap)
123
+ up.post(tap: .cghidEventTap)
124
+ return true
125
+ }
126
+
127
+ func performMouseButtonState(button: CGMouseButton, isDown: Bool) -> Bool {
128
+ let pos = currentCursorPoint()
129
+ let eventType: CGEventType
130
+
131
+ switch (button, isDown) {
132
+ case (.left, true):
133
+ eventType = .leftMouseDown
134
+ case (.left, false):
135
+ eventType = .leftMouseUp
136
+ case (.right, true):
137
+ eventType = .rightMouseDown
138
+ case (.right, false):
139
+ eventType = .rightMouseUp
140
+ default:
141
+ eventType = .leftMouseDown
142
+ }
143
+
144
+ guard let source = CGEventSource(stateID: .combinedSessionState),
145
+ let event = CGEvent(
146
+ mouseEventSource: source,
147
+ mouseType: eventType,
148
+ mouseCursorPosition: pos,
149
+ mouseButton: button
150
+ ) else {
151
+ return false
152
+ }
153
+
154
+ event.post(tap: .cghidEventTap)
155
+ return true
156
+ }
157
+
158
+ func performMouseDrag(dx: Double, dy: Double) -> Bool {
159
+ let current = currentCursorPoint()
160
+ let next = CGPoint(
161
+ x: current.x + clamp(delta: dx),
162
+ y: current.y + clamp(delta: dy)
163
+ )
164
+
165
+ CGAssociateMouseAndMouseCursorPosition(0)
166
+ CGWarpMouseCursorPosition(next)
167
+
168
+ guard let source = CGEventSource(stateID: .combinedSessionState),
169
+ let event = CGEvent(
170
+ mouseEventSource: source,
171
+ mouseType: .leftMouseDragged,
172
+ mouseCursorPosition: next,
173
+ mouseButton: .left
174
+ ) else {
175
+ CGAssociateMouseAndMouseCursorPosition(1)
176
+ return false
177
+ }
178
+ event.setIntegerValueField(.mouseEventDeltaX, value: Int64(clamp(delta: dx)))
179
+ event.setIntegerValueField(.mouseEventDeltaY, value: Int64(clamp(delta: dy)))
180
+ event.post(tap: .cghidEventTap)
181
+ CGAssociateMouseAndMouseCursorPosition(1)
182
+ return true
183
+ }
184
+
185
+ func performMouseScroll(dx: Double, dy: Double) -> Bool {
186
+ let horizontal = Int32(clamp(delta: dx).rounded())
187
+ let vertical = Int32((-clamp(delta: dy)).rounded())
188
+
189
+ guard let source = CGEventSource(stateID: .combinedSessionState),
190
+ let event = CGEvent(
191
+ scrollWheelEvent2Source: source,
192
+ units: .pixel,
193
+ wheelCount: 2,
194
+ wheel1: vertical,
195
+ wheel2: horizontal,
196
+ wheel3: 0
197
+ ) else {
198
+ return false
199
+ }
200
+
201
+ event.post(tap: .cghidEventTap)
202
+ return true
203
+ }
204
+ }