@lattices/cli 0.3.0 → 0.4.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.
- package/README.md +85 -9
- package/app/Info.plist +30 -0
- package/app/Lattices.app/Contents/Info.plist +8 -2
- package/app/Lattices.app/Contents/MacOS/Lattices +0 -0
- package/app/Lattices.app/Contents/Resources/AppIcon.icns +0 -0
- package/app/Lattices.app/Contents/Resources/tap.wav +0 -0
- package/app/Lattices.app/Contents/_CodeSignature/CodeResources +139 -0
- package/app/Lattices.entitlements +15 -0
- package/app/Package.swift +8 -1
- package/app/Resources/tap.wav +0 -0
- package/app/Sources/AdvisorLearningStore.swift +90 -0
- package/app/Sources/AgentSession.swift +377 -0
- package/app/Sources/AppDelegate.swift +45 -12
- package/app/Sources/AppShellView.swift +81 -8
- package/app/Sources/AudioProvider.swift +386 -0
- package/app/Sources/CheatSheetHUD.swift +261 -19
- package/app/Sources/DaemonProtocol.swift +13 -0
- package/app/Sources/DaemonServer.swift +8 -0
- package/app/Sources/DesktopModel.swift +189 -6
- package/app/Sources/DesktopModelTypes.swift +2 -0
- package/app/Sources/DiagnosticLog.swift +104 -2
- package/app/Sources/EventBus.swift +1 -0
- package/app/Sources/HUDBottomBar.swift +279 -0
- package/app/Sources/HUDController.swift +1158 -0
- package/app/Sources/HUDLeftBar.swift +849 -0
- package/app/Sources/HUDMinimap.swift +179 -0
- package/app/Sources/HUDRightBar.swift +774 -0
- package/app/Sources/HUDState.swift +367 -0
- package/app/Sources/HUDTopBar.swift +243 -0
- package/app/Sources/HandsOffSession.swift +802 -0
- package/app/Sources/HomeDashboardView.swift +125 -0
- package/app/Sources/HotkeyManager.swift +2 -0
- package/app/Sources/HotkeyStore.swift +49 -9
- package/app/Sources/IntentEngine.swift +962 -0
- package/app/Sources/Intents/CreateLayerIntent.swift +54 -0
- package/app/Sources/Intents/DistributeIntent.swift +56 -0
- package/app/Sources/Intents/FocusIntent.swift +69 -0
- package/app/Sources/Intents/HelpIntent.swift +41 -0
- package/app/Sources/Intents/KillIntent.swift +47 -0
- package/app/Sources/Intents/LatticeIntent.swift +78 -0
- package/app/Sources/Intents/LaunchIntent.swift +67 -0
- package/app/Sources/Intents/ListSessionsIntent.swift +32 -0
- package/app/Sources/Intents/ListWindowsIntent.swift +30 -0
- package/app/Sources/Intents/ScanIntent.swift +52 -0
- package/app/Sources/Intents/SearchIntent.swift +190 -0
- package/app/Sources/Intents/SwitchLayerIntent.swift +50 -0
- package/app/Sources/Intents/TileIntent.swift +61 -0
- package/app/Sources/LatticesApi.swift +1275 -30
- package/app/Sources/LauncherHUD.swift +348 -0
- package/app/Sources/MainView.swift +147 -44
- package/app/Sources/MouseFinder.swift +222 -0
- package/app/Sources/OcrModel.swift +34 -1
- package/app/Sources/OmniSearchState.swift +99 -102
- package/app/Sources/OnboardingView.swift +457 -0
- package/app/Sources/PermissionChecker.swift +2 -12
- package/app/Sources/PiChatDock.swift +454 -0
- package/app/Sources/PiChatSession.swift +815 -0
- package/app/Sources/PiWorkspaceView.swift +364 -0
- package/app/Sources/PlacementSpec.swift +195 -0
- package/app/Sources/Preferences.swift +59 -0
- package/app/Sources/ProjectScanner.swift +58 -45
- package/app/Sources/ScreenMapState.swift +701 -55
- package/app/Sources/ScreenMapView.swift +843 -103
- package/app/Sources/ScreenMapWindowController.swift +22 -0
- package/app/Sources/SessionLayerStore.swift +285 -0
- package/app/Sources/SessionManager.swift +4 -1
- package/app/Sources/SettingsView.swift +186 -3
- package/app/Sources/Theme.swift +9 -8
- package/app/Sources/TmuxModel.swift +7 -0
- package/app/Sources/TmuxQuery.swift +27 -3
- package/app/Sources/VoiceChatView.swift +192 -0
- package/app/Sources/VoiceCommandWindow.swift +1594 -0
- package/app/Sources/VoiceIntentResolver.swift +671 -0
- package/app/Sources/VoxClient.swift +454 -0
- package/app/Sources/WindowTiler.swift +348 -87
- package/app/Sources/WorkspaceManager.swift +127 -18
- package/app/Tests/StageDragTests.swift +333 -0
- package/app/Tests/StageJoinTests.swift +313 -0
- package/app/Tests/StageManagerTests.swift +280 -0
- package/app/Tests/StageTileTests.swift +353 -0
- package/assets/AppIcon.icns +0 -0
- package/bin/client.ts +16 -0
- package/bin/{daemon-client.js → daemon-client.ts} +49 -30
- package/bin/handsoff-infer.ts +280 -0
- package/bin/handsoff-worker.ts +740 -0
- package/bin/lattices-app.ts +338 -0
- package/bin/lattices-dev +208 -0
- package/bin/{lattices.js → lattices.ts} +777 -140
- package/bin/project-twin.ts +645 -0
- package/docs/agent-execution-plan.md +562 -0
- package/docs/agent-layer-guide.md +207 -0
- package/docs/agents.md +142 -0
- package/docs/api.md +153 -34
- package/docs/app.md +29 -1
- package/docs/config.md +5 -1
- package/docs/handsoff-test-scenarios.md +84 -0
- package/docs/layers.md +20 -20
- package/docs/ocr.md +14 -5
- package/docs/overview.md +5 -1
- package/docs/presentation-execution-review.md +491 -0
- package/docs/prompts/hands-off-system.md +374 -0
- package/docs/prompts/hands-off-turn.md +30 -0
- package/docs/prompts/voice-advisor.md +31 -0
- package/docs/prompts/voice-fallback.md +23 -0
- package/docs/tiling-reference.md +167 -0
- package/docs/twins.md +138 -0
- package/docs/voice-command-protocol.md +278 -0
- package/docs/voice.md +219 -0
- package/package.json +29 -11
- package/bin/client.js +0 -4
- package/bin/lattices-app.js +0 -221
package/bin/lattices-app.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { execSync, spawn } from "node:child_process";
|
|
4
|
-
import { existsSync, mkdirSync, chmodSync, createWriteStream } from "node:fs";
|
|
5
|
-
import { resolve, dirname } from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { get } from "node:https";
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const appDir = resolve(__dirname, "../app");
|
|
11
|
-
const bundlePath = resolve(appDir, "Lattices.app");
|
|
12
|
-
const binaryDir = resolve(bundlePath, "Contents/MacOS");
|
|
13
|
-
const binaryPath = resolve(binaryDir, "Lattices");
|
|
14
|
-
|
|
15
|
-
const REPO = "arach/lattices";
|
|
16
|
-
const ASSET_NAME = "Lattices-macos-arm64";
|
|
17
|
-
|
|
18
|
-
// ── Helpers ──────────────────────────────────────────────────────────
|
|
19
|
-
|
|
20
|
-
function isRunning() {
|
|
21
|
-
try {
|
|
22
|
-
execSync("pgrep -x Lattices", { stdio: "pipe" });
|
|
23
|
-
return true;
|
|
24
|
-
} catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function quit() {
|
|
30
|
-
try {
|
|
31
|
-
execSync("pkill -x Lattices", { stdio: "pipe" });
|
|
32
|
-
// Wait briefly for process to exit
|
|
33
|
-
try { execSync("sleep 0.5", { stdio: "pipe" }); } catch {}
|
|
34
|
-
// Force kill if still running
|
|
35
|
-
if (isRunning()) {
|
|
36
|
-
execSync("pkill -9 -x Lattices", { stdio: "pipe" });
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
} catch {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function hasSwift() {
|
|
45
|
-
try {
|
|
46
|
-
execSync("which swift", { stdio: "pipe" });
|
|
47
|
-
return true;
|
|
48
|
-
} catch {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function launch(extraArgs = []) {
|
|
54
|
-
if (isRunning()) {
|
|
55
|
-
console.log("lattices app is already running.");
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const args = [bundlePath];
|
|
59
|
-
if (extraArgs.length) args.push("--args", ...extraArgs);
|
|
60
|
-
spawn("open", args, { detached: true, stdio: "ignore" }).unref();
|
|
61
|
-
console.log("lattices app launched.");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ── Build from source (current arch only) ────────────────────────────
|
|
65
|
-
|
|
66
|
-
function buildFromSource() {
|
|
67
|
-
console.log("Building lattices app from source...");
|
|
68
|
-
try {
|
|
69
|
-
execSync("swift build -c release", {
|
|
70
|
-
cwd: appDir,
|
|
71
|
-
stdio: "inherit",
|
|
72
|
-
});
|
|
73
|
-
} catch {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const builtPath = resolve(appDir, ".build/release/Lattices");
|
|
78
|
-
if (!existsSync(builtPath)) return false;
|
|
79
|
-
|
|
80
|
-
mkdirSync(binaryDir, { recursive: true });
|
|
81
|
-
execSync(`cp '${builtPath}' '${binaryPath}'`);
|
|
82
|
-
|
|
83
|
-
// Copy app icon into bundle
|
|
84
|
-
const iconSrc = resolve(__dirname, "../assets/AppIcon.icns");
|
|
85
|
-
const resourcesDir = resolve(bundlePath, "Contents/Resources");
|
|
86
|
-
mkdirSync(resourcesDir, { recursive: true });
|
|
87
|
-
if (existsSync(iconSrc)) {
|
|
88
|
-
execSync(`cp '${iconSrc}' '${resolve(resourcesDir, "AppIcon.icns")}'`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Re-sign the bundle so macOS TCC recognizes a stable identity across rebuilds.
|
|
92
|
-
// Without this, each build gets a new ad-hoc signature and permission grants are lost.
|
|
93
|
-
try {
|
|
94
|
-
// Prefer a real signing identity for stable TCC grants; fall back to ad-hoc with fixed identifier
|
|
95
|
-
const identities = execSync("security find-identity -v -p codesigning", { stdio: "pipe" }).toString();
|
|
96
|
-
const devId = identities.match(/"(Developer ID Application:[^"]+)"/)?.[1]
|
|
97
|
-
|| identities.match(/"(Apple Development:[^"]+)"/)?.[1];
|
|
98
|
-
const signArg = devId ? `'${devId}'` : "-";
|
|
99
|
-
execSync(
|
|
100
|
-
`codesign --force --sign ${signArg} --identifier com.arach.lattices '${bundlePath}'`,
|
|
101
|
-
{ stdio: "pipe" }
|
|
102
|
-
);
|
|
103
|
-
} catch (e) {
|
|
104
|
-
// Non-fatal — app still works, just permissions won't persist across rebuilds
|
|
105
|
-
console.log("Warning: code signing failed — permissions may not persist across rebuilds.");
|
|
106
|
-
}
|
|
107
|
-
// Update bundle timestamp so Finder shows the correct modified date
|
|
108
|
-
try { execSync(`touch '${bundlePath}'`, { stdio: "pipe" }); } catch {}
|
|
109
|
-
console.log("Build complete.");
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// ── Download from GitHub releases ────────────────────────────────────
|
|
114
|
-
|
|
115
|
-
function httpsGet(url) {
|
|
116
|
-
return new Promise((resolve, reject) => {
|
|
117
|
-
get(url, { headers: { "User-Agent": "lattices" } }, (res) => {
|
|
118
|
-
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
119
|
-
return httpsGet(res.headers.location).then(resolve, reject);
|
|
120
|
-
}
|
|
121
|
-
if (res.statusCode !== 200) {
|
|
122
|
-
reject(new Error(`HTTP ${res.statusCode}`));
|
|
123
|
-
res.resume();
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
resolve(res);
|
|
127
|
-
}).on("error", reject);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
async function download() {
|
|
132
|
-
console.log("Downloading pre-built binary...");
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
const apiUrl = `https://api.github.com/repos/${REPO}/releases/latest`;
|
|
136
|
-
const apiRes = await httpsGet(apiUrl);
|
|
137
|
-
const chunks = [];
|
|
138
|
-
for await (const chunk of apiRes) chunks.push(chunk);
|
|
139
|
-
const release = JSON.parse(Buffer.concat(chunks).toString());
|
|
140
|
-
|
|
141
|
-
const asset = release.assets?.find((a) => a.name === ASSET_NAME);
|
|
142
|
-
if (!asset) throw new Error("Binary not found in release assets");
|
|
143
|
-
|
|
144
|
-
const dlRes = await httpsGet(asset.browser_download_url);
|
|
145
|
-
|
|
146
|
-
mkdirSync(binaryDir, { recursive: true });
|
|
147
|
-
const ws = createWriteStream(binaryPath);
|
|
148
|
-
await new Promise((resolve, reject) => {
|
|
149
|
-
dlRes.pipe(ws);
|
|
150
|
-
ws.on("finish", resolve);
|
|
151
|
-
ws.on("error", reject);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
chmodSync(binaryPath, 0o755);
|
|
155
|
-
console.log("Download complete.");
|
|
156
|
-
return true;
|
|
157
|
-
} catch (e) {
|
|
158
|
-
console.log(`Download failed: ${e.message}`);
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// ── Commands ─────────────────────────────────────────────────────────
|
|
164
|
-
|
|
165
|
-
async function ensureBinary() {
|
|
166
|
-
if (existsSync(binaryPath)) return;
|
|
167
|
-
|
|
168
|
-
// 1. Try local compile (fast, matches exact system)
|
|
169
|
-
if (hasSwift()) {
|
|
170
|
-
if (buildFromSource()) return;
|
|
171
|
-
console.log("Local build failed, trying download...");
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// 2. Fall back to pre-built binary from GitHub releases
|
|
175
|
-
const downloaded = await download();
|
|
176
|
-
if (downloaded) return;
|
|
177
|
-
|
|
178
|
-
// 3. Nothing worked
|
|
179
|
-
console.error(
|
|
180
|
-
"Could not build or download the lattices app.\n" +
|
|
181
|
-
"Options:\n" +
|
|
182
|
-
" • Install Xcode CLI tools: xcode-select --install\n" +
|
|
183
|
-
" • Download manually from: https://github.com/" + REPO + "/releases"
|
|
184
|
-
);
|
|
185
|
-
process.exit(1);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const cmd = process.argv[2];
|
|
189
|
-
const flags = process.argv.slice(3);
|
|
190
|
-
const launchFlags = [];
|
|
191
|
-
if (flags.includes("--diagnostics") || flags.includes("-d")) launchFlags.push("--diagnostics");
|
|
192
|
-
if (flags.includes("--screen-map") || flags.includes("-m")) launchFlags.push("--screen-map");
|
|
193
|
-
|
|
194
|
-
if (cmd === "build") {
|
|
195
|
-
if (!hasSwift()) {
|
|
196
|
-
console.error("Swift is required. Install with: xcode-select --install");
|
|
197
|
-
process.exit(1);
|
|
198
|
-
}
|
|
199
|
-
buildFromSource();
|
|
200
|
-
} else if (cmd === "quit") {
|
|
201
|
-
if (quit()) {
|
|
202
|
-
console.log("lattices app stopped.");
|
|
203
|
-
} else {
|
|
204
|
-
console.log("lattices app is not running.");
|
|
205
|
-
}
|
|
206
|
-
} else if (cmd === "restart") {
|
|
207
|
-
// Quit → rebuild → relaunch
|
|
208
|
-
quit();
|
|
209
|
-
if (!hasSwift()) {
|
|
210
|
-
console.error("Swift is required. Install with: xcode-select --install");
|
|
211
|
-
process.exit(1);
|
|
212
|
-
}
|
|
213
|
-
if (!buildFromSource()) {
|
|
214
|
-
console.error("Build failed.");
|
|
215
|
-
process.exit(1);
|
|
216
|
-
}
|
|
217
|
-
launch(launchFlags);
|
|
218
|
-
} else {
|
|
219
|
-
await ensureBinary();
|
|
220
|
-
launch(launchFlags);
|
|
221
|
-
}
|