paseo-acp-agy 1.2.13 → 1.2.14

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/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { execFileSync } from "node:child_process";
4
4
  import { ACPServer } from "./acp-server.js";
5
5
  import { logger } from "./logger.js";
6
6
  import { formatDiagnosticVersion, resolveBuildMetadata } from "./version.js";
7
- import { ensurePaseoIntegration, findPaseoServerInstallations, findPaseoAsarPaths, isPaseoServerPatched, isPaseoAsarPatched, isPaseoRunning, } from "./paseo-patcher.js";
7
+ import { ensurePaseoIntegration, restorePaseoIntegration, findPaseoServerInstallations, findPaseoAsarPaths, isPaseoServerPatched, isPaseoAsarPatched, isPaseoRunning, } from "./paseo-patcher.js";
8
8
  import { resolveDefaultAgyBinary, isWindowsBatchScript } from "./antigravity-process.js";
9
9
  import { parseAgyQuotaOutput } from "./protocol.js";
10
10
  const args = process.argv.slice(2);
@@ -30,11 +30,14 @@ Usage:
30
30
  Commands:
31
31
  setup, patch Configure and integrate Antigravity telemetry with Paseo
32
32
  doctor Diagnose Antigravity binary, quota provider, and Paseo status
33
+ restore Restore original Paseo files from backup (.bak)
33
34
 
34
35
  Options:
35
36
  --acp Start ACP server over stdio (default)
36
37
  --setup Integrate Antigravity with local Paseo server installation
37
38
  --doctor Run environment, binary, and telemetry diagnostics
39
+ --restore Restore original Paseo files from backup
40
+ --force-macos-app Force patching inside macOS .app bundle (re-signs with ad-hoc)
38
41
  --skip-naration Drop leading narration-only assistant chunks (e.g. 'I will...')
39
42
  --skip-narration Alias for --skip-naration
40
43
  -v, --version Show version
@@ -212,6 +215,28 @@ if (args.includes("doctor") || args.includes("--doctor")) {
212
215
  }
213
216
  process.exit(0);
214
217
  }
218
+ if (args.includes("restore") ||
219
+ args.includes("unpatch") ||
220
+ args.includes("--restore") ||
221
+ args.includes("--unpatch")) {
222
+ process.stdout.write("Restoring original Paseo files from backup...\n");
223
+ try {
224
+ const res = await restorePaseoIntegration();
225
+ if (res.restored.length > 0) {
226
+ process.stdout.write(`Successfully restored original files:\n${res.restored.map((r) => ` - ${r}`).join("\n")}\n\n`);
227
+ }
228
+ else {
229
+ process.stdout.write("No backup archives (.bak) found to restore.\n\n");
230
+ }
231
+ if (res.errors.length > 0) {
232
+ process.stderr.write(`Errors during restore:\n${res.errors.map((e) => ` - ${e}`).join("\n")}\n`);
233
+ }
234
+ }
235
+ catch (err) {
236
+ process.stderr.write(`Restore encountered an issue: ${err instanceof Error ? err.message : String(err)}\n`);
237
+ }
238
+ process.exit(0);
239
+ }
215
240
  if (args.includes("setup") ||
216
241
  args.includes("patch") ||
217
242
  args.includes("--setup") ||
@@ -221,22 +246,35 @@ if (args.includes("setup") ||
221
246
  }
222
247
  process.stdout.write("Checking Paseo installation and configuring Antigravity telemetry...\n");
223
248
  try {
224
- const res = await ensurePaseoIntegration({ verbose: true });
249
+ const forceMacosApp = args.includes("--force-macos-app");
250
+ const res = await ensurePaseoIntegration({ verbose: true, forceMacosApp });
225
251
  if (!res.found) {
226
252
  process.stdout.write("Notice: No active @getpaseo/server installation or app.asar found in standard paths.\n" +
227
253
  "If Paseo is installed in a custom directory, set PASEO_SERVER_PATH or PASEO_ASAR_PATH and run setup again.\n");
228
254
  }
229
255
  else {
230
- const totalFound = res.serverPaths.length + (res.asarPaths?.length || 0);
231
- process.stdout.write(`Found ${totalFound} Paseo installation target(s) (${res.serverPaths.length} server dir(s), ${res.asarPaths?.length || 0} asar package(s)).\n`);
256
+ const totalFound = res.serverPaths.length + (res.asarPaths?.length || 0) + (res.skippedPaths?.length || 0);
257
+ process.stdout.write(`Found ${totalFound} Paseo installation target(s) (${res.serverPaths.length} server dir(s), ${res.asarPaths?.length || 0} asar package(s)` +
258
+ (res.skippedPaths && res.skippedPaths.length > 0 ? `, ${res.skippedPaths.length} protected macOS app bundle(s)` : "") +
259
+ `).\n`);
232
260
  const allPatched = [...res.patchedPaths, ...(res.patchedAsarPaths || [])];
233
261
  if (allPatched.length > 0) {
234
262
  process.stdout.write(`Successfully integrated with: \n${allPatched.map((p) => ` - ${p}`).join("\n")}\n\n` +
235
263
  `Antigravity quota provider and context-window telemetry are now enabled!\n`);
236
264
  }
265
+ else if (res.skippedPaths && res.skippedPaths.length > 0) {
266
+ process.stdout.write("Paseo server is ready. macOS .app bundle signature was preserved.\n");
267
+ }
237
268
  else {
238
269
  process.stdout.write("Paseo is already up-to-date and configured for Antigravity telemetry.\n");
239
270
  }
271
+ if (res.skippedPaths && res.skippedPaths.length > 0) {
272
+ process.stdout.write(`\n🛡️ Preserved macOS Code Signature:\n` +
273
+ ` Skipped ${res.skippedPaths.length} target(s) inside macOS .app bundle to protect official Apple Developer ID signature\n` +
274
+ ` and prevent Gatekeeper "damaged app" warnings.\n` +
275
+ ` (Antigravity ACP runs standalone and does not require modifying Paseo.app).\n` +
276
+ ` If you specifically wish to patch the .app bundle, run with: paseo-acp-agy patch --force-macos-app\n\n`);
277
+ }
240
278
  if (isPaseoRunning()) {
241
279
  const isWin = process.platform === "win32";
242
280
  process.stdout.write(`\n⚠️ IMPORTANT: Paseo is currently running in the background!\n` +
@@ -4,6 +4,7 @@ export interface PatchResult {
4
4
  patchedPaths: string[];
5
5
  asarPaths?: string[];
6
6
  patchedAsarPaths?: string[];
7
+ skippedPaths?: string[];
7
8
  errors: string[];
8
9
  }
9
10
  /**
@@ -54,7 +55,15 @@ export declare function ensurePaseoIntegration(options?: {
54
55
  verbose?: boolean;
55
56
  targetPaths?: string[];
56
57
  targetAsarPaths?: string[];
58
+ forceMacosApp?: boolean;
57
59
  }): Promise<PatchResult>;
60
+ /**
61
+ * Restores original unpatched Paseo files from backup (.bak) archives.
62
+ */
63
+ export declare function restorePaseoIntegration(): Promise<{
64
+ restored: string[];
65
+ errors: string[];
66
+ }>;
58
67
  /**
59
68
  * Checks whether a @getpaseo/server installation directory is already patched
60
69
  * for Antigravity quota and telemetry support.
@@ -1461,6 +1461,14 @@ export async function patchPaseoAsar(asarPath) {
1461
1461
  timeout: 15000,
1462
1462
  });
1463
1463
  changes.push(`Re-signed macOS bundle at ${appBundlePath}`);
1464
+ try {
1465
+ execFileSync("xattr", ["-cr", appBundlePath], {
1466
+ stdio: "ignore",
1467
+ timeout: 10000,
1468
+ });
1469
+ changes.push(`Cleared quarantine extended attributes at ${appBundlePath}`);
1470
+ }
1471
+ catch { }
1464
1472
  }
1465
1473
  catch (signErr) {
1466
1474
  logger.warn(`Could not re-sign ${appBundlePath}`, { error: String(signErr) });
@@ -1491,11 +1499,34 @@ export async function patchPaseoAsar(asarPath) {
1491
1499
  * Discovers and patches all accessible Paseo installations (both directory and app.asar).
1492
1500
  */
1493
1501
  export async function ensurePaseoIntegration(options) {
1494
- const serverPaths = options?.targetPaths || findPaseoServerInstallations();
1495
- const asarPaths = options?.targetAsarPaths || findPaseoAsarPaths();
1502
+ const rawServerPaths = options?.targetPaths || findPaseoServerInstallations();
1503
+ const rawAsarPaths = options?.targetAsarPaths || findPaseoAsarPaths();
1504
+ const serverPaths = [];
1505
+ const asarPaths = [];
1506
+ const skippedPaths = [];
1496
1507
  const patchedPaths = [];
1497
1508
  const patchedAsarPaths = [];
1498
1509
  const errors = [];
1510
+ for (const sPath of rawServerPaths) {
1511
+ if (process.platform === "darwin" && sPath.includes(".app") && !options?.forceMacosApp) {
1512
+ skippedPaths.push(sPath);
1513
+ if (options?.verbose) {
1514
+ logger.info(`[macOS] Skipping server path inside .app bundle to preserve Apple signature: ${sPath}`);
1515
+ }
1516
+ continue;
1517
+ }
1518
+ serverPaths.push(sPath);
1519
+ }
1520
+ for (const aPath of rawAsarPaths) {
1521
+ if (process.platform === "darwin" && aPath.includes(".app") && !options?.forceMacosApp) {
1522
+ skippedPaths.push(aPath);
1523
+ if (options?.verbose) {
1524
+ logger.info(`[macOS] Skipping app.asar inside .app bundle to preserve Apple signature: ${aPath}`);
1525
+ }
1526
+ continue;
1527
+ }
1528
+ asarPaths.push(aPath);
1529
+ }
1499
1530
  for (const sPath of serverPaths) {
1500
1531
  const res = patchPaseoServer(sPath);
1501
1532
  if (res.success) {
@@ -1525,14 +1556,52 @@ export async function ensurePaseoIntegration(options) {
1525
1556
  }
1526
1557
  }
1527
1558
  return {
1528
- found: serverPaths.length > 0 || asarPaths.length > 0,
1559
+ found: serverPaths.length > 0 || asarPaths.length > 0 || skippedPaths.length > 0,
1529
1560
  serverPaths,
1530
1561
  patchedPaths,
1531
1562
  asarPaths,
1532
1563
  patchedAsarPaths,
1564
+ skippedPaths,
1533
1565
  errors,
1534
1566
  };
1535
1567
  }
1568
+ /**
1569
+ * Restores original unpatched Paseo files from backup (.bak) archives.
1570
+ */
1571
+ export async function restorePaseoIntegration() {
1572
+ const restored = [];
1573
+ const errors = [];
1574
+ const home = os.homedir();
1575
+ const macBackup = path.join(home, ".paseo", "backups", "app.asar.bak");
1576
+ const asarCandidates = findPaseoAsarPaths();
1577
+ for (const asarPath of asarCandidates) {
1578
+ let backupFile = null;
1579
+ if (process.platform === "darwin" && asarPath.includes(".app") && fs.existsSync(macBackup)) {
1580
+ backupFile = macBackup;
1581
+ }
1582
+ else if (fs.existsSync(`${asarPath}.bak`)) {
1583
+ backupFile = `${asarPath}.bak`;
1584
+ }
1585
+ if (backupFile) {
1586
+ try {
1587
+ fs.copyFileSync(backupFile, asarPath);
1588
+ restored.push(asarPath);
1589
+ if (process.platform === "darwin" && asarPath.includes(".app")) {
1590
+ const appIndex = asarPath.indexOf(".app");
1591
+ const appBundlePath = asarPath.slice(0, appIndex + 4);
1592
+ try {
1593
+ execFileSync("xattr", ["-cr", appBundlePath], { stdio: "ignore" });
1594
+ }
1595
+ catch { }
1596
+ }
1597
+ }
1598
+ catch (err) {
1599
+ errors.push(`Failed restoring ${asarPath}: ${err?.message || err}`);
1600
+ }
1601
+ }
1602
+ }
1603
+ return { restored, errors };
1604
+ }
1536
1605
  /**
1537
1606
  * Checks whether a @getpaseo/server installation directory is already patched
1538
1607
  * for Antigravity quota and telemetry support.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-acp-agy",
3
- "version": "1.2.13",
3
+ "version": "1.2.14",
4
4
  "description": "ACP (Agent Client Protocol) provider for Google Antigravity in Paseo and Zed",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",