@lattices/cli 0.4.14 → 0.5.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 (180) hide show
  1. package/README.md +5 -7
  2. package/apps/mac/Info.plist +2 -2
  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/reference/dewey.config.ts +2 -2
  19. package/docs/release.md +171 -0
  20. package/docs/repo-structure.md +4 -5
  21. package/docs/voice.md +11 -27
  22. package/package.json +9 -10
  23. package/apps/mac/Package.swift +0 -27
  24. package/apps/mac/Sources/AppShell/App.swift +0 -26
  25. package/apps/mac/Sources/AppShell/AppActivationCoordinator.swift +0 -27
  26. package/apps/mac/Sources/AppShell/AppDelegate.swift +0 -189
  27. package/apps/mac/Sources/AppShell/AppServicesBootstrap.swift +0 -25
  28. package/apps/mac/Sources/AppShell/AppShellView.swift +0 -171
  29. package/apps/mac/Sources/AppShell/AppUpdater.swift +0 -305
  30. package/apps/mac/Sources/AppShell/CliActionLauncher.swift +0 -50
  31. package/apps/mac/Sources/AppShell/HomeDashboardView.swift +0 -133
  32. package/apps/mac/Sources/AppShell/HotkeyBootstrap.swift +0 -87
  33. package/apps/mac/Sources/AppShell/KeyRecorderView.swift +0 -210
  34. package/apps/mac/Sources/AppShell/LatticesRuntime.swift +0 -104
  35. package/apps/mac/Sources/AppShell/MainView.swift +0 -847
  36. package/apps/mac/Sources/AppShell/MainWindow.swift +0 -83
  37. package/apps/mac/Sources/AppShell/MenuBarController.swift +0 -177
  38. package/apps/mac/Sources/AppShell/OnboardingView.swift +0 -483
  39. package/apps/mac/Sources/AppShell/PermissionsAssistantView.swift +0 -366
  40. package/apps/mac/Sources/AppShell/PermissionsAssistantWindow.swift +0 -70
  41. package/apps/mac/Sources/AppShell/Preferences.swift +0 -297
  42. package/apps/mac/Sources/AppShell/SettingsView.swift +0 -3163
  43. package/apps/mac/Sources/AppShell/SettingsWindow.swift +0 -34
  44. package/apps/mac/Sources/AppShell/WorkspaceInspectorPresenter.swift +0 -13
  45. package/apps/mac/Sources/Core/Actions/HotkeyManager.swift +0 -256
  46. package/apps/mac/Sources/Core/Actions/HotkeyStore.swift +0 -399
  47. package/apps/mac/Sources/Core/Actions/IntentEngine.swift +0 -988
  48. package/apps/mac/Sources/Core/Actions/IntentSchema.swift +0 -94
  49. package/apps/mac/Sources/Core/Actions/Intents/CreateLayerIntent.swift +0 -54
  50. package/apps/mac/Sources/Core/Actions/Intents/DistributeIntent.swift +0 -56
  51. package/apps/mac/Sources/Core/Actions/Intents/FocusIntent.swift +0 -69
  52. package/apps/mac/Sources/Core/Actions/Intents/HelpIntent.swift +0 -41
  53. package/apps/mac/Sources/Core/Actions/Intents/KillIntent.swift +0 -47
  54. package/apps/mac/Sources/Core/Actions/Intents/LatticeIntent.swift +0 -53
  55. package/apps/mac/Sources/Core/Actions/Intents/LaunchIntent.swift +0 -67
  56. package/apps/mac/Sources/Core/Actions/Intents/ListSessionsIntent.swift +0 -32
  57. package/apps/mac/Sources/Core/Actions/Intents/ListWindowsIntent.swift +0 -30
  58. package/apps/mac/Sources/Core/Actions/Intents/ScanIntent.swift +0 -52
  59. package/apps/mac/Sources/Core/Actions/Intents/SearchIntent.swift +0 -190
  60. package/apps/mac/Sources/Core/Actions/Intents/SwitchLayerIntent.swift +0 -50
  61. package/apps/mac/Sources/Core/Actions/Intents/TileIntent.swift +0 -61
  62. package/apps/mac/Sources/Core/Actions/PaletteCommand.swift +0 -439
  63. package/apps/mac/Sources/Core/Actions/VoiceIntentResolver.swift +0 -713
  64. package/apps/mac/Sources/Core/Companion/CompanionActivityLog.swift +0 -70
  65. package/apps/mac/Sources/Core/Companion/CompanionKeyboardController.swift +0 -141
  66. package/apps/mac/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +0 -454
  67. package/apps/mac/Sources/Core/Companion/LatticesCompanionCockpit.swift +0 -555
  68. package/apps/mac/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +0 -629
  69. package/apps/mac/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +0 -204
  70. package/apps/mac/Sources/Core/Companion/LatticesDeckHost.swift +0 -1463
  71. package/apps/mac/Sources/Core/Daemon/DaemonProtocol.swift +0 -114
  72. package/apps/mac/Sources/Core/Daemon/DaemonServer.swift +0 -427
  73. package/apps/mac/Sources/Core/Daemon/LatticesApi.swift +0 -2965
  74. package/apps/mac/Sources/Core/Desktop/AccessibilityTextExtractor.swift +0 -111
  75. package/apps/mac/Sources/Core/Desktop/AppTypeClassifier.swift +0 -106
  76. package/apps/mac/Sources/Core/Desktop/DesktopModel.swift +0 -331
  77. package/apps/mac/Sources/Core/Desktop/DesktopModelTypes.swift +0 -73
  78. package/apps/mac/Sources/Core/Desktop/InventoryManager.swift +0 -35
  79. package/apps/mac/Sources/Core/Desktop/InventoryPath.swift +0 -43
  80. package/apps/mac/Sources/Core/Desktop/MouseFinder.swift +0 -527
  81. package/apps/mac/Sources/Core/Desktop/OcrModel.swift +0 -467
  82. package/apps/mac/Sources/Core/Desktop/OcrStore.swift +0 -329
  83. package/apps/mac/Sources/Core/Desktop/PlacementSpec.swift +0 -195
  84. package/apps/mac/Sources/Core/Desktop/SessionWindowLocator.swift +0 -139
  85. package/apps/mac/Sources/Core/Desktop/TilePickerView.swift +0 -209
  86. package/apps/mac/Sources/Core/Desktop/WindowCapture.swift +0 -33
  87. package/apps/mac/Sources/Core/Desktop/WindowDragSnapController.swift +0 -429
  88. package/apps/mac/Sources/Core/Desktop/WindowPreviewCard.swift +0 -100
  89. package/apps/mac/Sources/Core/Desktop/WindowPreviewStore.swift +0 -112
  90. package/apps/mac/Sources/Core/Desktop/WindowSelectionStore.swift +0 -76
  91. package/apps/mac/Sources/Core/Desktop/WindowTiler.swift +0 -2222
  92. package/apps/mac/Sources/Core/Input/EventTapBreaker.swift +0 -124
  93. package/apps/mac/Sources/Core/Input/EventTapThread.swift +0 -54
  94. package/apps/mac/Sources/Core/Input/InputCaptureResetCenter.swift +0 -20
  95. package/apps/mac/Sources/Core/Input/KeyboardRemapConfig.swift +0 -69
  96. package/apps/mac/Sources/Core/Input/KeyboardRemapController.swift +0 -346
  97. package/apps/mac/Sources/Core/Input/KeyboardRemapStore.swift +0 -141
  98. package/apps/mac/Sources/Core/Input/MouseGestureConfig.swift +0 -499
  99. package/apps/mac/Sources/Core/Input/MouseGestureController.swift +0 -2583
  100. package/apps/mac/Sources/Core/Input/MouseInputDeviceStore.swift +0 -98
  101. package/apps/mac/Sources/Core/Input/MouseInputEventViewer.swift +0 -272
  102. package/apps/mac/Sources/Core/Input/MouseShortcutStore.swift +0 -170
  103. package/apps/mac/Sources/Core/Input/SecureEventInputMonitor.swift +0 -39
  104. package/apps/mac/Sources/Core/Input/ShapeRecognizer.swift +0 -624
  105. package/apps/mac/Sources/Core/Input/TapBudgetMeter.swift +0 -56
  106. package/apps/mac/Sources/Core/Overlays/AppWindowShell.swift +0 -63
  107. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeState.swift +0 -1566
  108. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeView.swift +0 -1927
  109. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeWindow.swift +0 -196
  110. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteView.swift +0 -307
  111. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +0 -67
  112. package/apps/mac/Sources/Core/Overlays/HUD/CheatSheetHUD.swift +0 -576
  113. package/apps/mac/Sources/Core/Overlays/HUD/HUDBottomBar.swift +0 -279
  114. package/apps/mac/Sources/Core/Overlays/HUD/HUDController.swift +0 -1158
  115. package/apps/mac/Sources/Core/Overlays/HUD/HUDLeftBar.swift +0 -849
  116. package/apps/mac/Sources/Core/Overlays/HUD/HUDMinimap.swift +0 -179
  117. package/apps/mac/Sources/Core/Overlays/HUD/HUDRightBar.swift +0 -596
  118. package/apps/mac/Sources/Core/Overlays/HUD/HUDState.swift +0 -367
  119. package/apps/mac/Sources/Core/Overlays/HUD/HUDTopBar.swift +0 -243
  120. package/apps/mac/Sources/Core/Overlays/HUD/LauncherHUD.swift +0 -334
  121. package/apps/mac/Sources/Core/Overlays/HUD/LayerBezel.swift +0 -203
  122. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchState.swift +0 -280
  123. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchView.swift +0 -422
  124. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchWindow.swift +0 -94
  125. package/apps/mac/Sources/Core/Overlays/OverlayPanelShell.swift +0 -241
  126. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapState.swift +0 -3135
  127. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapView.swift +0 -3977
  128. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapWindowController.swift +0 -119
  129. package/apps/mac/Sources/Core/Overlays/ScreenOverlayCanvasController.swift +0 -1217
  130. package/apps/mac/Sources/Core/Overlays/Voice/VoiceCommandWindow.swift +0 -1575
  131. package/apps/mac/Sources/Core/Pi/PiAuthNextStepCard.swift +0 -148
  132. package/apps/mac/Sources/Core/Pi/PiAuthPromptCard.swift +0 -90
  133. package/apps/mac/Sources/Core/Pi/PiChatDock.swift +0 -564
  134. package/apps/mac/Sources/Core/Pi/PiChatSession.swift +0 -1948
  135. package/apps/mac/Sources/Core/Pi/PiInstallCallout.swift +0 -86
  136. package/apps/mac/Sources/Core/Pi/PiProviderSetupCallout.swift +0 -99
  137. package/apps/mac/Sources/Core/Pi/PiWorkspaceView.swift +0 -510
  138. package/apps/mac/Sources/Core/System/Capability.swift +0 -79
  139. package/apps/mac/Sources/Core/System/DiagnosticLog.swift +0 -373
  140. package/apps/mac/Sources/Core/System/EventBus.swift +0 -31
  141. package/apps/mac/Sources/Core/System/PermissionChecker.swift +0 -224
  142. package/apps/mac/Sources/Core/System/ProcessModel.swift +0 -199
  143. package/apps/mac/Sources/Core/System/ProcessQuery.swift +0 -151
  144. package/apps/mac/Sources/Core/System/SystemTelemetryMonitor.swift +0 -273
  145. package/apps/mac/Sources/Core/Voice/AdvisorLearningStore.swift +0 -90
  146. package/apps/mac/Sources/Core/Voice/AgentSession.swift +0 -377
  147. package/apps/mac/Sources/Core/Voice/AudioProvider.swift +0 -555
  148. package/apps/mac/Sources/Core/Voice/HandsOffSession.swift +0 -839
  149. package/apps/mac/Sources/Core/Voice/VoiceChatView.swift +0 -192
  150. package/apps/mac/Sources/Core/Voice/VoxClient.swift +0 -454
  151. package/apps/mac/Sources/Core/Workspace/Project.swift +0 -28
  152. package/apps/mac/Sources/Core/Workspace/ProjectScanner.swift +0 -141
  153. package/apps/mac/Sources/Core/Workspace/SessionLayerStore.swift +0 -285
  154. package/apps/mac/Sources/Core/Workspace/SessionManager.swift +0 -75
  155. package/apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift +0 -259
  156. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalQuery.swift +0 -156
  157. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalSynthesizer.swift +0 -200
  158. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxModel.swift +0 -60
  159. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxQuery.swift +0 -105
  160. package/apps/mac/Sources/Core/Workspace/WorkspaceManager.swift +0 -1027
  161. package/apps/mac/Sources/UI/ActionRow.swift +0 -78
  162. package/apps/mac/Sources/UI/OrphanRow.swift +0 -129
  163. package/apps/mac/Sources/UI/ProjectRow.swift +0 -368
  164. package/apps/mac/Sources/UI/TabGroupRow.swift +0 -178
  165. package/apps/mac/Sources/UI/Theme.swift +0 -164
  166. package/apps/mac/Tests/StageDragTests.swift +0 -333
  167. package/apps/mac/Tests/StageJoinTests.swift +0 -313
  168. package/apps/mac/Tests/StageManagerTests.swift +0 -280
  169. package/apps/mac/Tests/StageTileTests.swift +0 -353
  170. package/swift/Package.swift +0 -20
  171. package/swift/Sources/DeckKit/DeckAction.swift +0 -51
  172. package/swift/Sources/DeckKit/DeckBridgeSecurity.swift +0 -152
  173. package/swift/Sources/DeckKit/DeckCockpit.swift +0 -82
  174. package/swift/Sources/DeckKit/DeckHost.swift +0 -7
  175. package/swift/Sources/DeckKit/DeckManifest.swift +0 -145
  176. package/swift/Sources/DeckKit/DeckRuntimeSnapshot.swift +0 -533
  177. package/swift/Sources/DeckKit/DeckTrackpad.swift +0 -63
  178. package/swift/Sources/DeckKit/DeckValue.swift +0 -93
  179. package/swift/Sources/DeckKit/DeckVoiceError.swift +0 -88
  180. package/swift/Tests/DeckKitTests/DeckKitTests.swift +0 -286
@@ -1,366 +0,0 @@
1
- import AppKit
2
- import SwiftUI
3
-
4
- /// Calm, opt-in setup surface for capabilities that require an OS permission.
5
- /// Never opens automatically — only from explicit entry points
6
- /// (banner button, onboarding row, Settings, feature gate).
7
- struct PermissionsAssistantView: View {
8
- @ObservedObject private var permChecker = PermissionChecker.shared
9
- @ObservedObject private var prefs = Preferences.shared
10
- @Binding var selected: Capability
11
- var onClose: () -> Void
12
-
13
- var body: some View {
14
- HStack(spacing: 0) {
15
- sidebar
16
- .frame(width: 240, alignment: .top)
17
-
18
- Rectangle()
19
- .fill(Palette.border)
20
- .frame(width: 0.5)
21
- .frame(maxHeight: .infinity)
22
-
23
- detail
24
- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
25
- }
26
- .background(PanelBackground())
27
- .preferredColorScheme(.dark)
28
- }
29
-
30
- // MARK: - Sidebar
31
-
32
- private var sidebar: some View {
33
- VStack(alignment: .leading, spacing: 14) {
34
- VStack(alignment: .leading, spacing: 6) {
35
- Text("CAPABILITIES")
36
- .font(Typo.pixel(14))
37
- .foregroundColor(Palette.textDim)
38
- .tracking(1)
39
- Text("Lattices works with whichever of these you turn on. Nothing here runs unless you press the button.")
40
- .font(Typo.caption(11))
41
- .foregroundColor(Palette.textMuted)
42
- .fixedSize(horizontal: false, vertical: true)
43
- }
44
-
45
- VStack(spacing: 6) {
46
- ForEach(Capability.allCases) { cap in
47
- sidebarRow(cap)
48
- }
49
- }
50
-
51
- Spacer(minLength: 0)
52
- }
53
- .padding(16)
54
- }
55
-
56
- private func sidebarRow(_ cap: Capability) -> some View {
57
- let active = selected == cap
58
- let granted = cap.isGranted
59
-
60
- return Button {
61
- selected = cap
62
- } label: {
63
- HStack(alignment: .top, spacing: 10) {
64
- Image(systemName: cap.iconName)
65
- .font(.system(size: 11, weight: .semibold))
66
- .foregroundColor(active ? Palette.text : Palette.textMuted)
67
- .frame(width: 16, alignment: .center)
68
-
69
- VStack(alignment: .leading, spacing: 3) {
70
- Text(cap.title)
71
- .font(Typo.mono(11))
72
- .foregroundColor(active ? Palette.text : Palette.textMuted)
73
-
74
- Text(cap.requirementLabel)
75
- .font(Typo.caption(9.5))
76
- .foregroundColor(Palette.textMuted.opacity(active ? 0.9 : 0.7))
77
- .lineLimit(2)
78
- }
79
-
80
- Spacer(minLength: 0)
81
-
82
- statusDot(granted: granted)
83
- .padding(.top, 2)
84
- }
85
- .padding(.horizontal, 10)
86
- .padding(.vertical, 8)
87
- .background(
88
- RoundedRectangle(cornerRadius: 5)
89
- .fill(active ? Palette.surfaceHov : Color.clear)
90
- )
91
- }
92
- .buttonStyle(.plain)
93
- }
94
-
95
- private func statusDot(granted: Bool) -> some View {
96
- Circle()
97
- .fill(granted ? Palette.running : Palette.detach)
98
- .frame(width: 6, height: 6)
99
- }
100
-
101
- // MARK: - Detail
102
-
103
- private var detail: some View {
104
- VStack(alignment: .leading, spacing: 0) {
105
- hero(selected)
106
- .padding(.horizontal, 24)
107
- .padding(.top, 22)
108
- .padding(.bottom, 16)
109
-
110
- Rectangle().fill(Palette.border).frame(height: 0.5)
111
-
112
- ScrollView {
113
- VStack(alignment: .leading, spacing: 18) {
114
- valueCard(selected)
115
- statusCard(selected)
116
- actionsCard(selected)
117
-
118
- if prefs.isCapabilityDismissed(selected.rawValue) {
119
- Text("You snoozed this earlier. We will not nag — opening this from a feature will surface it again.")
120
- .font(Typo.caption(10))
121
- .foregroundColor(Palette.textMuted)
122
- .padding(.horizontal, 4)
123
- }
124
- }
125
- .padding(.horizontal, 24)
126
- .padding(.vertical, 18)
127
- }
128
- }
129
- }
130
-
131
- private func hero(_ cap: Capability) -> some View {
132
- HStack(alignment: .center, spacing: 14) {
133
- ZStack {
134
- RoundedRectangle(cornerRadius: 8)
135
- .fill(Palette.surface)
136
- .frame(width: 40, height: 40)
137
- Image(systemName: cap.iconName)
138
- .font(.system(size: 16, weight: .semibold))
139
- .foregroundColor(.white.opacity(0.85))
140
- }
141
-
142
- VStack(alignment: .leading, spacing: 4) {
143
- Text(cap.title)
144
- .font(Typo.heading(14))
145
- .foregroundColor(Palette.text)
146
- Text(cap.requirementLabel)
147
- .font(Typo.mono(10))
148
- .foregroundColor(Palette.textMuted)
149
- }
150
-
151
- Spacer()
152
-
153
- buildChannelBadge
154
- statusBadge(cap)
155
-
156
- Button(action: onClose) {
157
- Image(systemName: "xmark")
158
- .font(.system(size: 10, weight: .bold))
159
- .foregroundColor(Palette.textMuted)
160
- .frame(width: 22, height: 22)
161
- }
162
- .buttonStyle(.plain)
163
- }
164
- }
165
-
166
- private func statusBadge(_ cap: Capability) -> some View {
167
- let granted = cap.isGranted
168
- let label = granted ? "ON" : (prefs.isCapabilityDismissed(cap.rawValue) ? "SNOOZED" : "OFF")
169
- let color: Color = granted ? Palette.running : Palette.detach
170
-
171
- return Text(label)
172
- .font(Typo.monoBold(9))
173
- .foregroundColor(color)
174
- .padding(.horizontal, 6)
175
- .padding(.vertical, 3)
176
- .background(
177
- Capsule().fill(color.opacity(0.12))
178
- )
179
- }
180
-
181
- private var buildChannelBadge: some View {
182
- let tint = LatticesRuntime.isDevBuild ? Palette.detach : Palette.running
183
-
184
- return Text(LatticesRuntime.buildChannelLabel)
185
- .font(Typo.monoBold(9))
186
- .foregroundColor(tint)
187
- .padding(.horizontal, 6)
188
- .padding(.vertical, 3)
189
- .background(
190
- Capsule()
191
- .fill(tint.opacity(0.12))
192
- .overlay(
193
- Capsule()
194
- .strokeBorder(tint.opacity(0.28), lineWidth: 0.5)
195
- )
196
- )
197
- }
198
-
199
- private func valueCard(_ cap: Capability) -> some View {
200
- sectionCard(title: "WHAT YOU GET") {
201
- VStack(alignment: .leading, spacing: 6) {
202
- Text(cap.pitch)
203
- .font(Typo.body(12))
204
- .foregroundColor(Palette.text)
205
- .lineSpacing(3)
206
- Text(cap.why)
207
- .font(Typo.caption(10))
208
- .foregroundColor(Palette.textMuted)
209
- .lineSpacing(2)
210
- }
211
- }
212
- }
213
-
214
- private func statusCard(_ cap: Capability) -> some View {
215
- sectionCard(title: "STATUS") {
216
- HStack(spacing: 8) {
217
- Image(systemName: cap.isGranted ? "checkmark.circle.fill" : "exclamationmark.circle")
218
- .font(.system(size: 12))
219
- .foregroundColor(cap.isGranted ? Palette.running : Palette.detach)
220
- Text(cap.isGranted ? cap.whenGrantedDetail : "Not enabled. Lattices works without it; the rest of the app stays usable.")
221
- .font(Typo.mono(11))
222
- .foregroundColor(Palette.text)
223
- Spacer(minLength: 0)
224
- }
225
- }
226
- }
227
-
228
- private func actionsCard(_ cap: Capability) -> some View {
229
- sectionCard(title: "ACTIONS") {
230
- VStack(alignment: .leading, spacing: 10) {
231
- primaryAction(cap)
232
-
233
- HStack(spacing: 10) {
234
- if !cap.isGranted {
235
- Button {
236
- prefs.dismissCapability(cap.rawValue)
237
- } label: {
238
- Text(prefs.isCapabilityDismissed(cap.rawValue) ? "Snoozed" : "Maybe later")
239
- .font(Typo.monoBold(10))
240
- .foregroundColor(Palette.textMuted)
241
- .padding(.horizontal, 10)
242
- .padding(.vertical, 6)
243
- .background(
244
- RoundedRectangle(cornerRadius: 4)
245
- .fill(Palette.surface)
246
- .overlay(
247
- RoundedRectangle(cornerRadius: 4)
248
- .strokeBorder(Palette.border, lineWidth: 0.5)
249
- )
250
- )
251
- }
252
- .buttonStyle(.plain)
253
- .disabled(prefs.isCapabilityDismissed(cap.rawValue))
254
- }
255
-
256
- Button {
257
- openSystemSettings(cap)
258
- } label: {
259
- HStack(spacing: 4) {
260
- Image(systemName: "arrow.up.forward.app")
261
- .font(.system(size: 9))
262
- Text("Open System Settings")
263
- .font(Typo.monoBold(10))
264
- }
265
- .foregroundColor(Palette.textMuted)
266
- .padding(.horizontal, 10)
267
- .padding(.vertical, 6)
268
- .background(
269
- RoundedRectangle(cornerRadius: 4)
270
- .fill(Palette.surface)
271
- .overlay(
272
- RoundedRectangle(cornerRadius: 4)
273
- .strokeBorder(Palette.border, lineWidth: 0.5)
274
- )
275
- )
276
- }
277
- .buttonStyle(.plain)
278
- }
279
-
280
- Text(actionFootnote(cap))
281
- .font(Typo.caption(9.5))
282
- .foregroundColor(Palette.textMuted)
283
- }
284
- }
285
- }
286
-
287
- @ViewBuilder
288
- private func primaryAction(_ cap: Capability) -> some View {
289
- if cap.isGranted {
290
- HStack(spacing: 6) {
291
- Image(systemName: "checkmark.circle.fill")
292
- .foregroundColor(Palette.running)
293
- Text("Enabled")
294
- .font(Typo.monoBold(11))
295
- .foregroundColor(Palette.running)
296
- }
297
- .padding(.vertical, 4)
298
- } else {
299
- Button {
300
- triggerPrimary(cap)
301
- } label: {
302
- Text(primaryLabel(cap))
303
- .angularButton(.white, filled: false)
304
- }
305
- .buttonStyle(.plain)
306
- }
307
- }
308
-
309
- private func primaryLabel(_ cap: Capability) -> String {
310
- switch cap {
311
- case .windowControl: return "Request Accessibility"
312
- case .screenSearch: return "Enable OCR"
313
- }
314
- }
315
-
316
- private func actionFootnote(_ cap: Capability) -> String {
317
- switch cap {
318
- case .windowControl:
319
- return "macOS will add Lattices to its Accessibility list. You finish the toggle in System Settings."
320
- case .screenSearch:
321
- return "Enabling this turns on OCR and asks macOS for Screen Recording on this Mac."
322
- }
323
- }
324
-
325
- private func triggerPrimary(_ cap: Capability) {
326
- // The primary action is the explicit user gesture — clear any prior snooze.
327
- prefs.clearDismissal(cap.rawValue)
328
-
329
- switch cap {
330
- case .windowControl:
331
- permChecker.requestAccessibility()
332
- case .screenSearch:
333
- // Turning on OCR is the moment we ask for Screen Recording.
334
- OcrModel.shared.setEnabled(true)
335
- }
336
- }
337
-
338
- private func openSystemSettings(_ cap: Capability) {
339
- switch cap {
340
- case .windowControl: permChecker.openAccessibilitySettings()
341
- case .screenSearch: permChecker.openScreenRecordingSettings()
342
- }
343
- }
344
-
345
- // MARK: - Section card
346
-
347
- private func sectionCard<Content: View>(title: String, @ViewBuilder content: () -> Content) -> some View {
348
- VStack(alignment: .leading, spacing: 8) {
349
- Text(title)
350
- .font(Typo.pixel(11))
351
- .foregroundColor(Palette.textDim)
352
- .tracking(1)
353
- content()
354
- .padding(12)
355
- .frame(maxWidth: .infinity, alignment: .leading)
356
- .background(
357
- RoundedRectangle(cornerRadius: 6)
358
- .fill(Palette.surface)
359
- .overlay(
360
- RoundedRectangle(cornerRadius: 6)
361
- .strokeBorder(Palette.border, lineWidth: 0.5)
362
- )
363
- )
364
- }
365
- }
366
- }
@@ -1,70 +0,0 @@
1
- import AppKit
2
- import SwiftUI
3
-
4
- /// Dedicated window that hosts the Permissions Assistant. Singleton, opened
5
- /// only on explicit user intent (banner button, onboarding row, Settings,
6
- /// feature gate). Never shown automatically on app launch.
7
- final class PermissionsAssistantWindowController: ObservableObject {
8
- static let shared = PermissionsAssistantWindowController()
9
-
10
- private var window: NSWindow?
11
- @Published private(set) var focusedCapability: Capability = .windowControl
12
-
13
- var isVisible: Bool { window?.isVisible ?? false }
14
-
15
- /// Open the assistant focused on the given capability. If `cap` is nil,
16
- /// the first missing capability is selected, falling back to `windowControl`.
17
- func show(focus cap: Capability? = nil) {
18
- let target = cap ?? Capability.missing.first ?? .windowControl
19
- focusedCapability = target
20
-
21
- if let existing = window {
22
- existing.makeKeyAndOrderFront(nil)
23
- NSApp.activate(ignoringOtherApps: true)
24
- return
25
- }
26
-
27
- let host = HostView(controller: self)
28
-
29
- let w = AppWindowShell.makeWindow(
30
- config: .init(
31
- title: "Lattices Permissions",
32
- titleVisible: false,
33
- initialSize: NSSize(width: 720, height: 520),
34
- minSize: NSSize(width: 640, height: 460),
35
- maxSize: NSSize(width: 1100, height: 800)
36
- ),
37
- rootView: host
38
- )
39
- AppWindowShell.positionCentered(w)
40
- AppWindowShell.present(w)
41
- self.window = w
42
- }
43
-
44
- func close() {
45
- window?.orderOut(nil)
46
- window = nil
47
- AppDelegate.updateActivationPolicy()
48
- }
49
-
50
- fileprivate func selectionBinding() -> Binding<Capability> {
51
- Binding(
52
- get: { self.focusedCapability },
53
- set: { self.focusedCapability = $0 }
54
- )
55
- }
56
- }
57
-
58
- // SwiftUI host that observes the controller so the assistant updates when
59
- // `focusedCapability` is reassigned by an external caller (e.g. clicking a
60
- // different feature gate while the window is already open).
61
- private struct HostView: View {
62
- @ObservedObject var controller: PermissionsAssistantWindowController
63
-
64
- var body: some View {
65
- PermissionsAssistantView(
66
- selected: controller.selectionBinding(),
67
- onClose: { controller.close() }
68
- )
69
- }
70
- }