@arach/lattices 0.2.1 → 0.6.1

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 (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +144 -69
  3. package/apps/mac/Info.plist +43 -0
  4. package/apps/mac/Lattices.app/Contents/Info.plist +43 -0
  5. package/apps/mac/Lattices.app/Contents/MacOS/Lattices +0 -0
  6. package/apps/mac/Lattices.app/Contents/Resources/AppIcon.icns +0 -0
  7. package/apps/mac/Lattices.app/Contents/Resources/docs/assistant-knowledge.md +130 -0
  8. package/apps/mac/Lattices.app/Contents/Resources/tap.wav +0 -0
  9. package/apps/mac/Lattices.app/Contents/_CodeSignature/CodeResources +150 -0
  10. package/apps/mac/Lattices.entitlements +21 -0
  11. package/apps/mac/Resources/Pets/assistant-spark/pet.json +62 -0
  12. package/apps/mac/Resources/Pets/assistant-spark/spritesheet.webp +0 -0
  13. package/apps/mac/Resources/Pets/scout-ranger/pet.json +6 -0
  14. package/apps/mac/Resources/Pets/scout-ranger/spritesheet.webp +0 -0
  15. package/apps/mac/Resources/tap.wav +0 -0
  16. package/assets/AppIcon.icns +0 -0
  17. package/bin/assistant-intelligence.ts +912 -0
  18. package/bin/cli/capture.ts +252 -0
  19. package/bin/cli/daemon.ts +22 -0
  20. package/bin/cli/helpers.ts +105 -0
  21. package/bin/cli/layer.ts +178 -0
  22. package/bin/cli/runs.ts +43 -0
  23. package/bin/cli/search.ts +141 -0
  24. package/bin/cli/session.ts +32 -0
  25. package/bin/client.ts +17 -0
  26. package/bin/cua.ts +26 -0
  27. package/bin/{daemon-client.js → daemon-client.ts} +49 -30
  28. package/bin/handsoff-infer.ts +96 -0
  29. package/bin/handsoff-worker.ts +531 -0
  30. package/bin/infer.ts +424 -0
  31. package/bin/keychain.ts +75 -0
  32. package/bin/lattices-app.ts +655 -0
  33. package/bin/lattices-build +125 -0
  34. package/bin/lattices-build-env.ts +77 -0
  35. package/bin/lattices-dev +362 -0
  36. package/bin/lattices.ts +3260 -0
  37. package/bin/project-twin.ts +645 -0
  38. package/docs/agent-execution-plan.md +562 -0
  39. package/docs/agent-layer-guide.md +207 -0
  40. package/docs/agents.md +233 -0
  41. package/docs/ai-chat-ux-review.md +416 -0
  42. package/docs/api.md +1041 -47
  43. package/docs/app.md +96 -13
  44. package/docs/assistant-knowledge.md +130 -0
  45. package/docs/companion-deck.md +209 -0
  46. package/docs/component-extraction-roadmap.md +392 -0
  47. package/docs/concepts.md +13 -12
  48. package/docs/config.md +83 -10
  49. package/docs/gesture-customization-proposal.md +520 -0
  50. package/docs/handsoff-test-scenarios.md +84 -0
  51. package/docs/hyperspace-grid-snappiness.md +210 -0
  52. package/docs/layers.md +176 -28
  53. package/docs/mouse-gestures.md +244 -0
  54. package/docs/ocr.md +21 -9
  55. package/docs/overview.md +42 -23
  56. package/docs/presentation-execution-review.md +491 -0
  57. package/docs/prompts/hands-off-system.md +382 -0
  58. package/docs/prompts/hands-off-turn.md +30 -0
  59. package/docs/prompts/voice-advisor.md +31 -0
  60. package/docs/prompts/voice-fallback.md +23 -0
  61. package/docs/proposals/LAT-001-gesture-visual-customization.md +522 -0
  62. package/docs/proposals/LAT-002-shared-overlay-canvas.md +353 -0
  63. package/docs/proposals/LAT-003-menu-bar-controller-architecture.md +291 -0
  64. package/docs/proposals/LAT-004-interactive-overlay-actors.md +534 -0
  65. package/docs/proposals/LAT-005-action-runtime-product-spine.md +914 -0
  66. package/docs/proposals/LAT-006-followup-gaps.md +103 -0
  67. package/docs/proposals/LAT-006-runs-and-capture-in-lattices.md +566 -0
  68. package/docs/proposals/LAT-007-unified-app-shell.md +128 -0
  69. package/docs/quickstart.md +8 -12
  70. package/docs/reference/dewey.config.ts +74 -0
  71. package/docs/reference/install-agent.md +79 -0
  72. package/docs/release.md +172 -0
  73. package/docs/repo-structure.md +100 -0
  74. package/docs/terminal-kit.md +87 -0
  75. package/docs/tiling-reference.md +224 -0
  76. package/docs/twins.md +138 -0
  77. package/docs/voice-command-protocol.md +278 -0
  78. package/docs/voice-error-model.md +73 -0
  79. package/docs/voice.md +221 -0
  80. package/package.json +69 -16
  81. package/packages/npm/sdk/cua.d.mts +1 -0
  82. package/packages/npm/sdk/cua.d.ts +188 -0
  83. package/packages/npm/sdk/cua.mjs +376 -0
  84. package/app/Lattices.app/Contents/Info.plist +0 -24
  85. package/app/Package.swift +0 -13
  86. package/app/Sources/ActionRow.swift +0 -61
  87. package/app/Sources/App.swift +0 -10
  88. package/app/Sources/AppDelegate.swift +0 -234
  89. package/app/Sources/AppShellView.swift +0 -62
  90. package/app/Sources/AppTypeClassifier.swift +0 -70
  91. package/app/Sources/AppWindowShell.swift +0 -63
  92. package/app/Sources/CheatSheetHUD.swift +0 -332
  93. package/app/Sources/CommandModeState.swift +0 -1362
  94. package/app/Sources/CommandModeView.swift +0 -1405
  95. package/app/Sources/CommandModeWindow.swift +0 -192
  96. package/app/Sources/CommandPaletteView.swift +0 -307
  97. package/app/Sources/CommandPaletteWindow.swift +0 -134
  98. package/app/Sources/DaemonProtocol.swift +0 -101
  99. package/app/Sources/DaemonServer.swift +0 -414
  100. package/app/Sources/DesktopModel.swift +0 -121
  101. package/app/Sources/DesktopModelTypes.swift +0 -71
  102. package/app/Sources/DiagnosticLog.swift +0 -271
  103. package/app/Sources/EventBus.swift +0 -30
  104. package/app/Sources/HotkeyManager.swift +0 -250
  105. package/app/Sources/HotkeyStore.swift +0 -338
  106. package/app/Sources/InventoryManager.swift +0 -35
  107. package/app/Sources/InventoryPath.swift +0 -43
  108. package/app/Sources/KeyRecorderView.swift +0 -210
  109. package/app/Sources/LatticesApi.swift +0 -1125
  110. package/app/Sources/MainView.swift +0 -467
  111. package/app/Sources/MainWindow.swift +0 -83
  112. package/app/Sources/OcrModel.swift +0 -309
  113. package/app/Sources/OcrStore.swift +0 -295
  114. package/app/Sources/OmniSearchState.swift +0 -283
  115. package/app/Sources/OmniSearchView.swift +0 -288
  116. package/app/Sources/OmniSearchWindow.swift +0 -105
  117. package/app/Sources/OrphanRow.swift +0 -129
  118. package/app/Sources/PaletteCommand.swift +0 -419
  119. package/app/Sources/PermissionChecker.swift +0 -125
  120. package/app/Sources/Preferences.swift +0 -92
  121. package/app/Sources/ProcessModel.swift +0 -199
  122. package/app/Sources/ProcessQuery.swift +0 -151
  123. package/app/Sources/Project.swift +0 -28
  124. package/app/Sources/ProjectRow.swift +0 -368
  125. package/app/Sources/ProjectScanner.swift +0 -121
  126. package/app/Sources/ScreenMapState.swift +0 -2387
  127. package/app/Sources/ScreenMapView.swift +0 -2820
  128. package/app/Sources/ScreenMapWindowController.swift +0 -89
  129. package/app/Sources/SessionManager.swift +0 -72
  130. package/app/Sources/SettingsView.swift +0 -1053
  131. package/app/Sources/SettingsWindow.swift +0 -20
  132. package/app/Sources/TabGroupRow.swift +0 -178
  133. package/app/Sources/Terminal.swift +0 -259
  134. package/app/Sources/TerminalQuery.swift +0 -156
  135. package/app/Sources/TerminalSynthesizer.swift +0 -200
  136. package/app/Sources/Theme.swift +0 -163
  137. package/app/Sources/TilePickerView.swift +0 -209
  138. package/app/Sources/TmuxModel.swift +0 -53
  139. package/app/Sources/TmuxQuery.swift +0 -81
  140. package/app/Sources/WindowTiler.swift +0 -1755
  141. package/app/Sources/WorkspaceManager.swift +0 -434
  142. package/bin/lattices-app.js +0 -221
  143. package/bin/lattices.js +0 -1418
@@ -1,332 +0,0 @@
1
- import AppKit
2
- import SwiftUI
3
-
4
- // MARK: - CheatSheetHUD (singleton window controller)
5
-
6
- final class CheatSheetHUD {
7
- static let shared = CheatSheetHUD()
8
-
9
- private var panel: NSPanel?
10
- private var localMonitor: Any?
11
- private var globalMonitor: Any?
12
-
13
- var isVisible: Bool { panel?.isVisible ?? false }
14
-
15
- func toggle() {
16
- if isVisible {
17
- dismiss()
18
- } else {
19
- show()
20
- }
21
- }
22
-
23
- func show() {
24
- guard panel == nil else { return }
25
-
26
- let view = CheatSheetView()
27
- .preferredColorScheme(.dark)
28
-
29
- let hosting = NSHostingView(rootView: view)
30
-
31
- let p = NSPanel(
32
- contentRect: NSRect(x: 0, y: 0, width: 520, height: 420),
33
- styleMask: [.borderless, .nonactivatingPanel],
34
- backing: .buffered,
35
- defer: false
36
- )
37
- p.isOpaque = false
38
- p.backgroundColor = .clear
39
- p.level = .floating
40
- p.hasShadow = true
41
- p.hidesOnDeactivate = false
42
- p.isReleasedWhenClosed = false
43
- p.isMovableByWindowBackground = false
44
- p.contentView = hosting
45
-
46
- // Center on the screen containing the mouse cursor
47
- let mouseLocation = NSEvent.mouseLocation
48
- let screen = NSScreen.screens.first(where: { $0.frame.contains(mouseLocation) }) ?? NSScreen.main ?? NSScreen.screens.first!
49
- let screenFrame = screen.visibleFrame
50
- let x = screenFrame.midX - 260
51
- let y = screenFrame.midY - 210
52
- p.setFrameOrigin(NSPoint(x: x, y: y))
53
-
54
- p.alphaValue = 0
55
- p.orderFrontRegardless()
56
-
57
- NSAnimationContext.runAnimationGroup { ctx in
58
- ctx.duration = 0.15
59
- p.animator().alphaValue = 1.0
60
- }
61
-
62
- self.panel = p
63
- installMonitors()
64
- }
65
-
66
- func dismiss() {
67
- guard let p = panel else { return }
68
- removeMonitors()
69
-
70
- NSAnimationContext.runAnimationGroup({ ctx in
71
- ctx.duration = 0.2
72
- p.animator().alphaValue = 0
73
- }) { [weak self] in
74
- p.orderOut(nil)
75
- self?.panel = nil
76
- }
77
- }
78
-
79
- // MARK: - Event monitors
80
-
81
- private func installMonitors() {
82
- // Escape key dismisses (global — panel is non-activating so keys go to frontmost app)
83
- localMonitor = NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { [weak self] event in
84
- if event.keyCode == 53 { // Escape
85
- self?.dismiss()
86
- }
87
- }
88
-
89
- // Click outside dismisses
90
- globalMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.leftMouseDown, .rightMouseDown]) { [weak self] _ in
91
- self?.dismiss()
92
- }
93
- }
94
-
95
- private func removeMonitors() {
96
- if let m = localMonitor { NSEvent.removeMonitor(m); localMonitor = nil }
97
- if let m = globalMonitor { NSEvent.removeMonitor(m); globalMonitor = nil }
98
- }
99
-
100
- }
101
-
102
- // MARK: - CheatSheetView
103
-
104
- struct CheatSheetView: View {
105
- @ObservedObject private var hotkeyStore = HotkeyStore.shared
106
-
107
- var body: some View {
108
- VStack(spacing: 0) {
109
- // Title
110
- HStack {
111
- Text("KEYBOARD SHORTCUTS")
112
- .font(Typo.pixel(14))
113
- .foregroundColor(Palette.textDim)
114
- .tracking(1)
115
- Spacer()
116
- }
117
- .padding(.horizontal, 20)
118
- .padding(.top, 16)
119
- .padding(.bottom, 10)
120
-
121
- Rectangle().fill(Palette.border).frame(height: 0.5)
122
-
123
- // Two-column body
124
- HStack(alignment: .top, spacing: 20) {
125
- // Left column: Tiling
126
- tilingColumn
127
-
128
- Rectangle().fill(Palette.border).frame(width: 0.5)
129
-
130
- // Right column: App + tmux
131
- VStack(alignment: .leading, spacing: 16) {
132
- appColumn
133
- Rectangle().fill(Palette.border).frame(height: 0.5)
134
- tmuxColumn
135
- }
136
- .frame(maxWidth: .infinity, alignment: .leading)
137
- }
138
- .padding(.horizontal, 20)
139
- .padding(.vertical, 14)
140
-
141
- Spacer(minLength: 0)
142
-
143
- Rectangle().fill(Palette.border).frame(height: 0.5)
144
-
145
- // Footer
146
- HStack {
147
- Spacer()
148
- Text("Press ESC to dismiss")
149
- .font(Typo.caption(10))
150
- .foregroundColor(Palette.textMuted)
151
- Spacer()
152
- }
153
- .padding(.vertical, 8)
154
- }
155
- .frame(width: 520, height: 420)
156
- .background(
157
- RoundedRectangle(cornerRadius: 12)
158
- .fill(Palette.bg)
159
- .overlay(
160
- RoundedRectangle(cornerRadius: 12)
161
- .strokeBorder(Palette.borderLit, lineWidth: 0.5)
162
- )
163
- )
164
- .clipShape(RoundedRectangle(cornerRadius: 12))
165
- }
166
-
167
- // MARK: - Tiling Column
168
-
169
- private var tilingColumn: some View {
170
- VStack(alignment: .leading, spacing: 10) {
171
- columnHeader("Tiling")
172
-
173
- // 3x3 grid
174
- VStack(spacing: 2) {
175
- HStack(spacing: 2) {
176
- tileCell(action: .tileTopLeft, label: "TL")
177
- tileCell(action: .tileTop, label: "Top")
178
- tileCell(action: .tileTopRight, label: "TR")
179
- }
180
- HStack(spacing: 2) {
181
- tileCell(action: .tileLeft, label: "Left")
182
- tileCell(action: .tileMaximize, label: "Max")
183
- tileCell(action: .tileRight, label: "Right")
184
- }
185
- HStack(spacing: 2) {
186
- tileCell(action: .tileBottomLeft, label: "BL")
187
- tileCell(action: .tileBottom, label: "Bot")
188
- tileCell(action: .tileBottomRight, label: "BR")
189
- }
190
- }
191
- .padding(6)
192
- .background(
193
- RoundedRectangle(cornerRadius: 6)
194
- .fill(Color.black.opacity(0.25))
195
- .overlay(
196
- RoundedRectangle(cornerRadius: 6)
197
- .strokeBorder(Palette.border, lineWidth: 0.5)
198
- )
199
- )
200
-
201
- // Thirds row
202
- HStack(spacing: 2) {
203
- tileCell(action: .tileLeftThird, label: "\u{2153}L")
204
- tileCell(action: .tileCenterThird, label: "\u{2153}C")
205
- tileCell(action: .tileRightThird, label: "\u{2153}R")
206
- }
207
- .padding(6)
208
- .background(
209
- RoundedRectangle(cornerRadius: 6)
210
- .fill(Color.black.opacity(0.25))
211
- .overlay(
212
- RoundedRectangle(cornerRadius: 6)
213
- .strokeBorder(Palette.border, lineWidth: 0.5)
214
- )
215
- )
216
-
217
- // Center + Distribute
218
- shortcutRow(action: .tileCenter)
219
- shortcutRow(action: .tileDistribute)
220
- }
221
- .frame(maxWidth: .infinity, alignment: .leading)
222
- }
223
-
224
- // MARK: - App Column
225
-
226
- private var appColumn: some View {
227
- VStack(alignment: .leading, spacing: 8) {
228
- columnHeader("App")
229
-
230
- shortcutRow(action: .palette)
231
- shortcutRow(action: .screenMap)
232
- shortcutRow(action: .bezel)
233
- shortcutRow(action: .cheatSheet)
234
- shortcutRow(action: .desktopInventory)
235
- }
236
- }
237
-
238
- // MARK: - tmux Column
239
-
240
- private var tmuxColumn: some View {
241
- VStack(alignment: .leading, spacing: 6) {
242
- columnHeader("Inside tmux")
243
-
244
- tmuxRow("Detach", keys: ["Ctrl+B", "D"])
245
- tmuxRow("Kill pane", keys: ["Ctrl+B", "X"])
246
- tmuxRow("Pane left", keys: ["Ctrl+B", "\u{2190}"])
247
- tmuxRow("Pane right", keys: ["Ctrl+B", "\u{2192}"])
248
- tmuxRow("Zoom toggle", keys: ["Ctrl+B", "Z"])
249
- tmuxRow("Scroll mode", keys: ["Ctrl+B", "["])
250
- }
251
- }
252
-
253
- // MARK: - Shared components
254
-
255
- private func columnHeader(_ title: String) -> some View {
256
- Text(title.uppercased())
257
- .font(Typo.pixel(12))
258
- .foregroundColor(Palette.textDim)
259
- .tracking(1)
260
- }
261
-
262
- private func tileCell(action: HotkeyAction, label: String) -> some View {
263
- let binding = hotkeyStore.bindings[action]
264
- let badgeText = binding?.displayParts.last ?? ""
265
-
266
- return VStack(spacing: 3) {
267
- Text(label)
268
- .font(Typo.caption(9))
269
- .foregroundColor(Palette.textDim)
270
- Text(badgeText)
271
- .font(Typo.geistMonoBold(9))
272
- .foregroundColor(Palette.text)
273
- }
274
- .frame(maxWidth: .infinity)
275
- .frame(height: 38)
276
- .background(
277
- RoundedRectangle(cornerRadius: 4)
278
- .fill(Palette.surface)
279
- .overlay(
280
- RoundedRectangle(cornerRadius: 4)
281
- .strokeBorder(Palette.border, lineWidth: 0.5)
282
- )
283
- )
284
- }
285
-
286
- private func shortcutRow(action: HotkeyAction) -> some View {
287
- let binding = hotkeyStore.bindings[action]
288
- return HStack(spacing: 8) {
289
- if let parts = binding?.displayParts {
290
- HStack(spacing: 3) {
291
- ForEach(parts, id: \.self) { part in
292
- keyBadge(part)
293
- }
294
- }
295
- }
296
- Text(action.label)
297
- .font(Typo.caption(11))
298
- .foregroundColor(Palette.textDim)
299
- Spacer()
300
- }
301
- }
302
-
303
- private func tmuxRow(_ label: String, keys: [String]) -> some View {
304
- HStack(spacing: 8) {
305
- HStack(spacing: 3) {
306
- ForEach(keys, id: \.self) { key in
307
- keyBadge(key)
308
- }
309
- }
310
- Text(label)
311
- .font(Typo.caption(11))
312
- .foregroundColor(Palette.textDim)
313
- Spacer()
314
- }
315
- }
316
-
317
- private func keyBadge(_ key: String) -> some View {
318
- Text(key)
319
- .font(Typo.geistMonoBold(10))
320
- .foregroundColor(Palette.text)
321
- .padding(.horizontal, 6)
322
- .padding(.vertical, 3)
323
- .background(
324
- RoundedRectangle(cornerRadius: 3)
325
- .fill(Palette.surface)
326
- .overlay(
327
- RoundedRectangle(cornerRadius: 3)
328
- .strokeBorder(Palette.border, lineWidth: 0.5)
329
- )
330
- )
331
- }
332
- }