@cydm/pie 1.0.51 → 2.1.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 +32 -15
- package/dist/builtin/extensions/ask-user/index.js +4 -3
- package/dist/builtin/extensions/ask-user/package.json +8 -7
- package/dist/builtin/extensions/changelog/package.json +9 -9
- package/dist/builtin/extensions/computer-use/index.js +5466 -0
- package/dist/builtin/extensions/computer-use/package.json +11 -0
- package/dist/builtin/extensions/computer-use/prebuilt/linux/arm64/linux-bridge +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/linux/x64/linux-bridge +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/arm64/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/universal/pie-computer-use.app/Contents/Info.plist +24 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/universal/pie-computer-use.app/Contents/MacOS/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/universal/pie-computer-use.app/Contents/_CodeSignature/CodeResources +115 -0
- package/dist/builtin/extensions/computer-use/prebuilt/macos/x64/pie-computer-use +0 -0
- package/dist/builtin/extensions/computer-use/prebuilt/windows/windows-bridge.exe +0 -0
- package/dist/builtin/extensions/computer-use/scripts/build-native.mjs +277 -0
- package/dist/builtin/extensions/computer-use/scripts/helper-path.mjs +48 -0
- package/dist/builtin/extensions/computer-use/scripts/setup-helper.mjs +549 -0
- package/dist/builtin/extensions/document-attachments/package.json +9 -9
- package/dist/builtin/extensions/init/package.json +9 -9
- package/dist/builtin/extensions/mcp-adapter/index.js +25250 -0
- package/dist/builtin/extensions/mcp-adapter/package.json +11 -0
- package/dist/builtin/extensions/plan-mode/index.js +4 -3
- package/dist/builtin/extensions/plan-mode/package.json +9 -9
- package/dist/builtin/extensions/subagent/index.js +6 -4
- package/dist/builtin/extensions/subagent/package.json +16 -12
- package/dist/builtin/extensions/todo/index.js +4 -3
- package/dist/builtin/extensions/todo/package.json +9 -9
- package/dist/builtin/skills/chrome-devtools-axi/CHANGELOG.md +5 -0
- package/dist/builtin/skills/chrome-devtools-axi/README.md +17 -0
- package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +31 -0
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-cli.js +77 -0
- package/dist/builtin/skills/chrome-devtools-axi/package.json +12 -0
- package/dist/builtin/skills/tui-use/README.md +7 -0
- package/dist/builtin/skills/tui-use/SKILL.md +58 -0
- package/dist/chunks/chunk-5353DEEC.js +130 -0
- package/dist/chunks/{chunk-KDPAGHYY.js → chunk-G2POWIA5.js} +129 -194
- package/dist/chunks/{chunk-S2J3SZZX.js → chunk-IM43UYVV.js} +827 -3385
- package/dist/chunks/{chunk-A644H2XX.js → chunk-PMPD56N2.js} +159 -72
- package/dist/chunks/{chunk-B3SMW2XW.js → chunk-QJH6YN2W.js} +1 -1
- package/dist/chunks/chunk-XXGYUYXI.js +2718 -0
- package/dist/chunks/{src-UKCIAX6F.js → src-QSP2OPHU.js} +3 -2
- package/dist/chunks/{test-stream-NCBFPM2I.js → test-stream-CVGWFLSX.js} +2 -1
- package/dist/chunks/webapi-MBCKO7ZV.js +2481 -0
- package/dist/cli.js +149 -68
- package/package.json +5 -4
- package/dist/builtin/skills/browser-tools/CHANGELOG.md +0 -5
- package/dist/builtin/skills/browser-tools/README.md +0 -17
- package/dist/builtin/skills/browser-tools/SKILL.md +0 -43
- package/dist/builtin/skills/browser-tools/package.json +0 -12
- package/dist/builtin/skills/browser-tools/playwright-cli.js +0 -45
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie/extension-computer-use",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Desktop computer-use tools (observe/act) vendored from @injaneity/pi-computer-use",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"pie": {
|
|
8
|
+
"name": "computer-use",
|
|
9
|
+
"main": "index.js"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDisplayName</key>
|
|
6
|
+
<string>pie-computer-use</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>pie-computer-use</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>com.pie.computer-use</string>
|
|
11
|
+
<key>CFBundleName</key>
|
|
12
|
+
<string>pie-computer-use</string>
|
|
13
|
+
<key>CFBundlePackageType</key>
|
|
14
|
+
<string>APPL</string>
|
|
15
|
+
<key>CFBundleShortVersionString</key>
|
|
16
|
+
<string>0.5.1</string>
|
|
17
|
+
<key>CFBundleVersion</key>
|
|
18
|
+
<string>0.5.1</string>
|
|
19
|
+
<key>LSMinimumSystemVersion</key>
|
|
20
|
+
<string>14.0</string>
|
|
21
|
+
<key>LSUIElement</key>
|
|
22
|
+
<true/>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>files</key>
|
|
6
|
+
<dict/>
|
|
7
|
+
<key>files2</key>
|
|
8
|
+
<dict/>
|
|
9
|
+
<key>rules</key>
|
|
10
|
+
<dict>
|
|
11
|
+
<key>^Resources/</key>
|
|
12
|
+
<true/>
|
|
13
|
+
<key>^Resources/.*\.lproj/</key>
|
|
14
|
+
<dict>
|
|
15
|
+
<key>optional</key>
|
|
16
|
+
<true/>
|
|
17
|
+
<key>weight</key>
|
|
18
|
+
<real>1000</real>
|
|
19
|
+
</dict>
|
|
20
|
+
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
|
21
|
+
<dict>
|
|
22
|
+
<key>omit</key>
|
|
23
|
+
<true/>
|
|
24
|
+
<key>weight</key>
|
|
25
|
+
<real>1100</real>
|
|
26
|
+
</dict>
|
|
27
|
+
<key>^Resources/Base\.lproj/</key>
|
|
28
|
+
<dict>
|
|
29
|
+
<key>weight</key>
|
|
30
|
+
<real>1010</real>
|
|
31
|
+
</dict>
|
|
32
|
+
<key>^version.plist$</key>
|
|
33
|
+
<true/>
|
|
34
|
+
</dict>
|
|
35
|
+
<key>rules2</key>
|
|
36
|
+
<dict>
|
|
37
|
+
<key>.*\.dSYM($|/)</key>
|
|
38
|
+
<dict>
|
|
39
|
+
<key>weight</key>
|
|
40
|
+
<real>11</real>
|
|
41
|
+
</dict>
|
|
42
|
+
<key>^(.*/)?\.DS_Store$</key>
|
|
43
|
+
<dict>
|
|
44
|
+
<key>omit</key>
|
|
45
|
+
<true/>
|
|
46
|
+
<key>weight</key>
|
|
47
|
+
<real>2000</real>
|
|
48
|
+
</dict>
|
|
49
|
+
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
|
50
|
+
<dict>
|
|
51
|
+
<key>nested</key>
|
|
52
|
+
<true/>
|
|
53
|
+
<key>weight</key>
|
|
54
|
+
<real>10</real>
|
|
55
|
+
</dict>
|
|
56
|
+
<key>^.*</key>
|
|
57
|
+
<true/>
|
|
58
|
+
<key>^Info\.plist$</key>
|
|
59
|
+
<dict>
|
|
60
|
+
<key>omit</key>
|
|
61
|
+
<true/>
|
|
62
|
+
<key>weight</key>
|
|
63
|
+
<real>20</real>
|
|
64
|
+
</dict>
|
|
65
|
+
<key>^PkgInfo$</key>
|
|
66
|
+
<dict>
|
|
67
|
+
<key>omit</key>
|
|
68
|
+
<true/>
|
|
69
|
+
<key>weight</key>
|
|
70
|
+
<real>20</real>
|
|
71
|
+
</dict>
|
|
72
|
+
<key>^Resources/</key>
|
|
73
|
+
<dict>
|
|
74
|
+
<key>weight</key>
|
|
75
|
+
<real>20</real>
|
|
76
|
+
</dict>
|
|
77
|
+
<key>^Resources/.*\.lproj/</key>
|
|
78
|
+
<dict>
|
|
79
|
+
<key>optional</key>
|
|
80
|
+
<true/>
|
|
81
|
+
<key>weight</key>
|
|
82
|
+
<real>1000</real>
|
|
83
|
+
</dict>
|
|
84
|
+
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
|
85
|
+
<dict>
|
|
86
|
+
<key>omit</key>
|
|
87
|
+
<true/>
|
|
88
|
+
<key>weight</key>
|
|
89
|
+
<real>1100</real>
|
|
90
|
+
</dict>
|
|
91
|
+
<key>^Resources/Base\.lproj/</key>
|
|
92
|
+
<dict>
|
|
93
|
+
<key>weight</key>
|
|
94
|
+
<real>1010</real>
|
|
95
|
+
</dict>
|
|
96
|
+
<key>^[^/]+$</key>
|
|
97
|
+
<dict>
|
|
98
|
+
<key>nested</key>
|
|
99
|
+
<true/>
|
|
100
|
+
<key>weight</key>
|
|
101
|
+
<real>10</real>
|
|
102
|
+
</dict>
|
|
103
|
+
<key>^embedded\.provisionprofile$</key>
|
|
104
|
+
<dict>
|
|
105
|
+
<key>weight</key>
|
|
106
|
+
<real>20</real>
|
|
107
|
+
</dict>
|
|
108
|
+
<key>^version\.plist$</key>
|
|
109
|
+
<dict>
|
|
110
|
+
<key>weight</key>
|
|
111
|
+
<real>20</real>
|
|
112
|
+
</dict>
|
|
113
|
+
</dict>
|
|
114
|
+
</dict>
|
|
115
|
+
</plist>
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import fs from "node:fs/promises";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
10
|
+
const macosSourcePaths = [
|
|
11
|
+
"agent_cursor.swift",
|
|
12
|
+
"agent_cursor_motion.swift",
|
|
13
|
+
"bridge.swift",
|
|
14
|
+
].map((file) => path.join(rootDir, "native", "macos", file));
|
|
15
|
+
const windowsCrateDir = path.join(rootDir, "native", "windows", "bridge-rs");
|
|
16
|
+
const linuxCrateDir = path.join(rootDir, "native", "linux", "bridge-rs");
|
|
17
|
+
const linuxTargets = { x64: "x86_64-unknown-linux-gnu", arm64: "aarch64-unknown-linux-gnu" };
|
|
18
|
+
const archTriples = {
|
|
19
|
+
arm64: "arm64-apple-macosx",
|
|
20
|
+
x64: "x86_64-apple-macosx",
|
|
21
|
+
};
|
|
22
|
+
const deploymentTarget = "14.0";
|
|
23
|
+
const frameworks = ["ApplicationServices", "AppKit", "ScreenCaptureKit", "Foundation", "SwiftUI"];
|
|
24
|
+
const defaultCodeSignIdentifier = "com.pie.computer-use";
|
|
25
|
+
|
|
26
|
+
async function exists(filePath) {
|
|
27
|
+
try {
|
|
28
|
+
await fs.access(filePath);
|
|
29
|
+
return true;
|
|
30
|
+
} catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getArg(name) {
|
|
36
|
+
const index = process.argv.indexOf(name);
|
|
37
|
+
if (index >= 0 && index + 1 < process.argv.length) {
|
|
38
|
+
return process.argv[index + 1];
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function hasArg(name) {
|
|
44
|
+
return process.argv.includes(name);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function normalizeArch(arch) {
|
|
48
|
+
if (arch === "universal" || arch === "all") return arch;
|
|
49
|
+
if (arch === "arm64" || arch === "x64") return arch;
|
|
50
|
+
throw new Error(`Unsupported architecture '${arch}'. Supported: arm64, x64, universal, all.`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function run(command, args) {
|
|
54
|
+
await new Promise((resolve, reject) => {
|
|
55
|
+
const child = spawn(command, args, { stdio: "inherit" });
|
|
56
|
+
child.on("error", reject);
|
|
57
|
+
child.on("close", (code) => {
|
|
58
|
+
if (code === 0) {
|
|
59
|
+
resolve();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
reject(new Error(`Command failed (${code}): ${command} ${args.join(" ")}`));
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function defaultOutputPath(arch) {
|
|
68
|
+
return path.join(rootDir, "prebuilt", "macos", arch, "pie-computer-use");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function moduleCachePath(arch) {
|
|
72
|
+
return path.join(os.tmpdir(), `pie-computer-use-swift-module-cache-${arch}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function swiftArgsForArch(arch, outputPath) {
|
|
76
|
+
const args = [
|
|
77
|
+
"swiftc",
|
|
78
|
+
"-target",
|
|
79
|
+
`${archTriples[arch]}${deploymentTarget}`,
|
|
80
|
+
"-module-cache-path",
|
|
81
|
+
moduleCachePath(arch),
|
|
82
|
+
"-O",
|
|
83
|
+
];
|
|
84
|
+
for (const framework of frameworks) args.push("-framework", framework);
|
|
85
|
+
args.push(...macosSourcePaths, "-o", outputPath);
|
|
86
|
+
return args;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function signBinary(outputPath) {
|
|
90
|
+
if (hasArg("--no-sign") || process.env.PIE_COMPUTER_USE_NO_SIGN === "1") {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const identity = getArg("--sign-identity") ?? process.env.PIE_COMPUTER_USE_CODESIGN_IDENTITY ?? "-";
|
|
95
|
+
const identifier = getArg("--sign-identifier") ?? process.env.PIE_COMPUTER_USE_CODESIGN_IDENTIFIER ?? defaultCodeSignIdentifier;
|
|
96
|
+
const args = ["--force", "-i", identifier];
|
|
97
|
+
if (hasArg("--hardened-runtime")) {
|
|
98
|
+
args.push("--options", "runtime");
|
|
99
|
+
}
|
|
100
|
+
if (hasArg("--timestamp")) {
|
|
101
|
+
args.push("--timestamp");
|
|
102
|
+
} else {
|
|
103
|
+
args.push("--timestamp=none");
|
|
104
|
+
}
|
|
105
|
+
args.push("--sign", identity, outputPath);
|
|
106
|
+
await run("codesign", args);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function buildForArch(arch, outputPath) {
|
|
110
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
111
|
+
console.log(`Building native helper for ${arch}...`);
|
|
112
|
+
await run("xcrun", swiftArgsForArch(arch, outputPath));
|
|
113
|
+
await fs.chmod(outputPath, 0o755);
|
|
114
|
+
await signBinary(outputPath);
|
|
115
|
+
console.log(`Built helper at ${outputPath}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function buildUniversal(outputPath) {
|
|
119
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "pie-computer-use-build-"));
|
|
120
|
+
const x64Output = path.join(tempDir, "pie-computer-use-x64");
|
|
121
|
+
const arm64Output = path.join(tempDir, "pie-computer-use-arm64");
|
|
122
|
+
await buildForArch("x64", x64Output);
|
|
123
|
+
await buildForArch("arm64", arm64Output);
|
|
124
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
125
|
+
await run("lipo", ["-create", "-output", outputPath, x64Output, arm64Output]);
|
|
126
|
+
await fs.chmod(outputPath, 0o755);
|
|
127
|
+
await signBinary(outputPath);
|
|
128
|
+
console.log(`Built universal helper at ${outputPath}`);
|
|
129
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Return the actual cargo binary path, handling platform suffix differences.
|
|
134
|
+
* On Windows, the binary is named "windows-bridge.exe"; on other platforms it's "windows-bridge".
|
|
135
|
+
*/
|
|
136
|
+
function windowsBinaryPath(crateDir, target) {
|
|
137
|
+
const releaseDir = target
|
|
138
|
+
? path.join(crateDir, "target", target, "release")
|
|
139
|
+
: path.join(crateDir, "target", "release");
|
|
140
|
+
return path.join(releaseDir, "windows-bridge.exe");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async function buildWindowsHelper(prebuiltOutput) {
|
|
144
|
+
const target = getArg("--target");
|
|
145
|
+
if (process.platform !== "win32" && !target?.includes("windows")) {
|
|
146
|
+
throw new Error("Refusing to label a host binary as Windows. Build on Windows or pass an explicit Windows --target triple.");
|
|
147
|
+
}
|
|
148
|
+
const prebuiltDir = prebuiltOutput
|
|
149
|
+
? path.resolve(process.cwd(), prebuiltOutput, "..")
|
|
150
|
+
: path.join(rootDir, "prebuilt", "windows");
|
|
151
|
+
const manifestPath = path.join(windowsCrateDir, "Cargo.toml");
|
|
152
|
+
|
|
153
|
+
console.log("Building Windows helper with cargo...");
|
|
154
|
+
const cargoArgs = [
|
|
155
|
+
"build",
|
|
156
|
+
"--release",
|
|
157
|
+
"--manifest-path",
|
|
158
|
+
manifestPath,
|
|
159
|
+
];
|
|
160
|
+
if (target) cargoArgs.push("--target", target);
|
|
161
|
+
await run("cargo", cargoArgs);
|
|
162
|
+
|
|
163
|
+
await fs.mkdir(prebuiltDir, { recursive: true });
|
|
164
|
+
|
|
165
|
+
const cargoOutput = windowsBinaryPath(windowsCrateDir, target);
|
|
166
|
+
const handle = await fs.open(cargoOutput, "r");
|
|
167
|
+
try {
|
|
168
|
+
const signature = Buffer.alloc(2);
|
|
169
|
+
await handle.read(signature, 0, 2, 0);
|
|
170
|
+
if (signature.toString("ascii") !== "MZ") {
|
|
171
|
+
throw new Error(`Cargo output is not a Windows PE executable: ${cargoOutput}`);
|
|
172
|
+
}
|
|
173
|
+
} finally {
|
|
174
|
+
await handle.close();
|
|
175
|
+
}
|
|
176
|
+
const prebuiltDest = path.join(prebuiltDir, "windows-bridge.exe");
|
|
177
|
+
await fs.copyFile(cargoOutput, prebuiltDest);
|
|
178
|
+
await fs.chmod(prebuiltDest, 0o755);
|
|
179
|
+
console.log(`Built Windows helper at ${prebuiltDest}`);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function linuxBinaryPath(crateDir, target) {
|
|
183
|
+
const targetDir = target ? path.join("target", target) : "target";
|
|
184
|
+
return path.join(crateDir, targetDir, "release", "linux-bridge");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function defaultLinuxOutputPath(arch) {
|
|
188
|
+
return path.join(rootDir, "prebuilt", "linux", arch, "linux-bridge");
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function buildLinuxForArch(arch, outputPath) {
|
|
192
|
+
const explicitTarget = getArg("--target");
|
|
193
|
+
if (explicitTarget && !explicitTarget.includes("linux")) throw new Error(`Linux builds require a Linux --target triple, got ${explicitTarget}.`);
|
|
194
|
+
const target = explicitTarget ?? (process.platform === "linux" && process.arch === arch ? undefined : linuxTargets[arch]);
|
|
195
|
+
console.log(`Building Linux helper for ${arch} with cargo...`);
|
|
196
|
+
const cargoArgs = ["build", "--release", "--manifest-path", path.join(linuxCrateDir, "Cargo.toml")];
|
|
197
|
+
if (target) cargoArgs.push("--target", target);
|
|
198
|
+
await run("cargo", cargoArgs);
|
|
199
|
+
const cargoOutput = linuxBinaryPath(linuxCrateDir, target);
|
|
200
|
+
const header = await fs.readFile(cargoOutput).then((data) => data.subarray(0, 20));
|
|
201
|
+
if (header.length < 20 || !header.subarray(0, 4).equals(Buffer.from([0x7f, 0x45, 0x4c, 0x46]))) throw new Error(`Cargo output is not a Linux ELF executable: ${cargoOutput}`);
|
|
202
|
+
const machine = header.readUInt16LE(18);
|
|
203
|
+
const expectedMachine = arch === "x64" ? 0x3e : 0xb7;
|
|
204
|
+
if (machine !== expectedMachine) throw new Error(`Cargo output architecture does not match ${arch}: ${cargoOutput}`);
|
|
205
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
206
|
+
await fs.copyFile(cargoOutput, outputPath);
|
|
207
|
+
await fs.chmod(outputPath, 0o755);
|
|
208
|
+
console.log(`Built Linux helper at ${outputPath}`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async function buildLinuxHelper() {
|
|
212
|
+
const arch = normalizeArch(getArg("--arch") ?? process.arch);
|
|
213
|
+
if (arch === "universal") throw new Error("Linux does not support --arch universal. Use x64, arm64, or all.");
|
|
214
|
+
const outputArg = getArg("--output");
|
|
215
|
+
if (arch === "all") {
|
|
216
|
+
if (outputArg) throw new Error("--output is not supported with --arch all. Use a single architecture for one output.");
|
|
217
|
+
for (const nextArch of ["x64", "arm64"]) await buildLinuxForArch(nextArch, defaultLinuxOutputPath(nextArch));
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
await buildLinuxForArch(arch, outputArg ? path.resolve(process.cwd(), outputArg) : defaultLinuxOutputPath(arch));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async function main() {
|
|
224
|
+
const explicitPlatform = getArg("--platform");
|
|
225
|
+
|
|
226
|
+
if (explicitPlatform === "windows") {
|
|
227
|
+
await buildWindowsHelper(getArg("--output"));
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (explicitPlatform === "linux") {
|
|
232
|
+
await buildLinuxHelper();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (explicitPlatform === "darwin") {
|
|
237
|
+
// Fall through to macOS build logic below.
|
|
238
|
+
} else if (process.platform === "win32") {
|
|
239
|
+
await buildWindowsHelper(getArg("--output"));
|
|
240
|
+
return;
|
|
241
|
+
} else if (process.platform === "linux") {
|
|
242
|
+
await buildLinuxHelper();
|
|
243
|
+
return;
|
|
244
|
+
} else if (process.platform !== "darwin") {
|
|
245
|
+
console.log(
|
|
246
|
+
`Skipping native build: unsupported platform "${process.platform}". ` +
|
|
247
|
+
"Use --platform windows or --platform linux to build a helper, or run on macOS for the macOS helper.",
|
|
248
|
+
);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const arch = normalizeArch(getArg("--arch") ?? process.arch);
|
|
253
|
+
const outputArg = getArg("--output");
|
|
254
|
+
|
|
255
|
+
if (arch === "all") {
|
|
256
|
+
if (outputArg) {
|
|
257
|
+
throw new Error("--output is not supported with --arch all. Use a single architecture for one output.");
|
|
258
|
+
}
|
|
259
|
+
for (const nextArch of ["x64", "arm64"]) {
|
|
260
|
+
await buildForArch(nextArch, defaultOutputPath(nextArch));
|
|
261
|
+
}
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const outputPath = outputArg ? path.resolve(process.cwd(), outputArg) : defaultOutputPath(arch);
|
|
266
|
+
if (arch === "universal") {
|
|
267
|
+
await buildUniversal(outputPath);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
await buildForArch(arch, outputPath);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
main().catch((error) => {
|
|
275
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
276
|
+
process.exit(1);
|
|
277
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Standalone copy of src/platform/macos/helper-path.mjs for the bundled
|
|
2
|
+
// installer (dist ships scripts/ without src/). Keep in sync when editing.
|
|
3
|
+
import { accessSync, constants as fsConstants, existsSync } from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
|
|
7
|
+
const HELPER_APP_NAME = "pie-computer-use.app";
|
|
8
|
+
const SYSTEM_HELPER_APP_PATH = path.join("/Applications", HELPER_APP_NAME);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resolve one stable helper location for both installation and runtime use.
|
|
12
|
+
* Existing writable system installs stay in place; all other installs live
|
|
13
|
+
* inside Pie's private config directory (never the user's home top level).
|
|
14
|
+
*/
|
|
15
|
+
export function resolveMacosHelperAppPath(options = {}) {
|
|
16
|
+
const env = options.env ?? process.env;
|
|
17
|
+
const explicitPath = env.PIE_COMPUTER_USE_HELPER_APP_PATH?.trim();
|
|
18
|
+
if (explicitPath) return path.resolve(explicitPath);
|
|
19
|
+
|
|
20
|
+
const homeDir = options.homeDir ?? os.homedir();
|
|
21
|
+
const configDir = options.configDir ?? resolvePieConfigDir(env, homeDir);
|
|
22
|
+
const systemHelperAppPath = options.systemHelperAppPath ?? SYSTEM_HELPER_APP_PATH;
|
|
23
|
+
const fileExists = options.fileExists ?? existsSync;
|
|
24
|
+
const directoryIsWritable = options.directoryIsWritable ?? ((directoryPath) => {
|
|
25
|
+
try {
|
|
26
|
+
accessSync(directoryPath, fsConstants.W_OK);
|
|
27
|
+
return true;
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (fileExists(systemHelperAppPath) && directoryIsWritable(path.dirname(systemHelperAppPath))) {
|
|
34
|
+
return systemHelperAppPath;
|
|
35
|
+
}
|
|
36
|
+
return path.join(configDir, "computer-use", HELPER_APP_NAME);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Mirror of products/cli/src/config.ts getConfigDir() for standalone .mjs use. */
|
|
40
|
+
function resolvePieConfigDir(env, homeDir) {
|
|
41
|
+
const envDir = env.PIE_CODING_AGENT_DIR;
|
|
42
|
+
if (envDir) {
|
|
43
|
+
if (envDir === "~") return homeDir;
|
|
44
|
+
if (envDir.startsWith("~/")) return homeDir + envDir.slice(1);
|
|
45
|
+
return envDir;
|
|
46
|
+
}
|
|
47
|
+
return path.join(homeDir, ".pie");
|
|
48
|
+
}
|