@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.
Files changed (181) hide show
  1. package/README.md +5 -7
  2. package/apps/mac/Info.plist +4 -4
  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/proposals/LAT-007-unified-app-shell.md +128 -0
  19. package/docs/reference/dewey.config.ts +2 -2
  20. package/docs/release.md +171 -0
  21. package/docs/repo-structure.md +5 -5
  22. package/docs/voice.md +11 -27
  23. package/package.json +11 -10
  24. package/apps/mac/Package.swift +0 -27
  25. package/apps/mac/Sources/AppShell/App.swift +0 -26
  26. package/apps/mac/Sources/AppShell/AppActivationCoordinator.swift +0 -27
  27. package/apps/mac/Sources/AppShell/AppDelegate.swift +0 -189
  28. package/apps/mac/Sources/AppShell/AppServicesBootstrap.swift +0 -25
  29. package/apps/mac/Sources/AppShell/AppShellView.swift +0 -171
  30. package/apps/mac/Sources/AppShell/AppUpdater.swift +0 -305
  31. package/apps/mac/Sources/AppShell/CliActionLauncher.swift +0 -50
  32. package/apps/mac/Sources/AppShell/HomeDashboardView.swift +0 -133
  33. package/apps/mac/Sources/AppShell/HotkeyBootstrap.swift +0 -87
  34. package/apps/mac/Sources/AppShell/KeyRecorderView.swift +0 -210
  35. package/apps/mac/Sources/AppShell/LatticesRuntime.swift +0 -104
  36. package/apps/mac/Sources/AppShell/MainView.swift +0 -847
  37. package/apps/mac/Sources/AppShell/MainWindow.swift +0 -83
  38. package/apps/mac/Sources/AppShell/MenuBarController.swift +0 -177
  39. package/apps/mac/Sources/AppShell/OnboardingView.swift +0 -483
  40. package/apps/mac/Sources/AppShell/PermissionsAssistantView.swift +0 -366
  41. package/apps/mac/Sources/AppShell/PermissionsAssistantWindow.swift +0 -70
  42. package/apps/mac/Sources/AppShell/Preferences.swift +0 -297
  43. package/apps/mac/Sources/AppShell/SettingsView.swift +0 -3163
  44. package/apps/mac/Sources/AppShell/SettingsWindow.swift +0 -34
  45. package/apps/mac/Sources/AppShell/WorkspaceInspectorPresenter.swift +0 -13
  46. package/apps/mac/Sources/Core/Actions/HotkeyManager.swift +0 -256
  47. package/apps/mac/Sources/Core/Actions/HotkeyStore.swift +0 -399
  48. package/apps/mac/Sources/Core/Actions/IntentEngine.swift +0 -988
  49. package/apps/mac/Sources/Core/Actions/IntentSchema.swift +0 -94
  50. package/apps/mac/Sources/Core/Actions/Intents/CreateLayerIntent.swift +0 -54
  51. package/apps/mac/Sources/Core/Actions/Intents/DistributeIntent.swift +0 -56
  52. package/apps/mac/Sources/Core/Actions/Intents/FocusIntent.swift +0 -69
  53. package/apps/mac/Sources/Core/Actions/Intents/HelpIntent.swift +0 -41
  54. package/apps/mac/Sources/Core/Actions/Intents/KillIntent.swift +0 -47
  55. package/apps/mac/Sources/Core/Actions/Intents/LatticeIntent.swift +0 -53
  56. package/apps/mac/Sources/Core/Actions/Intents/LaunchIntent.swift +0 -67
  57. package/apps/mac/Sources/Core/Actions/Intents/ListSessionsIntent.swift +0 -32
  58. package/apps/mac/Sources/Core/Actions/Intents/ListWindowsIntent.swift +0 -30
  59. package/apps/mac/Sources/Core/Actions/Intents/ScanIntent.swift +0 -52
  60. package/apps/mac/Sources/Core/Actions/Intents/SearchIntent.swift +0 -190
  61. package/apps/mac/Sources/Core/Actions/Intents/SwitchLayerIntent.swift +0 -50
  62. package/apps/mac/Sources/Core/Actions/Intents/TileIntent.swift +0 -61
  63. package/apps/mac/Sources/Core/Actions/PaletteCommand.swift +0 -439
  64. package/apps/mac/Sources/Core/Actions/VoiceIntentResolver.swift +0 -713
  65. package/apps/mac/Sources/Core/Companion/CompanionActivityLog.swift +0 -70
  66. package/apps/mac/Sources/Core/Companion/CompanionKeyboardController.swift +0 -141
  67. package/apps/mac/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +0 -454
  68. package/apps/mac/Sources/Core/Companion/LatticesCompanionCockpit.swift +0 -555
  69. package/apps/mac/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +0 -629
  70. package/apps/mac/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +0 -204
  71. package/apps/mac/Sources/Core/Companion/LatticesDeckHost.swift +0 -1463
  72. package/apps/mac/Sources/Core/Daemon/DaemonProtocol.swift +0 -114
  73. package/apps/mac/Sources/Core/Daemon/DaemonServer.swift +0 -427
  74. package/apps/mac/Sources/Core/Daemon/LatticesApi.swift +0 -2965
  75. package/apps/mac/Sources/Core/Desktop/AccessibilityTextExtractor.swift +0 -111
  76. package/apps/mac/Sources/Core/Desktop/AppTypeClassifier.swift +0 -106
  77. package/apps/mac/Sources/Core/Desktop/DesktopModel.swift +0 -331
  78. package/apps/mac/Sources/Core/Desktop/DesktopModelTypes.swift +0 -73
  79. package/apps/mac/Sources/Core/Desktop/InventoryManager.swift +0 -35
  80. package/apps/mac/Sources/Core/Desktop/InventoryPath.swift +0 -43
  81. package/apps/mac/Sources/Core/Desktop/MouseFinder.swift +0 -527
  82. package/apps/mac/Sources/Core/Desktop/OcrModel.swift +0 -467
  83. package/apps/mac/Sources/Core/Desktop/OcrStore.swift +0 -329
  84. package/apps/mac/Sources/Core/Desktop/PlacementSpec.swift +0 -195
  85. package/apps/mac/Sources/Core/Desktop/SessionWindowLocator.swift +0 -139
  86. package/apps/mac/Sources/Core/Desktop/TilePickerView.swift +0 -209
  87. package/apps/mac/Sources/Core/Desktop/WindowCapture.swift +0 -33
  88. package/apps/mac/Sources/Core/Desktop/WindowDragSnapController.swift +0 -429
  89. package/apps/mac/Sources/Core/Desktop/WindowPreviewCard.swift +0 -100
  90. package/apps/mac/Sources/Core/Desktop/WindowPreviewStore.swift +0 -112
  91. package/apps/mac/Sources/Core/Desktop/WindowSelectionStore.swift +0 -76
  92. package/apps/mac/Sources/Core/Desktop/WindowTiler.swift +0 -2222
  93. package/apps/mac/Sources/Core/Input/EventTapBreaker.swift +0 -124
  94. package/apps/mac/Sources/Core/Input/EventTapThread.swift +0 -54
  95. package/apps/mac/Sources/Core/Input/InputCaptureResetCenter.swift +0 -20
  96. package/apps/mac/Sources/Core/Input/KeyboardRemapConfig.swift +0 -69
  97. package/apps/mac/Sources/Core/Input/KeyboardRemapController.swift +0 -346
  98. package/apps/mac/Sources/Core/Input/KeyboardRemapStore.swift +0 -141
  99. package/apps/mac/Sources/Core/Input/MouseGestureConfig.swift +0 -499
  100. package/apps/mac/Sources/Core/Input/MouseGestureController.swift +0 -2583
  101. package/apps/mac/Sources/Core/Input/MouseInputDeviceStore.swift +0 -98
  102. package/apps/mac/Sources/Core/Input/MouseInputEventViewer.swift +0 -272
  103. package/apps/mac/Sources/Core/Input/MouseShortcutStore.swift +0 -170
  104. package/apps/mac/Sources/Core/Input/SecureEventInputMonitor.swift +0 -39
  105. package/apps/mac/Sources/Core/Input/ShapeRecognizer.swift +0 -624
  106. package/apps/mac/Sources/Core/Input/TapBudgetMeter.swift +0 -56
  107. package/apps/mac/Sources/Core/Overlays/AppWindowShell.swift +0 -63
  108. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeState.swift +0 -1566
  109. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeView.swift +0 -1927
  110. package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeWindow.swift +0 -196
  111. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteView.swift +0 -307
  112. package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +0 -67
  113. package/apps/mac/Sources/Core/Overlays/HUD/CheatSheetHUD.swift +0 -576
  114. package/apps/mac/Sources/Core/Overlays/HUD/HUDBottomBar.swift +0 -279
  115. package/apps/mac/Sources/Core/Overlays/HUD/HUDController.swift +0 -1158
  116. package/apps/mac/Sources/Core/Overlays/HUD/HUDLeftBar.swift +0 -849
  117. package/apps/mac/Sources/Core/Overlays/HUD/HUDMinimap.swift +0 -179
  118. package/apps/mac/Sources/Core/Overlays/HUD/HUDRightBar.swift +0 -596
  119. package/apps/mac/Sources/Core/Overlays/HUD/HUDState.swift +0 -367
  120. package/apps/mac/Sources/Core/Overlays/HUD/HUDTopBar.swift +0 -243
  121. package/apps/mac/Sources/Core/Overlays/HUD/LauncherHUD.swift +0 -334
  122. package/apps/mac/Sources/Core/Overlays/HUD/LayerBezel.swift +0 -203
  123. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchState.swift +0 -280
  124. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchView.swift +0 -422
  125. package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchWindow.swift +0 -94
  126. package/apps/mac/Sources/Core/Overlays/OverlayPanelShell.swift +0 -241
  127. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapState.swift +0 -3135
  128. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapView.swift +0 -3977
  129. package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapWindowController.swift +0 -119
  130. package/apps/mac/Sources/Core/Overlays/ScreenOverlayCanvasController.swift +0 -1217
  131. package/apps/mac/Sources/Core/Overlays/Voice/VoiceCommandWindow.swift +0 -1575
  132. package/apps/mac/Sources/Core/Pi/PiAuthNextStepCard.swift +0 -148
  133. package/apps/mac/Sources/Core/Pi/PiAuthPromptCard.swift +0 -90
  134. package/apps/mac/Sources/Core/Pi/PiChatDock.swift +0 -564
  135. package/apps/mac/Sources/Core/Pi/PiChatSession.swift +0 -1948
  136. package/apps/mac/Sources/Core/Pi/PiInstallCallout.swift +0 -86
  137. package/apps/mac/Sources/Core/Pi/PiProviderSetupCallout.swift +0 -99
  138. package/apps/mac/Sources/Core/Pi/PiWorkspaceView.swift +0 -510
  139. package/apps/mac/Sources/Core/System/Capability.swift +0 -79
  140. package/apps/mac/Sources/Core/System/DiagnosticLog.swift +0 -373
  141. package/apps/mac/Sources/Core/System/EventBus.swift +0 -31
  142. package/apps/mac/Sources/Core/System/PermissionChecker.swift +0 -224
  143. package/apps/mac/Sources/Core/System/ProcessModel.swift +0 -199
  144. package/apps/mac/Sources/Core/System/ProcessQuery.swift +0 -151
  145. package/apps/mac/Sources/Core/System/SystemTelemetryMonitor.swift +0 -273
  146. package/apps/mac/Sources/Core/Voice/AdvisorLearningStore.swift +0 -90
  147. package/apps/mac/Sources/Core/Voice/AgentSession.swift +0 -377
  148. package/apps/mac/Sources/Core/Voice/AudioProvider.swift +0 -555
  149. package/apps/mac/Sources/Core/Voice/HandsOffSession.swift +0 -839
  150. package/apps/mac/Sources/Core/Voice/VoiceChatView.swift +0 -192
  151. package/apps/mac/Sources/Core/Voice/VoxClient.swift +0 -454
  152. package/apps/mac/Sources/Core/Workspace/Project.swift +0 -28
  153. package/apps/mac/Sources/Core/Workspace/ProjectScanner.swift +0 -141
  154. package/apps/mac/Sources/Core/Workspace/SessionLayerStore.swift +0 -285
  155. package/apps/mac/Sources/Core/Workspace/SessionManager.swift +0 -75
  156. package/apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift +0 -259
  157. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalQuery.swift +0 -156
  158. package/apps/mac/Sources/Core/Workspace/Terminal/TerminalSynthesizer.swift +0 -200
  159. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxModel.swift +0 -60
  160. package/apps/mac/Sources/Core/Workspace/Tmux/TmuxQuery.swift +0 -105
  161. package/apps/mac/Sources/Core/Workspace/WorkspaceManager.swift +0 -1027
  162. package/apps/mac/Sources/UI/ActionRow.swift +0 -78
  163. package/apps/mac/Sources/UI/OrphanRow.swift +0 -129
  164. package/apps/mac/Sources/UI/ProjectRow.swift +0 -368
  165. package/apps/mac/Sources/UI/TabGroupRow.swift +0 -178
  166. package/apps/mac/Sources/UI/Theme.swift +0 -164
  167. package/apps/mac/Tests/StageDragTests.swift +0 -333
  168. package/apps/mac/Tests/StageJoinTests.swift +0 -313
  169. package/apps/mac/Tests/StageManagerTests.swift +0 -280
  170. package/apps/mac/Tests/StageTileTests.swift +0 -353
  171. package/swift/Package.swift +0 -20
  172. package/swift/Sources/DeckKit/DeckAction.swift +0 -51
  173. package/swift/Sources/DeckKit/DeckBridgeSecurity.swift +0 -152
  174. package/swift/Sources/DeckKit/DeckCockpit.swift +0 -82
  175. package/swift/Sources/DeckKit/DeckHost.swift +0 -7
  176. package/swift/Sources/DeckKit/DeckManifest.swift +0 -145
  177. package/swift/Sources/DeckKit/DeckRuntimeSnapshot.swift +0 -533
  178. package/swift/Sources/DeckKit/DeckTrackpad.swift +0 -63
  179. package/swift/Sources/DeckKit/DeckValue.swift +0 -93
  180. package/swift/Sources/DeckKit/DeckVoiceError.swift +0 -88
  181. package/swift/Tests/DeckKitTests/DeckKitTests.swift +0 -286
@@ -1,63 +0,0 @@
1
- import Foundation
2
-
3
- public struct DeckTrackpadState: Codable, Equatable, Sendable {
4
- public var isEnabled: Bool
5
- public var isAvailable: Bool
6
- public var statusTitle: String
7
- public var statusDetail: String?
8
- public var pointerScale: Double
9
- public var scrollScale: Double
10
- public var supportsDragLock: Bool
11
-
12
- public init(
13
- isEnabled: Bool,
14
- isAvailable: Bool,
15
- statusTitle: String,
16
- statusDetail: String? = nil,
17
- pointerScale: Double = 1.6,
18
- scrollScale: Double = 1.0,
19
- supportsDragLock: Bool = true
20
- ) {
21
- self.isEnabled = isEnabled
22
- self.isAvailable = isAvailable
23
- self.statusTitle = statusTitle
24
- self.statusDetail = statusDetail
25
- self.pointerScale = pointerScale
26
- self.scrollScale = scrollScale
27
- self.supportsDragLock = supportsDragLock
28
- }
29
- }
30
-
31
- public struct DeckTrackpadEventRequest: Codable, Equatable, Sendable {
32
- public var event: DeckTrackpadEvent
33
- public var dx: Double
34
- public var dy: Double
35
-
36
- public init(
37
- event: DeckTrackpadEvent,
38
- dx: Double = 0,
39
- dy: Double = 0
40
- ) {
41
- self.event = event
42
- self.dx = dx
43
- self.dy = dy
44
- }
45
- }
46
-
47
- public enum DeckTrackpadEvent: String, Codable, CaseIterable, Sendable {
48
- case move
49
- case click
50
- case rightClick
51
- case scroll
52
- case mouseDown
53
- case mouseUp
54
- case drag
55
- }
56
-
57
- public struct DeckTrackpadEventResult: Codable, Equatable, Sendable {
58
- public var ok: Bool
59
-
60
- public init(ok: Bool) {
61
- self.ok = ok
62
- }
63
- }
@@ -1,93 +0,0 @@
1
- import Foundation
2
-
3
- public enum DeckValue: Codable, Equatable, Sendable {
4
- case string(String)
5
- case int(Int)
6
- case double(Double)
7
- case bool(Bool)
8
- case array([DeckValue])
9
- case object([String: DeckValue])
10
- case null
11
-
12
- public init(from decoder: Decoder) throws {
13
- let container = try decoder.singleValueContainer()
14
-
15
- if container.decodeNil() {
16
- self = .null
17
- } else if let bool = try? container.decode(Bool.self) {
18
- self = .bool(bool)
19
- } else if let int = try? container.decode(Int.self) {
20
- self = .int(int)
21
- } else if let double = try? container.decode(Double.self) {
22
- self = .double(double)
23
- } else if let string = try? container.decode(String.self) {
24
- self = .string(string)
25
- } else if let array = try? container.decode([DeckValue].self) {
26
- self = .array(array)
27
- } else if let object = try? container.decode([String: DeckValue].self) {
28
- self = .object(object)
29
- } else {
30
- throw DecodingError.dataCorruptedError(
31
- in: container,
32
- debugDescription: "Unsupported DeckValue payload"
33
- )
34
- }
35
- }
36
-
37
- public func encode(to encoder: Encoder) throws {
38
- var container = encoder.singleValueContainer()
39
-
40
- switch self {
41
- case .string(let value):
42
- try container.encode(value)
43
- case .int(let value):
44
- try container.encode(value)
45
- case .double(let value):
46
- try container.encode(value)
47
- case .bool(let value):
48
- try container.encode(value)
49
- case .array(let value):
50
- try container.encode(value)
51
- case .object(let value):
52
- try container.encode(value)
53
- case .null:
54
- try container.encodeNil()
55
- }
56
- }
57
-
58
- public var stringValue: String? {
59
- guard case .string(let value) = self else { return nil }
60
- return value
61
- }
62
-
63
- public var intValue: Int? {
64
- guard case .int(let value) = self else { return nil }
65
- return value
66
- }
67
-
68
- public var doubleValue: Double? {
69
- switch self {
70
- case .double(let value):
71
- return value
72
- case .int(let value):
73
- return Double(value)
74
- default:
75
- return nil
76
- }
77
- }
78
-
79
- public var boolValue: Bool? {
80
- guard case .bool(let value) = self else { return nil }
81
- return value
82
- }
83
-
84
- public var arrayValue: [DeckValue]? {
85
- guard case .array(let value) = self else { return nil }
86
- return value
87
- }
88
-
89
- public var objectValue: [String: DeckValue]? {
90
- guard case .object(let value) = self else { return nil }
91
- return value
92
- }
93
- }
@@ -1,88 +0,0 @@
1
- import Foundation
2
-
3
- // MARK: - Voice error model
4
- //
5
- // Shared across Mac (capture + execution) and iPad (relay + status).
6
- // Stable raw string values so codes survive JSON, JSONL logs, and the bridge
7
- // snapshot. See `docs/voice-error-model.md` for the design rationale.
8
-
9
- public struct DeckVoiceError: Codable, Equatable, Identifiable, Sendable {
10
- public var id: String
11
- public var code: DeckVoiceErrorCode
12
- public var severity: DeckErrorSeverity
13
- public var recoverable: Bool
14
- public var retry: DeckRetryHint?
15
- public var source: DeckErrorSource
16
- public var owner: String? // e.g. "Vox" for mic_busy
17
- public var message: String // cockpit copy, human-readable
18
- public var remediation: DeckRemediationAction?
19
- public var occurredAt: Date
20
- public var detail: String? // diagnostic-only, not displayed
21
-
22
- public init(
23
- id: String = UUID().uuidString,
24
- code: DeckVoiceErrorCode,
25
- severity: DeckErrorSeverity,
26
- recoverable: Bool,
27
- retry: DeckRetryHint? = nil,
28
- source: DeckErrorSource,
29
- owner: String? = nil,
30
- message: String,
31
- remediation: DeckRemediationAction? = nil,
32
- occurredAt: Date = .now,
33
- detail: String? = nil
34
- ) {
35
- self.id = id
36
- self.code = code
37
- self.severity = severity
38
- self.recoverable = recoverable
39
- self.retry = retry
40
- self.source = source
41
- self.owner = owner
42
- self.message = message
43
- self.remediation = remediation
44
- self.occurredAt = occurredAt
45
- self.detail = detail
46
- }
47
- }
48
-
49
- public enum DeckVoiceErrorCode: String, Codable, CaseIterable, Sendable {
50
- case voxUnreachable = "vox_unreachable"
51
- case daemonUnreachable = "daemon_unreachable"
52
- case network = "network"
53
- case connectionLost = "connection_lost"
54
- case micDenied = "mic_denied"
55
- case accessibilityDenied = "accessibility_denied"
56
- case micBusy = "mic_busy"
57
- case noActiveTarget = "no_active_target"
58
- case voxNotRunning = "vox_not_running"
59
- case voxLoading = "vox_loading"
60
- case intentUnresolved = "intent_unresolved"
61
- case actionFailed = "action_failed"
62
- case transcriptionFailed = "transcription_failed"
63
- case emptyTranscript = "empty_transcript"
64
- case languageUnsupported = "language_unsupported"
65
- }
66
-
67
- public enum DeckErrorSeverity: String, Codable, CaseIterable, Sendable {
68
- case info, warning, error, blocked
69
- }
70
-
71
- public enum DeckRetryHint: String, Codable, CaseIterable, Sendable {
72
- case silent // reconnect quietly, log only
73
- case immediate // safe to auto-retry now
74
- case afterLaunch = "after_launch" // retry after launching a dependency (e.g. Vox)
75
- case userAction = "user_action" // user must do something first
76
- }
77
-
78
- public enum DeckErrorSource: String, Codable, CaseIterable, Sendable {
79
- case mac, ipad, vox, daemon, intent, bridge
80
- }
81
-
82
- public enum DeckRemediationAction: Codable, Equatable, Sendable {
83
- case openVox
84
- case openSystemSettings(kind: String)
85
- case retryVoice
86
- case openDiagnostics
87
- case chooseTarget
88
- }
@@ -1,286 +0,0 @@
1
- import XCTest
2
- @testable import DeckKit
3
-
4
- final class DeckKitTests: XCTestCase {
5
- func testManifestRoundTripPreservesEmbeddedSecurity() throws {
6
- let manifest = DeckManifest(
7
- product: DeckProductIdentity(
8
- id: "com.arach.lattices",
9
- displayName: "Lattices Companion",
10
- owner: "lattices"
11
- ),
12
- security: .embeddedDelegated(owner: "talkie"),
13
- capabilities: [.voiceAgent, .layoutControl, .embeddedSecurityDelegation],
14
- pages: [
15
- DeckPage(
16
- id: "voice",
17
- title: "Voice",
18
- iconSystemName: "mic.fill",
19
- kind: .voice,
20
- accentToken: "royal-blue"
21
- )
22
- ]
23
- )
24
-
25
- let data = try JSONEncoder().encode(manifest)
26
- let decoded = try JSONDecoder().decode(DeckManifest.self, from: data)
27
-
28
- XCTAssertEqual(decoded, manifest)
29
- XCTAssertEqual(decoded.security.delegatedOwner, "talkie")
30
- }
31
-
32
- func testSecurityConvenienceProfilesMatchIntendedModes() {
33
- let standalone = DeckSecurityConfiguration.standaloneBonjour()
34
- XCTAssertEqual(standalone.mode, .standalone)
35
- XCTAssertEqual(standalone.pairingStrategy, .bonjour)
36
- XCTAssertTrue(standalone.requestSigningRequired)
37
- XCTAssertTrue(standalone.payloadEncryptionRequired)
38
- XCTAssertNil(standalone.delegatedOwner)
39
-
40
- let embedded = DeckSecurityConfiguration.embeddedDelegated(owner: "talkie")
41
- XCTAssertEqual(embedded.mode, .embedded)
42
- XCTAssertEqual(embedded.pairingStrategy, .delegated)
43
- XCTAssertTrue(embedded.payloadEncryptionRequired)
44
- XCTAssertEqual(embedded.delegatedOwner, "talkie")
45
- }
46
-
47
- func testPairingPayloadRoundTripPreservesSecurityFlags() throws {
48
- let response = DeckPairingResponse(
49
- disposition: .approved,
50
- bridgeName: "Lats Bridge",
51
- bridgePublicKey: "bridge-public-key",
52
- bridgeFingerprint: "ABCD-1234",
53
- requestSigningRequired: true,
54
- payloadEncryptionRequired: true,
55
- grantedCapabilities: [
56
- DeckBridgeCapability.deckRead,
57
- DeckBridgeCapability.deckPerform,
58
- ],
59
- detail: "Trusted on the Mac."
60
- )
61
-
62
- let data = try JSONEncoder().encode(response)
63
- let decoded = try JSONDecoder().decode(DeckPairingResponse.self, from: data)
64
-
65
- XCTAssertEqual(decoded, response)
66
- XCTAssertEqual(decoded.grantedCapabilities, [
67
- DeckBridgeCapability.deckRead,
68
- DeckBridgeCapability.deckPerform,
69
- ])
70
- }
71
-
72
- func testPairingPayloadDecodesLegacyCapabilityDefaults() throws {
73
- let responseJSON = """
74
- {
75
- "disposition": "approved",
76
- "bridgeName": "Lats Bridge",
77
- "bridgePublicKey": "bridge-public-key",
78
- "bridgeFingerprint": "ABCD-1234",
79
- "requestSigningRequired": true,
80
- "payloadEncryptionRequired": true
81
- }
82
- """.data(using: .utf8)!
83
-
84
- let decodedResponse = try JSONDecoder().decode(DeckPairingResponse.self, from: responseJSON)
85
- XCTAssertEqual(decodedResponse.grantedCapabilities, DeckBridgeCapability.defaultCompanionCapabilities)
86
-
87
- let requestJSON = """
88
- {
89
- "deviceID": "ipad-1",
90
- "deviceName": "iPad",
91
- "devicePublicKey": "device-public-key",
92
- "platform": "iPadOS"
93
- }
94
- """.data(using: .utf8)!
95
-
96
- let decodedRequest = try JSONDecoder().decode(DeckPairingRequest.self, from: requestJSON)
97
- XCTAssertEqual(decodedRequest.requestedCapabilities, DeckBridgeCapability.defaultCompanionCapabilities)
98
- }
99
-
100
- func testRuntimeSnapshotRoundTripPreservesSwitcherAndHistory() throws {
101
- let snapshot = DeckRuntimeSnapshot(
102
- updatedAt: Date(timeIntervalSince1970: 1_713_700_000),
103
- cockpit: DeckCockpitState(
104
- title: "Command Deck",
105
- detail: "Quick controls from your Mac-defined cockpit.",
106
- pages: [
107
- DeckCockpitPage(
108
- id: "main",
109
- title: "Main",
110
- subtitle: "Core controls",
111
- columns: 4,
112
- tiles: [
113
- DeckCockpitTile(
114
- id: "main-0",
115
- shortcutID: "voice-toggle",
116
- title: "Voice",
117
- subtitle: "Start listening",
118
- iconSystemName: "mic.fill",
119
- accentToken: "voice",
120
- actionID: "voice.toggle",
121
- isActive: true
122
- )
123
- ]
124
- )
125
- ]
126
- ),
127
- trackpad: DeckTrackpadState(
128
- isEnabled: true,
129
- isAvailable: true,
130
- statusTitle: "Trackpad Ready",
131
- statusDetail: "Use the surface to move the Mac pointer.",
132
- pointerScale: 1.8,
133
- scrollScale: 1.2,
134
- supportsDragLock: true
135
- ),
136
- voice: DeckVoiceState(
137
- phase: .reasoning,
138
- transcript: "Arrange my review setup",
139
- transcriptLines: [
140
- DeckTranscriptLine(
141
- id: "line-1",
142
- createdAt: Date(timeIntervalSince1970: 1_713_700_001),
143
- text: "Arrange my review setup",
144
- isFinal: true,
145
- confidence: 0.93,
146
- source: "vox"
147
- )
148
- ],
149
- responseSummary: "Preparing a code review layout.",
150
- provider: "vox"
151
- ),
152
- desktop: DeckDesktopSummary(
153
- activeLayerName: "review",
154
- activeAppName: "Safari",
155
- screenCount: 2,
156
- visibleWindowCount: 6,
157
- sessionCount: 3
158
- ),
159
- layout: DeckLayoutState(
160
- screenName: "Built-in Retina Display",
161
- frontmostWindow: DeckLayoutFocusWindow(
162
- id: "window:42",
163
- itemID: "window:42",
164
- appName: "Safari",
165
- title: "Pull request",
166
- frame: DeckRect(x: 40, y: 80, w: 1440, h: 900),
167
- normalizedFrame: DeckRect(x: 0.0, y: 0.0, w: 0.75, h: 1.0),
168
- placement: "left"
169
- ),
170
- preview: DeckLayoutPreview(
171
- aspectRatio: 1.6,
172
- windows: [
173
- DeckLayoutPreviewWindow(
174
- id: "window:42",
175
- itemID: "window:42",
176
- title: "Pull request",
177
- subtitle: "Safari",
178
- normalizedFrame: DeckRect(x: 0.0, y: 0.0, w: 0.75, h: 1.0),
179
- appCategory: "browser",
180
- appCategoryTint: "blue",
181
- isFrontmost: true
182
- )
183
- ]
184
- )
185
- ),
186
- switcher: DeckSwitcherState(items: [
187
- DeckSwitcherItem(
188
- id: "app:safari",
189
- title: "Safari",
190
- subtitle: "Pull request",
191
- iconToken: "safari",
192
- kind: .application,
193
- isFrontmost: true
194
- ),
195
- DeckSwitcherItem(
196
- id: "session:frontend-a1b2c3",
197
- title: "frontend-a1b2c3",
198
- subtitle: "tmux session",
199
- iconToken: "terminal",
200
- kind: .session
201
- )
202
- ]),
203
- telemetry: DeckSystemTelemetry(
204
- sampledAt: Date(timeIntervalSince1970: 1_713_700_002),
205
- cpuLoadPercent: 31,
206
- memoryUsedPercent: 68,
207
- gpuLoadPercent: 12,
208
- thermalPressurePercent: 10,
209
- thermalState: .nominal,
210
- batteryPercent: 84,
211
- isCharging: true,
212
- powerSource: "AC Power",
213
- windowCount: 6,
214
- sessionCount: 3
215
- ),
216
- spaces: DeckSpacesState(
217
- currentSpaceIndex: 2,
218
- currentSpaceName: "code",
219
- displays: [
220
- DeckSpaceDisplay(
221
- id: "main",
222
- displayIndex: 0,
223
- currentSpaceID: 20,
224
- currentSpaceIndex: 2,
225
- currentSpaceName: "code",
226
- spaces: [
227
- DeckSpace(id: 10, index: 1, name: "main", isCurrent: false),
228
- DeckSpace(id: 20, index: 2, name: "code", isCurrent: true)
229
- ]
230
- )
231
- ]
232
- ),
233
- cockpitMode: DeckCockpitModeState(
234
- mode: .replay,
235
- replayMessage: "Placed Safari left",
236
- replayUndoActionID: "history.undoLast"
237
- ),
238
- activityLog: [
239
- DeckActivityLogEntry(
240
- id: "activity-1",
241
- tag: "DECK",
242
- tint: "blue",
243
- text: "Placed Safari left"
244
- )
245
- ],
246
- history: [
247
- DeckHistoryEntry(
248
- id: "history-1",
249
- title: "Grid layout applied",
250
- detail: "Distributed four visible windows.",
251
- kind: .layout,
252
- undoActionID: "undo-grid-layout"
253
- )
254
- ],
255
- questions: [
256
- DeckQuestionCard(
257
- id: "question-1",
258
- prompt: "Which monitor should hold the terminals?",
259
- options: [
260
- DeckQuestionOption(
261
- id: "primary",
262
- title: "Primary display",
263
- actionID: "layout.place-terminals-primary"
264
- )
265
- ]
266
- )
267
- ]
268
- )
269
-
270
- let data = try JSONEncoder().encode(snapshot)
271
- let decoded = try JSONDecoder().decode(DeckRuntimeSnapshot.self, from: data)
272
-
273
- XCTAssertEqual(decoded, snapshot)
274
- XCTAssertEqual(decoded.cockpit?.pages.first?.tiles.first?.shortcutID, "voice-toggle")
275
- XCTAssertEqual(decoded.trackpad?.statusTitle, "Trackpad Ready")
276
- XCTAssertEqual(decoded.voice?.provider, "vox")
277
- XCTAssertEqual(decoded.voice?.transcriptLines?.first?.source, "vox")
278
- XCTAssertEqual(decoded.layout?.frontmostWindow?.placement, "left")
279
- XCTAssertEqual(decoded.layout?.preview?.windows.first?.appCategoryTint, "blue")
280
- XCTAssertEqual(decoded.switcher?.items.count, 2)
281
- XCTAssertEqual(decoded.telemetry?.thermalState, .nominal)
282
- XCTAssertEqual(decoded.spaces?.currentSpaceName, "code")
283
- XCTAssertEqual(decoded.cockpitMode?.mode, .replay)
284
- XCTAssertEqual(decoded.activityLog?.first?.tag, "DECK")
285
- }
286
- }