@lattices/cli 0.4.1 → 0.4.5

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 (71) 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/ActionRow.swift +43 -26
  7. package/app/Sources/App.swift +10 -0
  8. package/app/Sources/AppDelegate.swift +91 -30
  9. package/app/Sources/AppShellView.swift +2 -0
  10. package/app/Sources/AppTypeClassifier.swift +36 -0
  11. package/app/Sources/AppUpdater.swift +92 -0
  12. package/app/Sources/CheatSheetHUD.swift +1 -0
  13. package/app/Sources/CliActionLauncher.swift +50 -0
  14. package/app/Sources/CommandModeView.swift +4 -24
  15. package/app/Sources/CompanionActivityLog.swift +70 -0
  16. package/app/Sources/CompanionKeyboardController.swift +141 -0
  17. package/app/Sources/DesktopModel.swift +4 -0
  18. package/app/Sources/HandsOffSession.swift +53 -16
  19. package/app/Sources/HomeDashboardView.swift +18 -10
  20. package/app/Sources/HotkeyStore.swift +8 -5
  21. package/app/Sources/IntentEngine.swift +7 -1
  22. package/app/Sources/LatticesApi.swift +125 -4
  23. package/app/Sources/LatticesCompanionBridgeServer.swift +438 -0
  24. package/app/Sources/LatticesCompanionCockpit.swift +555 -0
  25. package/app/Sources/LatticesCompanionSecurityCoordinator.swift +594 -0
  26. package/app/Sources/LatticesCompanionTrackpadController.swift +204 -0
  27. package/app/Sources/LatticesDeckHost.swift +1463 -0
  28. package/app/Sources/LatticesRuntime.swift +61 -0
  29. package/app/Sources/MainView.swift +398 -186
  30. package/app/Sources/MouseFinder.swift +335 -30
  31. package/app/Sources/MouseGestureConfig.swift +364 -0
  32. package/app/Sources/MouseGestureController.swift +1203 -0
  33. package/app/Sources/MouseInputDeviceStore.swift +98 -0
  34. package/app/Sources/MouseInputEventViewer.swift +272 -0
  35. package/app/Sources/MouseShortcutStore.swift +107 -0
  36. package/app/Sources/OmniSearchView.swift +136 -2
  37. package/app/Sources/OmniSearchWindow.swift +65 -5
  38. package/app/Sources/OnboardingView.swift +30 -16
  39. package/app/Sources/PaletteCommand.swift +26 -6
  40. package/app/Sources/PermissionChecker.swift +76 -2
  41. package/app/Sources/PiAuthNextStepCard.swift +148 -0
  42. package/app/Sources/PiAuthPromptCard.swift +90 -0
  43. package/app/Sources/PiChatDock.swift +137 -74
  44. package/app/Sources/PiChatSession.swift +608 -108
  45. package/app/Sources/PiInstallCallout.swift +86 -0
  46. package/app/Sources/PiProviderSetupCallout.swift +99 -0
  47. package/app/Sources/PiWorkspaceView.swift +174 -77
  48. package/app/Sources/Preferences.swift +78 -0
  49. package/app/Sources/ScreenMapState.swift +91 -31
  50. package/app/Sources/ScreenMapView.swift +510 -524
  51. package/app/Sources/ScreenMapWindowController.swift +12 -4
  52. package/app/Sources/SettingsView.swift +869 -152
  53. package/app/Sources/SystemTelemetryMonitor.swift +273 -0
  54. package/app/Sources/VoiceCommandWindow.swift +23 -2
  55. package/app/Sources/WindowDragSnapController.swift +628 -0
  56. package/app/Sources/WindowTiler.swift +328 -65
  57. package/app/Sources/WorkspaceManager.swift +288 -0
  58. package/bin/assistant-intelligence.ts +874 -0
  59. package/bin/handsoff-infer.ts +16 -209
  60. package/bin/handsoff-worker.ts +45 -258
  61. package/bin/lattices-app.ts +65 -1
  62. package/bin/lattices-dev +4 -0
  63. package/bin/lattices.ts +125 -14
  64. package/docs/agents.md +14 -0
  65. package/docs/api.md +55 -0
  66. package/docs/app.md +3 -0
  67. package/docs/companion-deck.md +180 -0
  68. package/docs/config.md +25 -0
  69. package/docs/tiling-reference.md +55 -0
  70. package/docs/voice-error-model.md +73 -0
  71. package/package.json +4 -2
@@ -1,4 +1,5 @@
1
1
  import AppKit
2
+ import Combine
2
3
  import Foundation
3
4
  import SwiftUI
4
5
 
@@ -251,7 +252,8 @@ final class ScreenMapEditorState: ObservableObject {
251
252
  static let minZoom: CGFloat = 0.3
252
253
  static let maxZoom: CGFloat = 5.0
253
254
 
254
- var effectiveScale: CGFloat { scale * zoomLevel }
255
+ /// `scale` is the synced effective canvas scale (fit scale × zoom).
256
+ var effectiveScale: CGFloat { scale }
255
257
 
256
258
  func resetZoomPan() {
257
259
  zoomLevel = 1.0
@@ -330,6 +332,12 @@ final class ScreenMapEditorState: ObservableObject {
330
332
  effectiveLayers.count
331
333
  }
332
334
 
335
+ /// Total windows in the current display scope before any layer filter is applied.
336
+ var scopedWindowCount: Int {
337
+ guard let dIdx = focusedDisplayIndex else { return windows.count }
338
+ return windows.filter { $0.displayIndex == dIdx }.count
339
+ }
340
+
333
341
  /// Window count for a layer, scoped to the focused display
334
342
  func effectiveWindowCount(for layer: Int) -> Int {
335
343
  guard let dIdx = focusedDisplayIndex else {
@@ -338,6 +346,27 @@ final class ScreenMapEditorState: ObservableObject {
338
346
  return windows.filter { $0.layer == layer && $0.displayIndex == dIdx }.count
339
347
  }
340
348
 
349
+ /// Windows currently rendered in the main canvas.
350
+ var renderedCanvasWindows: [ScreenMapWindowEntry] {
351
+ focusedDisplayIndex != nil ? focusedVisibleWindows : visibleWindows
352
+ }
353
+
354
+ var namedEffectiveLayers: [Int] {
355
+ effectiveLayers.filter { layerNames[$0] != nil }
356
+ }
357
+
358
+ var unnamedEffectiveLayers: [Int] {
359
+ effectiveLayers.filter { layerNames[$0] == nil }
360
+ }
361
+
362
+ func layerTreeWindows(for layer: Int) -> [ScreenMapWindowEntry] {
363
+ var scoped = windows.filter { $0.layer == layer }
364
+ if let dIdx = focusedDisplayIndex {
365
+ scoped = scoped.filter { $0.displayIndex == dIdx }
366
+ }
367
+ return scoped.sorted { $0.zIndex < $1.zIndex }
368
+ }
369
+
341
370
  /// Visible window count per display index
342
371
  func visibleWindowCount(for displayIndex: Int) -> Int {
343
372
  visibleWindows.filter { $0.displayIndex == displayIndex }.count
@@ -510,6 +539,12 @@ final class ScreenMapEditorState: ObservableObject {
510
539
  return regions
511
540
  }
512
541
 
542
+ func displayRegion(for displayIndex: Int) -> ScreenMapCanvasRegion? {
543
+ canvasExplorerRegions.first {
544
+ $0.kind == .display && $0.displayIndex == displayIndex
545
+ }
546
+ }
547
+
513
548
  private func regionRect(for windows: [ScreenMapWindowEntry], fallback: CGRect, padding: CGFloat) -> CGRect {
514
549
  guard !windows.isEmpty else { return fallback.insetBy(dx: -padding, dy: -padding) }
515
550
 
@@ -1350,7 +1385,9 @@ final class ScreenMapActionLog {
1350
1385
  // MARK: - Screen Map Controller
1351
1386
 
1352
1387
  final class ScreenMapController: ObservableObject {
1353
- @Published var editor: ScreenMapEditorState?
1388
+ @Published var editor: ScreenMapEditorState? {
1389
+ didSet { bindEditor() }
1390
+ }
1354
1391
  @Published var selectedWindowIds: Set<UInt32> = []
1355
1392
  @Published var windowSets: [ScreenMapWindowSet] = []
1356
1393
  @Published var activeWindowSetID: UUID? = nil
@@ -1364,6 +1401,7 @@ final class ScreenMapController: ObservableObject {
1364
1401
  case left, right, none
1365
1402
  }
1366
1403
  @Published var displayTransition: DisplayTransitionDirection = .none
1404
+ private var editorObserver: AnyCancellable?
1367
1405
 
1368
1406
  var previewWindow: NSWindow? = nil
1369
1407
  private var previewGlobalMonitor: Any? = nil
@@ -1371,6 +1409,52 @@ final class ScreenMapController: ObservableObject {
1371
1409
 
1372
1410
  var onDismiss: (() -> Void)?
1373
1411
 
1412
+ enum DisplayFocusDirection {
1413
+ case previous
1414
+ case next
1415
+ }
1416
+
1417
+ private func bindEditor() {
1418
+ editorObserver = editor?.objectWillChange.sink { [weak self] _ in
1419
+ self?.objectWillChange.send()
1420
+ }
1421
+ }
1422
+
1423
+ private func finalizeDisplayFocusChange(flashLabel: Bool) {
1424
+ guard let ed = editor else { return }
1425
+ focusViewportPreset(ed.activeViewportPreset ?? .main, flashView: false)
1426
+ if flashLabel {
1427
+ flash(ed.focusedDisplay?.label ?? "All displays")
1428
+ }
1429
+ objectWillChange.send()
1430
+ }
1431
+
1432
+ func setDisplayFocus(_ index: Int?, flashLabel: Bool = false) {
1433
+ guard let ed = editor else { return }
1434
+ ed.focusDisplay(index)
1435
+ finalizeDisplayFocusChange(flashLabel: flashLabel)
1436
+ }
1437
+
1438
+ func stepDisplayFocus(_ direction: DisplayFocusDirection, flashLabel: Bool = true) {
1439
+ guard let ed = editor, ed.displays.count > 1 else { return }
1440
+ switch direction {
1441
+ case .previous:
1442
+ ed.cyclePreviousDisplay()
1443
+ case .next:
1444
+ ed.cycleNextDisplay()
1445
+ }
1446
+ finalizeDisplayFocusChange(flashLabel: flashLabel)
1447
+ }
1448
+
1449
+ func adjustZoom(by delta: CGFloat) {
1450
+ guard let ed = editor else { return }
1451
+ let newZoom = max(ScreenMapEditorState.minZoom, min(ScreenMapEditorState.maxZoom, ed.zoomLevel + delta))
1452
+ guard newZoom != ed.zoomLevel else { return }
1453
+ ed.activeViewportPreset = nil
1454
+ ed.zoomLevel = newZoom
1455
+ objectWillChange.send()
1456
+ }
1457
+
1374
1458
  // MARK: - Selection
1375
1459
 
1376
1460
  func isSelected(_ id: UInt32) -> Bool { selectedWindowIds.contains(id) }
@@ -1616,7 +1700,7 @@ final class ScreenMapController: ObservableObject {
1616
1700
  guard CGRectMakeWithDictionaryRepresentation(boundsDict, &rect) else { continue }
1617
1701
  guard rect.width >= 100 && rect.height >= 50 else { continue }
1618
1702
  let app = info[kCGWindowOwnerName as String] as? String ?? ""
1619
- if app == "Lattices" || app == "lattices" || app == "Lattices" { continue }
1703
+ if app == "Lattices" || app == "lattices" || app == "AutoFill" { continue }
1620
1704
  let pid = info[kCGWindowOwnerPID as String] as? Int32 ?? 0
1621
1705
  let title = info[kCGWindowName as String] as? String ?? ""
1622
1706
  let dIdx = displayIndex(for: rect)
@@ -2052,23 +2136,11 @@ final class ScreenMapController: ObservableObject {
2052
2136
  // MARK: Right hand — Navigation
2053
2137
 
2054
2138
  case 4: // h → previous display
2055
- if let ed = editor, ed.displays.count > 1 {
2056
- ed.cyclePreviousDisplay()
2057
- focusViewportPreset(ed.activeViewportPreset ?? .main, flashView: false)
2058
- let label = ed.focusedDisplay?.label ?? "All displays"
2059
- flash(label)
2060
- objectWillChange.send()
2061
- }
2139
+ stepDisplayFocus(.previous)
2062
2140
  return true
2063
2141
 
2064
2142
  case 37: // l → next display
2065
- if let ed = editor, ed.displays.count > 1 {
2066
- ed.cycleNextDisplay()
2067
- focusViewportPreset(ed.activeViewportPreset ?? .main, flashView: false)
2068
- let label = ed.focusedDisplay?.label ?? "All displays"
2069
- flash(label)
2070
- objectWillChange.send()
2071
- }
2143
+ stepDisplayFocus(.next)
2072
2144
  return true
2073
2145
 
2074
2146
  case 38: // j → next layer
@@ -2213,23 +2285,11 @@ final class ScreenMapController: ObservableObject {
2213
2285
  return true
2214
2286
 
2215
2287
  case 123: // ← previous display (secondary)
2216
- if let ed = editor, ed.displays.count > 1 {
2217
- ed.cyclePreviousDisplay()
2218
- focusViewportPreset(ed.activeViewportPreset ?? .main, flashView: false)
2219
- let label = ed.focusedDisplay?.label ?? "All displays"
2220
- flash(label)
2221
- objectWillChange.send()
2222
- }
2288
+ stepDisplayFocus(.previous)
2223
2289
  return true
2224
2290
 
2225
2291
  case 124: // → next display (secondary)
2226
- if let ed = editor, ed.displays.count > 1 {
2227
- ed.cycleNextDisplay()
2228
- focusViewportPreset(ed.activeViewportPreset ?? .main, flashView: false)
2229
- let label = ed.focusedDisplay?.label ?? "All displays"
2230
- flash(label)
2231
- objectWillChange.send()
2232
- }
2292
+ stepDisplayFocus(.next)
2233
2293
  return true
2234
2294
 
2235
2295
  case 44: // / → open window search