@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.
- package/README.md +5 -7
- package/apps/mac/Info.plist +4 -4
- package/apps/mac/Lattices.app/Contents/Info.plist +4 -12
- package/apps/mac/Lattices.app/Contents/MacOS/Lattices +0 -0
- package/bin/lattices-app.ts +110 -17
- package/bin/lattices-build +125 -0
- package/bin/lattices-dev +89 -16
- package/bin/lattices.ts +977 -16
- package/docs/agents.md +81 -4
- package/docs/ai-chat-ux-review.md +416 -0
- package/docs/api.md +135 -3
- package/docs/app.md +30 -8
- package/docs/config.md +4 -0
- package/docs/mouse-gestures.md +60 -1
- package/docs/proposals/LAT-004-interactive-overlay-actors.md +1 -1
- package/docs/proposals/LAT-005-action-runtime-product-spine.md +914 -0
- package/docs/proposals/LAT-006-mira-in-lattices.md +553 -0
- package/docs/proposals/LAT-007-unified-app-shell.md +128 -0
- package/docs/reference/dewey.config.ts +2 -2
- package/docs/release.md +171 -0
- package/docs/repo-structure.md +5 -5
- package/docs/voice.md +11 -27
- package/package.json +11 -10
- package/apps/mac/Package.swift +0 -27
- package/apps/mac/Sources/AppShell/App.swift +0 -26
- package/apps/mac/Sources/AppShell/AppActivationCoordinator.swift +0 -27
- package/apps/mac/Sources/AppShell/AppDelegate.swift +0 -189
- package/apps/mac/Sources/AppShell/AppServicesBootstrap.swift +0 -25
- package/apps/mac/Sources/AppShell/AppShellView.swift +0 -171
- package/apps/mac/Sources/AppShell/AppUpdater.swift +0 -305
- package/apps/mac/Sources/AppShell/CliActionLauncher.swift +0 -50
- package/apps/mac/Sources/AppShell/HomeDashboardView.swift +0 -133
- package/apps/mac/Sources/AppShell/HotkeyBootstrap.swift +0 -87
- package/apps/mac/Sources/AppShell/KeyRecorderView.swift +0 -210
- package/apps/mac/Sources/AppShell/LatticesRuntime.swift +0 -104
- package/apps/mac/Sources/AppShell/MainView.swift +0 -847
- package/apps/mac/Sources/AppShell/MainWindow.swift +0 -83
- package/apps/mac/Sources/AppShell/MenuBarController.swift +0 -177
- package/apps/mac/Sources/AppShell/OnboardingView.swift +0 -483
- package/apps/mac/Sources/AppShell/PermissionsAssistantView.swift +0 -366
- package/apps/mac/Sources/AppShell/PermissionsAssistantWindow.swift +0 -70
- package/apps/mac/Sources/AppShell/Preferences.swift +0 -297
- package/apps/mac/Sources/AppShell/SettingsView.swift +0 -3163
- package/apps/mac/Sources/AppShell/SettingsWindow.swift +0 -34
- package/apps/mac/Sources/AppShell/WorkspaceInspectorPresenter.swift +0 -13
- package/apps/mac/Sources/Core/Actions/HotkeyManager.swift +0 -256
- package/apps/mac/Sources/Core/Actions/HotkeyStore.swift +0 -399
- package/apps/mac/Sources/Core/Actions/IntentEngine.swift +0 -988
- package/apps/mac/Sources/Core/Actions/IntentSchema.swift +0 -94
- package/apps/mac/Sources/Core/Actions/Intents/CreateLayerIntent.swift +0 -54
- package/apps/mac/Sources/Core/Actions/Intents/DistributeIntent.swift +0 -56
- package/apps/mac/Sources/Core/Actions/Intents/FocusIntent.swift +0 -69
- package/apps/mac/Sources/Core/Actions/Intents/HelpIntent.swift +0 -41
- package/apps/mac/Sources/Core/Actions/Intents/KillIntent.swift +0 -47
- package/apps/mac/Sources/Core/Actions/Intents/LatticeIntent.swift +0 -53
- package/apps/mac/Sources/Core/Actions/Intents/LaunchIntent.swift +0 -67
- package/apps/mac/Sources/Core/Actions/Intents/ListSessionsIntent.swift +0 -32
- package/apps/mac/Sources/Core/Actions/Intents/ListWindowsIntent.swift +0 -30
- package/apps/mac/Sources/Core/Actions/Intents/ScanIntent.swift +0 -52
- package/apps/mac/Sources/Core/Actions/Intents/SearchIntent.swift +0 -190
- package/apps/mac/Sources/Core/Actions/Intents/SwitchLayerIntent.swift +0 -50
- package/apps/mac/Sources/Core/Actions/Intents/TileIntent.swift +0 -61
- package/apps/mac/Sources/Core/Actions/PaletteCommand.swift +0 -439
- package/apps/mac/Sources/Core/Actions/VoiceIntentResolver.swift +0 -713
- package/apps/mac/Sources/Core/Companion/CompanionActivityLog.swift +0 -70
- package/apps/mac/Sources/Core/Companion/CompanionKeyboardController.swift +0 -141
- package/apps/mac/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +0 -454
- package/apps/mac/Sources/Core/Companion/LatticesCompanionCockpit.swift +0 -555
- package/apps/mac/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +0 -629
- package/apps/mac/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +0 -204
- package/apps/mac/Sources/Core/Companion/LatticesDeckHost.swift +0 -1463
- package/apps/mac/Sources/Core/Daemon/DaemonProtocol.swift +0 -114
- package/apps/mac/Sources/Core/Daemon/DaemonServer.swift +0 -427
- package/apps/mac/Sources/Core/Daemon/LatticesApi.swift +0 -2965
- package/apps/mac/Sources/Core/Desktop/AccessibilityTextExtractor.swift +0 -111
- package/apps/mac/Sources/Core/Desktop/AppTypeClassifier.swift +0 -106
- package/apps/mac/Sources/Core/Desktop/DesktopModel.swift +0 -331
- package/apps/mac/Sources/Core/Desktop/DesktopModelTypes.swift +0 -73
- package/apps/mac/Sources/Core/Desktop/InventoryManager.swift +0 -35
- package/apps/mac/Sources/Core/Desktop/InventoryPath.swift +0 -43
- package/apps/mac/Sources/Core/Desktop/MouseFinder.swift +0 -527
- package/apps/mac/Sources/Core/Desktop/OcrModel.swift +0 -467
- package/apps/mac/Sources/Core/Desktop/OcrStore.swift +0 -329
- package/apps/mac/Sources/Core/Desktop/PlacementSpec.swift +0 -195
- package/apps/mac/Sources/Core/Desktop/SessionWindowLocator.swift +0 -139
- package/apps/mac/Sources/Core/Desktop/TilePickerView.swift +0 -209
- package/apps/mac/Sources/Core/Desktop/WindowCapture.swift +0 -33
- package/apps/mac/Sources/Core/Desktop/WindowDragSnapController.swift +0 -429
- package/apps/mac/Sources/Core/Desktop/WindowPreviewCard.swift +0 -100
- package/apps/mac/Sources/Core/Desktop/WindowPreviewStore.swift +0 -112
- package/apps/mac/Sources/Core/Desktop/WindowSelectionStore.swift +0 -76
- package/apps/mac/Sources/Core/Desktop/WindowTiler.swift +0 -2222
- package/apps/mac/Sources/Core/Input/EventTapBreaker.swift +0 -124
- package/apps/mac/Sources/Core/Input/EventTapThread.swift +0 -54
- package/apps/mac/Sources/Core/Input/InputCaptureResetCenter.swift +0 -20
- package/apps/mac/Sources/Core/Input/KeyboardRemapConfig.swift +0 -69
- package/apps/mac/Sources/Core/Input/KeyboardRemapController.swift +0 -346
- package/apps/mac/Sources/Core/Input/KeyboardRemapStore.swift +0 -141
- package/apps/mac/Sources/Core/Input/MouseGestureConfig.swift +0 -499
- package/apps/mac/Sources/Core/Input/MouseGestureController.swift +0 -2583
- package/apps/mac/Sources/Core/Input/MouseInputDeviceStore.swift +0 -98
- package/apps/mac/Sources/Core/Input/MouseInputEventViewer.swift +0 -272
- package/apps/mac/Sources/Core/Input/MouseShortcutStore.swift +0 -170
- package/apps/mac/Sources/Core/Input/SecureEventInputMonitor.swift +0 -39
- package/apps/mac/Sources/Core/Input/ShapeRecognizer.swift +0 -624
- package/apps/mac/Sources/Core/Input/TapBudgetMeter.swift +0 -56
- package/apps/mac/Sources/Core/Overlays/AppWindowShell.swift +0 -63
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeState.swift +0 -1566
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeView.swift +0 -1927
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeWindow.swift +0 -196
- package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteView.swift +0 -307
- package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +0 -67
- package/apps/mac/Sources/Core/Overlays/HUD/CheatSheetHUD.swift +0 -576
- package/apps/mac/Sources/Core/Overlays/HUD/HUDBottomBar.swift +0 -279
- package/apps/mac/Sources/Core/Overlays/HUD/HUDController.swift +0 -1158
- package/apps/mac/Sources/Core/Overlays/HUD/HUDLeftBar.swift +0 -849
- package/apps/mac/Sources/Core/Overlays/HUD/HUDMinimap.swift +0 -179
- package/apps/mac/Sources/Core/Overlays/HUD/HUDRightBar.swift +0 -596
- package/apps/mac/Sources/Core/Overlays/HUD/HUDState.swift +0 -367
- package/apps/mac/Sources/Core/Overlays/HUD/HUDTopBar.swift +0 -243
- package/apps/mac/Sources/Core/Overlays/HUD/LauncherHUD.swift +0 -334
- package/apps/mac/Sources/Core/Overlays/HUD/LayerBezel.swift +0 -203
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchState.swift +0 -280
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchView.swift +0 -422
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchWindow.swift +0 -94
- package/apps/mac/Sources/Core/Overlays/OverlayPanelShell.swift +0 -241
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapState.swift +0 -3135
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapView.swift +0 -3977
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapWindowController.swift +0 -119
- package/apps/mac/Sources/Core/Overlays/ScreenOverlayCanvasController.swift +0 -1217
- package/apps/mac/Sources/Core/Overlays/Voice/VoiceCommandWindow.swift +0 -1575
- package/apps/mac/Sources/Core/Pi/PiAuthNextStepCard.swift +0 -148
- package/apps/mac/Sources/Core/Pi/PiAuthPromptCard.swift +0 -90
- package/apps/mac/Sources/Core/Pi/PiChatDock.swift +0 -564
- package/apps/mac/Sources/Core/Pi/PiChatSession.swift +0 -1948
- package/apps/mac/Sources/Core/Pi/PiInstallCallout.swift +0 -86
- package/apps/mac/Sources/Core/Pi/PiProviderSetupCallout.swift +0 -99
- package/apps/mac/Sources/Core/Pi/PiWorkspaceView.swift +0 -510
- package/apps/mac/Sources/Core/System/Capability.swift +0 -79
- package/apps/mac/Sources/Core/System/DiagnosticLog.swift +0 -373
- package/apps/mac/Sources/Core/System/EventBus.swift +0 -31
- package/apps/mac/Sources/Core/System/PermissionChecker.swift +0 -224
- package/apps/mac/Sources/Core/System/ProcessModel.swift +0 -199
- package/apps/mac/Sources/Core/System/ProcessQuery.swift +0 -151
- package/apps/mac/Sources/Core/System/SystemTelemetryMonitor.swift +0 -273
- package/apps/mac/Sources/Core/Voice/AdvisorLearningStore.swift +0 -90
- package/apps/mac/Sources/Core/Voice/AgentSession.swift +0 -377
- package/apps/mac/Sources/Core/Voice/AudioProvider.swift +0 -555
- package/apps/mac/Sources/Core/Voice/HandsOffSession.swift +0 -839
- package/apps/mac/Sources/Core/Voice/VoiceChatView.swift +0 -192
- package/apps/mac/Sources/Core/Voice/VoxClient.swift +0 -454
- package/apps/mac/Sources/Core/Workspace/Project.swift +0 -28
- package/apps/mac/Sources/Core/Workspace/ProjectScanner.swift +0 -141
- package/apps/mac/Sources/Core/Workspace/SessionLayerStore.swift +0 -285
- package/apps/mac/Sources/Core/Workspace/SessionManager.swift +0 -75
- package/apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift +0 -259
- package/apps/mac/Sources/Core/Workspace/Terminal/TerminalQuery.swift +0 -156
- package/apps/mac/Sources/Core/Workspace/Terminal/TerminalSynthesizer.swift +0 -200
- package/apps/mac/Sources/Core/Workspace/Tmux/TmuxModel.swift +0 -60
- package/apps/mac/Sources/Core/Workspace/Tmux/TmuxQuery.swift +0 -105
- package/apps/mac/Sources/Core/Workspace/WorkspaceManager.swift +0 -1027
- package/apps/mac/Sources/UI/ActionRow.swift +0 -78
- package/apps/mac/Sources/UI/OrphanRow.swift +0 -129
- package/apps/mac/Sources/UI/ProjectRow.swift +0 -368
- package/apps/mac/Sources/UI/TabGroupRow.swift +0 -178
- package/apps/mac/Sources/UI/Theme.swift +0 -164
- package/apps/mac/Tests/StageDragTests.swift +0 -333
- package/apps/mac/Tests/StageJoinTests.swift +0 -313
- package/apps/mac/Tests/StageManagerTests.swift +0 -280
- package/apps/mac/Tests/StageTileTests.swift +0 -353
- package/swift/Package.swift +0 -20
- package/swift/Sources/DeckKit/DeckAction.swift +0 -51
- package/swift/Sources/DeckKit/DeckBridgeSecurity.swift +0 -152
- package/swift/Sources/DeckKit/DeckCockpit.swift +0 -82
- package/swift/Sources/DeckKit/DeckHost.swift +0 -7
- package/swift/Sources/DeckKit/DeckManifest.swift +0 -145
- package/swift/Sources/DeckKit/DeckRuntimeSnapshot.swift +0 -533
- package/swift/Sources/DeckKit/DeckTrackpad.swift +0 -63
- package/swift/Sources/DeckKit/DeckValue.swift +0 -93
- package/swift/Sources/DeckKit/DeckVoiceError.swift +0 -88
- package/swift/Tests/DeckKitTests/DeckKitTests.swift +0 -286
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import DeckKit
|
|
2
|
-
import Foundation
|
|
3
|
-
|
|
4
|
-
enum InteractionMode: String {
|
|
5
|
-
case learning = "learning"
|
|
6
|
-
case auto = "auto"
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
class Preferences: ObservableObject {
|
|
10
|
-
static let shared = Preferences()
|
|
11
|
-
|
|
12
|
-
private enum CompanionDefaultsKey {
|
|
13
|
-
static let bridgeEnabled = "companion.bridge.enabled"
|
|
14
|
-
static let trackpadEnabled = "companion.trackpad.enabled"
|
|
15
|
-
static let cockpitLayout = "companion.cockpit.layout"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private static let dismissedCapabilitiesKey = "permissions.dismissed"
|
|
19
|
-
|
|
20
|
-
@Published var terminal: Terminal {
|
|
21
|
-
didSet { UserDefaults.standard.set(terminal.rawValue, forKey: "terminal") }
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Published var scanRoot: String {
|
|
25
|
-
didSet { UserDefaults.standard.set(scanRoot, forKey: "scanRoot") }
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@Published var mode: InteractionMode {
|
|
29
|
-
didSet { UserDefaults.standard.set(mode.rawValue, forKey: "mode") }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@Published var dragSnapEnabled: Bool {
|
|
33
|
-
didSet { UserDefaults.standard.set(dragSnapEnabled, forKey: "windowSnap.enabled") }
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Published var companionBridgeEnabled: Bool {
|
|
37
|
-
didSet {
|
|
38
|
-
UserDefaults.standard.set(companionBridgeEnabled, forKey: CompanionDefaultsKey.bridgeEnabled)
|
|
39
|
-
if companionBridgeEnabled {
|
|
40
|
-
LatticesCompanionBridgeServer.shared.start()
|
|
41
|
-
} else {
|
|
42
|
-
LatticesCompanionBridgeServer.shared.stop()
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@Published var companionTrackpadEnabled: Bool {
|
|
48
|
-
didSet { UserDefaults.standard.set(companionTrackpadEnabled, forKey: CompanionDefaultsKey.trackpadEnabled) }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@Published var companionCockpitLayout: LatticesCompanionCockpitLayout {
|
|
52
|
-
didSet { persistCompanionCockpitLayout() }
|
|
53
|
-
}
|
|
54
|
-
@Published var mouseGesturesEnabled: Bool {
|
|
55
|
-
didSet { UserDefaults.standard.set(mouseGesturesEnabled, forKey: "mouseGestures.enabled") }
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
@Published var keyboardRemapsEnabled: Bool {
|
|
59
|
-
didSet { UserDefaults.standard.set(keyboardRemapsEnabled, forKey: "keyboardRemaps.enabled") }
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// MARK: - AI / Claude
|
|
63
|
-
|
|
64
|
-
@Published var claudePath: String {
|
|
65
|
-
didSet { UserDefaults.standard.set(claudePath, forKey: "claude.path") }
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@Published var advisorModel: String {
|
|
69
|
-
didSet { UserDefaults.standard.set(advisorModel, forKey: "claude.advisorModel") }
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
@Published var advisorBudgetUSD: Double {
|
|
73
|
-
didSet { UserDefaults.standard.set(advisorBudgetUSD, forKey: "claude.advisorBudget") }
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/// Resolve claude CLI path: saved preference → well-known locations → `which`
|
|
77
|
-
static func resolveClaudePath() -> String? {
|
|
78
|
-
let saved = shared.claudePath
|
|
79
|
-
if !saved.isEmpty, FileManager.default.isExecutableFile(atPath: saved) {
|
|
80
|
-
return saved
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
let candidates = [
|
|
84
|
-
"\(NSHomeDirectory())/.local/bin/claude",
|
|
85
|
-
"/usr/local/bin/claude",
|
|
86
|
-
"/opt/homebrew/bin/claude",
|
|
87
|
-
]
|
|
88
|
-
for path in candidates {
|
|
89
|
-
if FileManager.default.isExecutableFile(atPath: path) {
|
|
90
|
-
// Save for next time
|
|
91
|
-
DispatchQueue.main.async { shared.claudePath = path }
|
|
92
|
-
return path
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Last resort: `which claude`
|
|
97
|
-
let proc = Process()
|
|
98
|
-
proc.executableURL = URL(fileURLWithPath: "/bin/sh")
|
|
99
|
-
proc.arguments = ["-c", "which claude 2>/dev/null"]
|
|
100
|
-
let pipe = Pipe()
|
|
101
|
-
proc.standardOutput = pipe
|
|
102
|
-
proc.standardError = FileHandle.nullDevice
|
|
103
|
-
try? proc.run()
|
|
104
|
-
proc.waitUntilExit()
|
|
105
|
-
let output = String(data: pipe.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8)?
|
|
106
|
-
.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
|
107
|
-
if !output.isEmpty, FileManager.default.isExecutableFile(atPath: output) {
|
|
108
|
-
DispatchQueue.main.async { shared.claudePath = output }
|
|
109
|
-
return output
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return nil
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// MARK: - Search & OCR
|
|
116
|
-
|
|
117
|
-
@Published var ocrEnabled: Bool {
|
|
118
|
-
didSet { UserDefaults.standard.set(!ocrEnabled, forKey: "ocr.disabled") }
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
@Published var ocrQuickInterval: Double {
|
|
122
|
-
didSet { UserDefaults.standard.set(ocrQuickInterval, forKey: "ocr.interval") }
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
@Published var ocrDeepInterval: Double {
|
|
126
|
-
didSet { UserDefaults.standard.set(ocrDeepInterval, forKey: "ocr.deepInterval") }
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@Published var ocrQuickLimit: Int {
|
|
130
|
-
didSet { UserDefaults.standard.set(ocrQuickLimit, forKey: "ocr.quickLimit") }
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
@Published var ocrDeepLimit: Int {
|
|
134
|
-
didSet { UserDefaults.standard.set(ocrDeepLimit, forKey: "ocr.deepLimit") }
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
@Published var ocrDeepBudget: Int {
|
|
138
|
-
didSet { UserDefaults.standard.set(ocrDeepBudget, forKey: "ocr.deepBudget") }
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
@Published var ocrAccuracy: String {
|
|
142
|
-
didSet { UserDefaults.standard.set(ocrAccuracy, forKey: "ocr.accuracy") }
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// MARK: - Permissions Assistant
|
|
146
|
-
|
|
147
|
-
/// Capabilities the user has explicitly snoozed. Cleared per-capability when
|
|
148
|
-
/// the user re-enters the relevant feature. Persisted as raw values.
|
|
149
|
-
@Published var dismissedCapabilities: Set<String> {
|
|
150
|
-
didSet {
|
|
151
|
-
UserDefaults.standard.set(Array(dismissedCapabilities), forKey: Self.dismissedCapabilitiesKey)
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
func dismissCapability(_ rawValue: String) {
|
|
156
|
-
dismissedCapabilities.insert(rawValue)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
func clearDismissal(_ rawValue: String) {
|
|
160
|
-
if dismissedCapabilities.contains(rawValue) {
|
|
161
|
-
dismissedCapabilities.remove(rawValue)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
func isCapabilityDismissed(_ rawValue: String) -> Bool {
|
|
166
|
-
dismissedCapabilities.contains(rawValue)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
init() {
|
|
170
|
-
if let saved = UserDefaults.standard.string(forKey: "terminal"),
|
|
171
|
-
let t = Terminal(rawValue: saved), t.isInstalled {
|
|
172
|
-
self.terminal = t
|
|
173
|
-
} else {
|
|
174
|
-
self.terminal = Terminal.installed.first ?? .terminal
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
let savedRoot = UserDefaults.standard.string(forKey: "scanRoot") ?? ""
|
|
178
|
-
if savedRoot.isEmpty {
|
|
179
|
-
// Auto-detect a reasonable default
|
|
180
|
-
let home = NSHomeDirectory()
|
|
181
|
-
let candidates = ["\(home)/dev", "\(home)/Developer", "\(home)/projects", "\(home)/src"]
|
|
182
|
-
self.scanRoot = candidates.first { FileManager.default.fileExists(atPath: $0) } ?? ""
|
|
183
|
-
} else {
|
|
184
|
-
self.scanRoot = savedRoot
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if let saved = UserDefaults.standard.string(forKey: "mode"),
|
|
188
|
-
let m = InteractionMode(rawValue: saved) {
|
|
189
|
-
self.mode = m
|
|
190
|
-
} else {
|
|
191
|
-
self.mode = .learning
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if UserDefaults.standard.object(forKey: "windowSnap.enabled") != nil {
|
|
195
|
-
self.dragSnapEnabled = UserDefaults.standard.bool(forKey: "windowSnap.enabled")
|
|
196
|
-
} else {
|
|
197
|
-
self.dragSnapEnabled = true
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if UserDefaults.standard.object(forKey: CompanionDefaultsKey.bridgeEnabled) != nil {
|
|
201
|
-
self.companionBridgeEnabled = UserDefaults.standard.bool(forKey: CompanionDefaultsKey.bridgeEnabled)
|
|
202
|
-
} else {
|
|
203
|
-
self.companionBridgeEnabled = false
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if UserDefaults.standard.object(forKey: CompanionDefaultsKey.trackpadEnabled) != nil {
|
|
207
|
-
self.companionTrackpadEnabled = UserDefaults.standard.bool(forKey: CompanionDefaultsKey.trackpadEnabled)
|
|
208
|
-
} else {
|
|
209
|
-
self.companionTrackpadEnabled = false
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
self.companionCockpitLayout = Self.loadCompanionCockpitLayout()
|
|
213
|
-
if UserDefaults.standard.object(forKey: "mouseGestures.enabled") != nil {
|
|
214
|
-
self.mouseGesturesEnabled = UserDefaults.standard.bool(forKey: "mouseGestures.enabled")
|
|
215
|
-
} else {
|
|
216
|
-
self.mouseGesturesEnabled = false
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if UserDefaults.standard.object(forKey: "keyboardRemaps.enabled") != nil {
|
|
220
|
-
self.keyboardRemapsEnabled = UserDefaults.standard.bool(forKey: "keyboardRemaps.enabled")
|
|
221
|
-
} else {
|
|
222
|
-
self.keyboardRemapsEnabled = true
|
|
223
|
-
}
|
|
224
|
-
// AI / Claude
|
|
225
|
-
self.claudePath = UserDefaults.standard.string(forKey: "claude.path") ?? ""
|
|
226
|
-
self.advisorModel = UserDefaults.standard.string(forKey: "claude.advisorModel") ?? "haiku"
|
|
227
|
-
let savedBudgetUSD = UserDefaults.standard.double(forKey: "claude.advisorBudget")
|
|
228
|
-
self.advisorBudgetUSD = savedBudgetUSD > 0 ? savedBudgetUSD : 0.50
|
|
229
|
-
|
|
230
|
-
// Search & OCR. Default off until the user explicitly enables it from
|
|
231
|
-
// the Permissions Assistant or Search settings. Honors any explicit
|
|
232
|
-
// ocr.disabled value already saved (true=off, false=on).
|
|
233
|
-
if UserDefaults.standard.object(forKey: "ocr.disabled") != nil {
|
|
234
|
-
self.ocrEnabled = !UserDefaults.standard.bool(forKey: "ocr.disabled")
|
|
235
|
-
} else {
|
|
236
|
-
self.ocrEnabled = false
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
let savedInterval = UserDefaults.standard.double(forKey: "ocr.interval")
|
|
240
|
-
self.ocrQuickInterval = savedInterval > 0 ? savedInterval : 60
|
|
241
|
-
|
|
242
|
-
let savedDeep = UserDefaults.standard.double(forKey: "ocr.deepInterval")
|
|
243
|
-
self.ocrDeepInterval = savedDeep > 0 ? savedDeep : 7200
|
|
244
|
-
|
|
245
|
-
let savedQL = UserDefaults.standard.integer(forKey: "ocr.quickLimit")
|
|
246
|
-
self.ocrQuickLimit = savedQL > 0 ? savedQL : 5
|
|
247
|
-
|
|
248
|
-
let savedDL = UserDefaults.standard.integer(forKey: "ocr.deepLimit")
|
|
249
|
-
self.ocrDeepLimit = savedDL > 0 ? savedDL : 15
|
|
250
|
-
|
|
251
|
-
let savedBudget = UserDefaults.standard.integer(forKey: "ocr.deepBudget")
|
|
252
|
-
self.ocrDeepBudget = savedBudget > 0 ? savedBudget : 3
|
|
253
|
-
|
|
254
|
-
let savedAcc = UserDefaults.standard.string(forKey: "ocr.accuracy") ?? "accurate"
|
|
255
|
-
self.ocrAccuracy = savedAcc
|
|
256
|
-
|
|
257
|
-
let dismissed = UserDefaults.standard.stringArray(forKey: Self.dismissedCapabilitiesKey) ?? []
|
|
258
|
-
self.dismissedCapabilities = Set(dismissed)
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
func updateCompanionCockpitSlot(
|
|
262
|
-
pageID: String,
|
|
263
|
-
index: Int,
|
|
264
|
-
shortcutID: String
|
|
265
|
-
) {
|
|
266
|
-
var normalized = LatticesCompanionCockpitCatalog.normalized(companionCockpitLayout)
|
|
267
|
-
guard let pageIndex = normalized.pages.firstIndex(where: { $0.id == pageID }),
|
|
268
|
-
normalized.pages[pageIndex].slotIDs.indices.contains(index) else {
|
|
269
|
-
return
|
|
270
|
-
}
|
|
271
|
-
normalized.pages[pageIndex].slotIDs[index] = shortcutID
|
|
272
|
-
companionCockpitLayout = normalized
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
func resetCompanionCockpitLayout() {
|
|
276
|
-
companionCockpitLayout = LatticesCompanionCockpitCatalog.defaultLayout
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
private static func loadCompanionCockpitLayout() -> LatticesCompanionCockpitLayout {
|
|
280
|
-
guard let data = UserDefaults.standard.data(forKey: CompanionDefaultsKey.cockpitLayout),
|
|
281
|
-
let decoded = try? JSONDecoder().decode(LatticesCompanionCockpitLayout.self, from: data) else {
|
|
282
|
-
return LatticesCompanionCockpitCatalog.defaultLayout
|
|
283
|
-
}
|
|
284
|
-
return LatticesCompanionCockpitCatalog.normalized(decoded)
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
private func persistCompanionCockpitLayout() {
|
|
288
|
-
let normalized = LatticesCompanionCockpitCatalog.normalized(companionCockpitLayout)
|
|
289
|
-
if normalized != companionCockpitLayout {
|
|
290
|
-
companionCockpitLayout = normalized
|
|
291
|
-
return
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
guard let data = try? JSONEncoder().encode(normalized) else { return }
|
|
295
|
-
UserDefaults.standard.set(data, forKey: CompanionDefaultsKey.cockpitLayout)
|
|
296
|
-
}
|
|
297
|
-
}
|