@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.
- package/README.md +5 -7
- package/apps/mac/Info.plist +2 -2
- 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/reference/dewey.config.ts +2 -2
- package/docs/release.md +171 -0
- package/docs/repo-structure.md +4 -5
- package/docs/voice.md +11 -27
- package/package.json +9 -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,596 +0,0 @@
|
|
|
1
|
-
import AppKit
|
|
2
|
-
import SwiftUI
|
|
3
|
-
|
|
4
|
-
// MARK: - HUDRightBar (inspector + conversation)
|
|
5
|
-
|
|
6
|
-
struct HUDRightBar: View {
|
|
7
|
-
@ObservedObject var state: HUDState
|
|
8
|
-
@ObservedObject private var handsOff = HandsOffSession.shared
|
|
9
|
-
@ObservedObject private var desktop = DesktopModel.shared
|
|
10
|
-
@ObservedObject private var previewModel = WindowPreviewStore.shared
|
|
11
|
-
var onDismiss: () -> Void
|
|
12
|
-
|
|
13
|
-
var body: some View {
|
|
14
|
-
VStack(spacing: 0) {
|
|
15
|
-
// Top half: inspector
|
|
16
|
-
inspectorPane
|
|
17
|
-
.frame(maxHeight: .infinity)
|
|
18
|
-
|
|
19
|
-
Rectangle().fill(Palette.border).frame(height: 0.5)
|
|
20
|
-
|
|
21
|
-
// Bottom half: conversation
|
|
22
|
-
conversationPane
|
|
23
|
-
.frame(maxHeight: .infinity)
|
|
24
|
-
}
|
|
25
|
-
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
26
|
-
.background(Palette.bg)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
30
|
-
// MARK: - Inspector (top half)
|
|
31
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
32
|
-
|
|
33
|
-
@ViewBuilder
|
|
34
|
-
private var inspectorPane: some View {
|
|
35
|
-
if let item = state.pinnedItem {
|
|
36
|
-
detailView(for: item)
|
|
37
|
-
} else {
|
|
38
|
-
inspectorEmpty
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private var inspectorEmpty: some View {
|
|
43
|
-
VStack(spacing: 6) {
|
|
44
|
-
Spacer()
|
|
45
|
-
Image(systemName: "sidebar.right")
|
|
46
|
-
.font(.system(size: 22))
|
|
47
|
-
.foregroundColor(Palette.textMuted.opacity(0.3))
|
|
48
|
-
Text("Select an item")
|
|
49
|
-
.font(Typo.mono(11))
|
|
50
|
-
.foregroundColor(Palette.textMuted)
|
|
51
|
-
Spacer()
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@ViewBuilder
|
|
56
|
-
private func detailView(for item: HUDItem) -> some View {
|
|
57
|
-
switch item {
|
|
58
|
-
case .project(let p): projectDetail(p)
|
|
59
|
-
case .window(let w): windowDetail(w)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private func projectDetail(_ project: Project) -> some View {
|
|
64
|
-
VStack(alignment: .leading, spacing: 0) {
|
|
65
|
-
HStack(spacing: 8) {
|
|
66
|
-
Circle()
|
|
67
|
-
.fill(project.isRunning ? Palette.running : Palette.textMuted.opacity(0.3))
|
|
68
|
-
.frame(width: 8, height: 8)
|
|
69
|
-
Text(project.name)
|
|
70
|
-
.font(Typo.monoBold(13))
|
|
71
|
-
.foregroundColor(Palette.text)
|
|
72
|
-
Spacer()
|
|
73
|
-
if project.isRunning {
|
|
74
|
-
Text("running")
|
|
75
|
-
.font(Typo.mono(9))
|
|
76
|
-
.foregroundColor(Palette.running)
|
|
77
|
-
.padding(.horizontal, 5)
|
|
78
|
-
.padding(.vertical, 2)
|
|
79
|
-
.background(RoundedRectangle(cornerRadius: 3).fill(Palette.running.opacity(0.10)))
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
.padding(.horizontal, 16)
|
|
83
|
-
.padding(.vertical, 10)
|
|
84
|
-
|
|
85
|
-
if let previewWindow = projectPreviewWindow(project) {
|
|
86
|
-
previewSection(for: previewWindow, title: "Window Preview")
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
Rectangle().fill(Palette.border).frame(height: 0.5)
|
|
90
|
-
|
|
91
|
-
ScrollView {
|
|
92
|
-
VStack(alignment: .leading, spacing: 8) {
|
|
93
|
-
metaRow("Path", value: project.path)
|
|
94
|
-
metaRow("Session", value: project.sessionName)
|
|
95
|
-
if !project.paneSummary.isEmpty { metaRow("Summary", value: project.paneSummary) }
|
|
96
|
-
if let dev = project.devCommand { metaRow("Dev", value: dev) }
|
|
97
|
-
}
|
|
98
|
-
.padding(.horizontal, 16)
|
|
99
|
-
.padding(.vertical, 10)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
HStack(spacing: 8) {
|
|
103
|
-
actionButton(project.isRunning ? "Focus" : "Launch",
|
|
104
|
-
icon: project.isRunning ? "eye" : "play.fill") {
|
|
105
|
-
SessionManager.launch(project: project)
|
|
106
|
-
HandsOffSession.shared.playCachedCue(project.isRunning ? "Focused." : "Done.")
|
|
107
|
-
onDismiss()
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
.padding(.horizontal, 16)
|
|
111
|
-
.padding(.bottom, 10)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private func windowDetail(_ window: WindowEntry) -> some View {
|
|
116
|
-
VStack(alignment: .leading, spacing: 0) {
|
|
117
|
-
VStack(alignment: .leading, spacing: 3) {
|
|
118
|
-
Text(window.title)
|
|
119
|
-
.font(Typo.monoBold(12))
|
|
120
|
-
.foregroundColor(Palette.text)
|
|
121
|
-
.lineLimit(1)
|
|
122
|
-
Text(window.app)
|
|
123
|
-
.font(Typo.mono(10))
|
|
124
|
-
.foregroundColor(Palette.textMuted)
|
|
125
|
-
}
|
|
126
|
-
.padding(.horizontal, 16)
|
|
127
|
-
.padding(.vertical, 10)
|
|
128
|
-
|
|
129
|
-
previewSection(for: window, title: "Live Preview")
|
|
130
|
-
|
|
131
|
-
Rectangle().fill(Palette.border).frame(height: 0.5)
|
|
132
|
-
|
|
133
|
-
ScrollView {
|
|
134
|
-
VStack(alignment: .leading, spacing: 8) {
|
|
135
|
-
metaRow("WID", value: "\(window.wid)")
|
|
136
|
-
metaRow("Frame", value: "\(Int(window.frame.x)),\(Int(window.frame.y)) \(Int(window.frame.w))×\(Int(window.frame.h))")
|
|
137
|
-
if let lastUsed = desktop.lastInteractionDate(for: window.wid) {
|
|
138
|
-
metaRow("Last used", value: relativeTime(lastUsed))
|
|
139
|
-
}
|
|
140
|
-
if let session = window.latticesSession { metaRow("Session", value: session) }
|
|
141
|
-
}
|
|
142
|
-
.padding(.horizontal, 16)
|
|
143
|
-
.padding(.vertical, 10)
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
HStack(spacing: 8) {
|
|
147
|
-
actionButton("Focus", icon: "eye") {
|
|
148
|
-
_ = WindowTiler.focusWindow(wid: window.wid, pid: window.pid)
|
|
149
|
-
HandsOffSession.shared.playCachedCue("Focused.")
|
|
150
|
-
onDismiss()
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
.padding(.horizontal, 16)
|
|
154
|
-
.padding(.bottom, 10)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
@ViewBuilder
|
|
159
|
-
private func previewSection(for window: WindowEntry, title: String) -> some View {
|
|
160
|
-
VStack(alignment: .leading, spacing: 10) {
|
|
161
|
-
HStack(spacing: 8) {
|
|
162
|
-
Text(title)
|
|
163
|
-
.font(Typo.monoBold(10))
|
|
164
|
-
.foregroundColor(Palette.textMuted)
|
|
165
|
-
Spacer()
|
|
166
|
-
Text("no focus")
|
|
167
|
-
.font(Typo.mono(9))
|
|
168
|
-
.foregroundColor(Palette.textDim)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
WindowPreviewCard(
|
|
172
|
-
image: previewModel.image(for: window.wid),
|
|
173
|
-
isLoading: previewModel.isLoading(window.wid),
|
|
174
|
-
appName: window.app
|
|
175
|
-
)
|
|
176
|
-
.frame(maxWidth: .infinity)
|
|
177
|
-
.frame(height: 190)
|
|
178
|
-
.clipped()
|
|
179
|
-
}
|
|
180
|
-
.padding(.horizontal, 16)
|
|
181
|
-
.padding(.vertical, 12)
|
|
182
|
-
.task(id: window.wid) {
|
|
183
|
-
previewModel.load(window: window)
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
private func projectPreviewWindow(_ project: Project) -> WindowEntry? {
|
|
188
|
-
guard project.isRunning else { return nil }
|
|
189
|
-
return desktop.windowForSession(project.sessionName)
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
193
|
-
// MARK: - Conversation (bottom half)
|
|
194
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
195
|
-
|
|
196
|
-
private var conversationPane: some View {
|
|
197
|
-
VStack(spacing: 0) {
|
|
198
|
-
// Header with voice state
|
|
199
|
-
conversationHeader
|
|
200
|
-
|
|
201
|
-
Rectangle().fill(Palette.border).frame(height: 0.5)
|
|
202
|
-
|
|
203
|
-
// Messages
|
|
204
|
-
if handsOff.conversationHistory.isEmpty {
|
|
205
|
-
conversationEmpty
|
|
206
|
-
} else {
|
|
207
|
-
conversationMessages
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
private var conversationHeader: some View {
|
|
213
|
-
HStack(spacing: 8) {
|
|
214
|
-
// Voice indicator
|
|
215
|
-
voiceIndicator
|
|
216
|
-
|
|
217
|
-
Text("Voice")
|
|
218
|
-
.font(Typo.monoBold(11))
|
|
219
|
-
.foregroundColor(Palette.text)
|
|
220
|
-
|
|
221
|
-
Spacer()
|
|
222
|
-
|
|
223
|
-
// State badge
|
|
224
|
-
if state.voiceActive {
|
|
225
|
-
stateBadge
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// V toggle hint
|
|
229
|
-
Text("V")
|
|
230
|
-
.font(Typo.geistMonoBold(9))
|
|
231
|
-
.foregroundColor(state.voiceActive ? Palette.text : Palette.textMuted)
|
|
232
|
-
.frame(width: 18, height: 18)
|
|
233
|
-
.background(
|
|
234
|
-
RoundedRectangle(cornerRadius: 3)
|
|
235
|
-
.fill(state.voiceActive ? Palette.running.opacity(0.2) : Palette.surface)
|
|
236
|
-
.overlay(
|
|
237
|
-
RoundedRectangle(cornerRadius: 3)
|
|
238
|
-
.strokeBorder(state.voiceActive ? Palette.running.opacity(0.4) : Palette.border, lineWidth: 0.5)
|
|
239
|
-
)
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
.padding(.horizontal, 14)
|
|
243
|
-
.padding(.vertical, 8)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
private var voiceIndicator: some View {
|
|
247
|
-
Circle()
|
|
248
|
-
.fill(voiceColor)
|
|
249
|
-
.frame(width: 8, height: 8)
|
|
250
|
-
.overlay(
|
|
251
|
-
// Pulse animation when listening
|
|
252
|
-
Circle()
|
|
253
|
-
.stroke(voiceColor.opacity(0.4), lineWidth: 1.5)
|
|
254
|
-
.scaleEffect(handsOff.state == .listening ? 1.8 : 1.0)
|
|
255
|
-
.opacity(handsOff.state == .listening ? 0 : 1)
|
|
256
|
-
.animation(
|
|
257
|
-
handsOff.state == .listening
|
|
258
|
-
? .easeOut(duration: 1.0).repeatForever(autoreverses: false)
|
|
259
|
-
: .default,
|
|
260
|
-
value: handsOff.state
|
|
261
|
-
)
|
|
262
|
-
)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
private var voiceColor: Color {
|
|
266
|
-
switch handsOff.state {
|
|
267
|
-
case .idle: return state.voiceActive ? Palette.running : Palette.textMuted.opacity(0.3)
|
|
268
|
-
case .connecting: return Palette.detach
|
|
269
|
-
case .listening: return Palette.running
|
|
270
|
-
case .thinking: return Palette.detach
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
private var stateBadge: some View {
|
|
275
|
-
let label: String = {
|
|
276
|
-
switch handsOff.state {
|
|
277
|
-
case .idle: return "ready"
|
|
278
|
-
case .connecting: return "connecting"
|
|
279
|
-
case .listening: return "listening"
|
|
280
|
-
case .thinking: return "thinking"
|
|
281
|
-
}
|
|
282
|
-
}()
|
|
283
|
-
|
|
284
|
-
return Text(label)
|
|
285
|
-
.font(Typo.mono(9))
|
|
286
|
-
.foregroundColor(voiceColor)
|
|
287
|
-
.padding(.horizontal, 6)
|
|
288
|
-
.padding(.vertical, 2)
|
|
289
|
-
.background(
|
|
290
|
-
RoundedRectangle(cornerRadius: 3)
|
|
291
|
-
.fill(voiceColor.opacity(0.10))
|
|
292
|
-
)
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
private var conversationEmpty: some View {
|
|
296
|
-
VStack(spacing: 6) {
|
|
297
|
-
Spacer()
|
|
298
|
-
Image(systemName: "waveform")
|
|
299
|
-
.font(.system(size: 20))
|
|
300
|
-
.foregroundColor(Palette.textMuted.opacity(0.3))
|
|
301
|
-
Text(state.voiceActive ? "Listening..." : "Press V to talk")
|
|
302
|
-
.font(Typo.mono(11))
|
|
303
|
-
.foregroundColor(Palette.textMuted)
|
|
304
|
-
Spacer()
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
private var conversationMessages: some View {
|
|
309
|
-
ScrollViewReader { proxy in
|
|
310
|
-
ScrollView {
|
|
311
|
-
LazyVStack(alignment: .leading, spacing: 6) {
|
|
312
|
-
ForEach(Array(handsOff.conversationHistory.enumerated()), id: \.offset) { index, msg in
|
|
313
|
-
messageBubble(msg, index: index)
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
.padding(.horizontal, 12)
|
|
317
|
-
.padding(.vertical, 8)
|
|
318
|
-
}
|
|
319
|
-
.onChange(of: handsOff.conversationHistory.count) { _ in
|
|
320
|
-
// Auto-scroll to bottom
|
|
321
|
-
if let last = handsOff.conversationHistory.indices.last {
|
|
322
|
-
proxy.scrollTo(last, anchor: .bottom)
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
private func messageBubble(_ msg: [String: String], index: Int) -> some View {
|
|
329
|
-
let role = msg["role"] ?? "unknown"
|
|
330
|
-
let content = msg["content"] ?? ""
|
|
331
|
-
let isUser = role == "user"
|
|
332
|
-
|
|
333
|
-
return HStack {
|
|
334
|
-
if isUser { Spacer(minLength: 40) }
|
|
335
|
-
|
|
336
|
-
VStack(alignment: isUser ? .trailing : .leading, spacing: 2) {
|
|
337
|
-
Text(isUser ? "you" : "lattices")
|
|
338
|
-
.font(Typo.monoBold(8))
|
|
339
|
-
.foregroundColor(Palette.textMuted)
|
|
340
|
-
.textCase(.uppercase)
|
|
341
|
-
|
|
342
|
-
Text(content)
|
|
343
|
-
.font(Typo.mono(11))
|
|
344
|
-
.foregroundColor(Palette.text)
|
|
345
|
-
.padding(.horizontal, 10)
|
|
346
|
-
.padding(.vertical, 6)
|
|
347
|
-
.background(
|
|
348
|
-
RoundedRectangle(cornerRadius: 8)
|
|
349
|
-
.fill(isUser ? Palette.surfaceHov : Palette.surface)
|
|
350
|
-
)
|
|
351
|
-
.textSelection(.enabled)
|
|
352
|
-
}
|
|
353
|
-
.id(index)
|
|
354
|
-
|
|
355
|
-
if !isUser { Spacer(minLength: 40) }
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
360
|
-
// MARK: - Shared helpers
|
|
361
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
362
|
-
|
|
363
|
-
private func metaRow(_ label: String, value: String) -> some View {
|
|
364
|
-
VStack(alignment: .leading, spacing: 2) {
|
|
365
|
-
Text(label)
|
|
366
|
-
.font(Typo.monoBold(9))
|
|
367
|
-
.foregroundColor(Palette.textMuted)
|
|
368
|
-
.textCase(.uppercase)
|
|
369
|
-
Text(value)
|
|
370
|
-
.font(Typo.mono(11))
|
|
371
|
-
.foregroundColor(Palette.text)
|
|
372
|
-
.textSelection(.enabled)
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
private func actionButton(_ title: String, icon: String, action: @escaping () -> Void) -> some View {
|
|
377
|
-
Button(action: action) {
|
|
378
|
-
HStack(spacing: 5) {
|
|
379
|
-
Image(systemName: icon)
|
|
380
|
-
.font(.system(size: 10))
|
|
381
|
-
Text(title)
|
|
382
|
-
.font(Typo.monoBold(10))
|
|
383
|
-
}
|
|
384
|
-
.foregroundColor(Palette.text)
|
|
385
|
-
.padding(.horizontal, 12)
|
|
386
|
-
.padding(.vertical, 6)
|
|
387
|
-
.background(
|
|
388
|
-
RoundedRectangle(cornerRadius: 5)
|
|
389
|
-
.fill(Palette.surface)
|
|
390
|
-
.overlay(
|
|
391
|
-
RoundedRectangle(cornerRadius: 5)
|
|
392
|
-
.strokeBorder(Palette.border, lineWidth: 0.5)
|
|
393
|
-
)
|
|
394
|
-
)
|
|
395
|
-
}
|
|
396
|
-
.buttonStyle(.plain)
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
private func relativeTime(_ date: Date) -> String {
|
|
400
|
-
let seconds = max(0, Int(Date().timeIntervalSince(date)))
|
|
401
|
-
if seconds < 60 { return "\(seconds)s ago" }
|
|
402
|
-
if seconds < 3600 { return "\(seconds / 60)m ago" }
|
|
403
|
-
if seconds < 86_400 { return "\(seconds / 3600)h ago" }
|
|
404
|
-
return "\(seconds / 86_400)d ago"
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
struct HUDHoverPreviewView: View {
|
|
409
|
-
@ObservedObject var state: HUDState
|
|
410
|
-
@ObservedObject private var previewModel = WindowPreviewStore.shared
|
|
411
|
-
@ObservedObject private var desktop = DesktopModel.shared
|
|
412
|
-
@State private var renderedWindow: WindowEntry?
|
|
413
|
-
@State private var renderedWindowID: UInt32?
|
|
414
|
-
@State private var renderedImage: NSImage?
|
|
415
|
-
|
|
416
|
-
private var activeWindow: WindowEntry? {
|
|
417
|
-
guard let item = state.transientPreviewItem else { return nil }
|
|
418
|
-
return previewWindow(for: item)
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
private var previewToken: String {
|
|
422
|
-
guard let window = activeWindow else { return "none" }
|
|
423
|
-
return "\(window.wid)-\(previewModel.image(for: window.wid) != nil)"
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
var body: some View {
|
|
427
|
-
Group {
|
|
428
|
-
if let window = renderedWindow ?? activeWindow {
|
|
429
|
-
Button {
|
|
430
|
-
state.pinInspectorCandidate(source: "preview")
|
|
431
|
-
} label: {
|
|
432
|
-
VStack(alignment: .leading, spacing: 10) {
|
|
433
|
-
HStack(spacing: 8) {
|
|
434
|
-
VStack(alignment: .leading, spacing: 2) {
|
|
435
|
-
Text(window.title)
|
|
436
|
-
.font(Typo.monoBold(12))
|
|
437
|
-
.foregroundColor(Palette.text)
|
|
438
|
-
.lineLimit(1)
|
|
439
|
-
Text(window.app)
|
|
440
|
-
.font(Typo.mono(10))
|
|
441
|
-
.foregroundColor(Palette.textMuted)
|
|
442
|
-
.lineLimit(1)
|
|
443
|
-
}
|
|
444
|
-
Spacer()
|
|
445
|
-
Text("inspect")
|
|
446
|
-
.font(Typo.mono(9))
|
|
447
|
-
.foregroundColor(Palette.textDim)
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
ZStack {
|
|
451
|
-
WindowPreviewCard(
|
|
452
|
-
image: renderedImage,
|
|
453
|
-
isLoading: previewModel.isLoading(window.wid),
|
|
454
|
-
appName: window.app,
|
|
455
|
-
style: WindowPreviewCardStyle(
|
|
456
|
-
containerCornerRadius: 12,
|
|
457
|
-
imageCornerRadius: 9,
|
|
458
|
-
imagePadding: 10,
|
|
459
|
-
background: Palette.bg.opacity(0.96),
|
|
460
|
-
border: Palette.border
|
|
461
|
-
),
|
|
462
|
-
holdingPreviousPreview: isHoldingPreviousPreview(for: window)
|
|
463
|
-
) {
|
|
464
|
-
if isHoldingPreviousPreview(for: window) {
|
|
465
|
-
loadingOverlay(label: "Loading next preview")
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
.id(renderedWindowID ?? window.wid)
|
|
469
|
-
.transition(.opacity)
|
|
470
|
-
}
|
|
471
|
-
.frame(height: 190)
|
|
472
|
-
}
|
|
473
|
-
.padding(14)
|
|
474
|
-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
|
|
475
|
-
.background(
|
|
476
|
-
UnevenRoundedRectangle(
|
|
477
|
-
cornerRadii: .init(
|
|
478
|
-
topLeading: 6,
|
|
479
|
-
bottomLeading: 6,
|
|
480
|
-
bottomTrailing: 16,
|
|
481
|
-
topTrailing: 16
|
|
482
|
-
),
|
|
483
|
-
style: .continuous
|
|
484
|
-
)
|
|
485
|
-
.fill(Palette.bg.opacity(0.94))
|
|
486
|
-
.overlay(
|
|
487
|
-
UnevenRoundedRectangle(
|
|
488
|
-
cornerRadii: .init(
|
|
489
|
-
topLeading: 6,
|
|
490
|
-
bottomLeading: 6,
|
|
491
|
-
bottomTrailing: 16,
|
|
492
|
-
topTrailing: 16
|
|
493
|
-
),
|
|
494
|
-
style: .continuous
|
|
495
|
-
)
|
|
496
|
-
.strokeBorder(Palette.border, lineWidth: 0.5)
|
|
497
|
-
)
|
|
498
|
-
)
|
|
499
|
-
.contentShape(Rectangle())
|
|
500
|
-
}
|
|
501
|
-
.buttonStyle(.plain)
|
|
502
|
-
.shadow(color: Color.black.opacity(0.22), radius: 18, x: 0, y: 10)
|
|
503
|
-
.onHover { isHovering in
|
|
504
|
-
state.previewInteractionActive = isHovering
|
|
505
|
-
guard !isHovering else { return }
|
|
506
|
-
let hoveredItemID = state.hoveredPreviewItem?.id
|
|
507
|
-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.12) {
|
|
508
|
-
guard hoveredItemID == self.state.hoveredPreviewItem?.id,
|
|
509
|
-
!self.state.previewInteractionActive else { return }
|
|
510
|
-
self.state.hoveredPreviewItem = nil
|
|
511
|
-
self.state.hoverPreviewAnchorScreenY = nil
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
} else {
|
|
515
|
-
Color.clear
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
519
|
-
.background(Color.clear)
|
|
520
|
-
.onAppear {
|
|
521
|
-
syncRenderedPreview(animated: false)
|
|
522
|
-
}
|
|
523
|
-
.onChange(of: state.transientPreviewItem?.id) { _ in
|
|
524
|
-
syncRenderedPreview(animated: true)
|
|
525
|
-
}
|
|
526
|
-
.onChange(of: previewToken) { _ in
|
|
527
|
-
syncRenderedPreview(animated: true)
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
private func previewWindow(for item: HUDItem) -> WindowEntry? {
|
|
532
|
-
switch item {
|
|
533
|
-
case .window(let window):
|
|
534
|
-
return window
|
|
535
|
-
case .project(let project):
|
|
536
|
-
guard project.isRunning else { return nil }
|
|
537
|
-
return desktop.windowForSession(project.sessionName)
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
private func loadingOverlay(label: String) -> some View {
|
|
542
|
-
VStack {
|
|
543
|
-
Spacer()
|
|
544
|
-
HStack {
|
|
545
|
-
Spacer()
|
|
546
|
-
HStack(spacing: 6) {
|
|
547
|
-
Image(systemName: "sparkles")
|
|
548
|
-
.font(.system(size: 9, weight: .medium))
|
|
549
|
-
.foregroundColor(Palette.text)
|
|
550
|
-
Text(label)
|
|
551
|
-
.font(Typo.mono(9))
|
|
552
|
-
.foregroundColor(Palette.text)
|
|
553
|
-
}
|
|
554
|
-
.padding(.horizontal, 10)
|
|
555
|
-
.padding(.vertical, 6)
|
|
556
|
-
.background(
|
|
557
|
-
Capsule()
|
|
558
|
-
.fill(Palette.bg.opacity(0.88))
|
|
559
|
-
.overlay(
|
|
560
|
-
Capsule()
|
|
561
|
-
.strokeBorder(Palette.border, lineWidth: 0.5)
|
|
562
|
-
)
|
|
563
|
-
)
|
|
564
|
-
.padding(14)
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
private func isHoldingPreviousPreview(for window: WindowEntry) -> Bool {
|
|
570
|
-
guard let renderedWindowID else { return false }
|
|
571
|
-
return renderedWindowID != window.wid && previewModel.image(for: window.wid) == nil
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
private func syncRenderedPreview(animated: Bool) {
|
|
575
|
-
guard let window = activeWindow else { return }
|
|
576
|
-
|
|
577
|
-
previewModel.load(window: window)
|
|
578
|
-
|
|
579
|
-
guard let image = previewModel.image(for: window.wid) else { return }
|
|
580
|
-
guard renderedWindowID != window.wid || renderedImage == nil || renderedWindow?.title != window.title else { return }
|
|
581
|
-
|
|
582
|
-
let apply = {
|
|
583
|
-
renderedWindow = window
|
|
584
|
-
renderedWindowID = window.wid
|
|
585
|
-
renderedImage = image
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
if animated {
|
|
589
|
-
withAnimation(.easeInOut(duration: 0.16)) {
|
|
590
|
-
apply()
|
|
591
|
-
}
|
|
592
|
-
} else {
|
|
593
|
-
apply()
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}
|