paseo-acp-agy 1.2.0 → 1.2.2

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.
@@ -208,6 +208,17 @@ export class ACPServer {
208
208
  this.sendSuccess(id, await this.sessionState(session, true));
209
209
  this.publishCommands(session.id);
210
210
  this.publishUsageUpdate(session);
211
+ // Re-publish usage after ACPAgent completes awaiting newSession and stores this.sessionId
212
+ setTimeout(() => {
213
+ if (this.sessionManager.getSession(session.id)) {
214
+ this.publishUsageUpdate(session);
215
+ }
216
+ }, 150);
217
+ setTimeout(() => {
218
+ if (this.sessionManager.getSession(session.id)) {
219
+ this.publishUsageUpdate(session);
220
+ }
221
+ }, 500);
211
222
  }
212
223
  break;
213
224
  }
@@ -238,6 +249,12 @@ export class ACPServer {
238
249
  this.sendSuccess(id, await this.sessionState(session));
239
250
  this.publishCommands(session.id);
240
251
  this.publishUsageUpdate(session);
252
+ const activeSession = session;
253
+ setTimeout(() => {
254
+ if (this.sessionManager.getSession(activeSession.id)) {
255
+ this.publishUsageUpdate(activeSession);
256
+ }
257
+ }, 150);
241
258
  }
242
259
  }
243
260
  catch (err) {
@@ -37,11 +37,26 @@ export function resolveDefaultAgyBinary(force = false) {
37
37
  const programFiles = process.env.ProgramFiles || "C:\\Program Files";
38
38
  const programFilesX86 = process.env["ProgramFiles(x86)"] || "C:\\Program Files (x86)";
39
39
  const exeCandidates = [
40
+ path.join(localAppData, "agy", "bin", "agy.exe"),
41
+ path.join(localAppData, "agy", "agy.exe"),
42
+ path.join(home, ".agy", "bin", "agy.exe"),
43
+ path.join(home, ".agy", "agy.exe"),
40
44
  path.join(localAppData, "Programs", "Antigravity", "bin", "agy.exe"),
41
45
  path.join(localAppData, "Programs", "antigravity", "agy.exe"),
42
46
  path.join(localAppData, "Programs", "Antigravity", "agy.exe"),
47
+ path.join(localAppData, "Programs", "agy", "bin", "agy.exe"),
48
+ path.join(localAppData, "Programs", "agy", "agy.exe"),
43
49
  path.join(programFiles, "Antigravity", "bin", "agy.exe"),
50
+ path.join(programFiles, "agy", "bin", "agy.exe"),
44
51
  path.join(programFilesX86, "Antigravity", "bin", "agy.exe"),
52
+ path.join(programFilesX86, "agy", "bin", "agy.exe"),
53
+ path.join(localAppData, "Google", "Antigravity", "agy.exe"),
54
+ path.join(localAppData, "Google", "Antigravity", "bin", "agy.exe"),
55
+ path.join(localAppData, "Google", "agy", "bin", "agy.exe"),
56
+ path.join(localAppData, "Google", "agy", "agy.exe"),
57
+ path.join(home, ".antigravity", "bin", "agy.exe"),
58
+ path.join(home, ".antigravity", "agy.exe"),
59
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.exe"),
45
60
  path.join(localAppData, "Microsoft", "WindowsApps", "agy.exe"),
46
61
  path.join(home, ".local", "bin", "agy.exe"),
47
62
  path.join(appData, "npm", "agy.exe"),
@@ -76,10 +91,19 @@ export function resolveDefaultAgyBinary(force = false) {
76
91
  }
77
92
  if (resolved === "agy") {
78
93
  const batchCandidates = [
94
+ path.join(localAppData, "agy", "bin", "agy.cmd"),
95
+ path.join(localAppData, "agy", "agy.cmd"),
96
+ path.join(home, ".agy", "bin", "agy.cmd"),
79
97
  path.join(appData, "npm", "agy.cmd"),
80
98
  path.join(localAppData, "npm", "agy.cmd"),
81
99
  path.join(home, ".local", "bin", "agy.cmd"),
100
+ path.join(home, ".antigravity", "bin", "agy.cmd"),
101
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.cmd"),
102
+ path.join(localAppData, "agy", "bin", "agy.bat"),
103
+ path.join(localAppData, "agy", "agy.bat"),
82
104
  path.join(appData, "npm", "agy.bat"),
105
+ path.join(localAppData, "npm", "agy.bat"),
106
+ path.join(home, ".local", "bin", "agy.bat"),
83
107
  ];
84
108
  for (const cand of batchCandidates) {
85
109
  if (fs.existsSync(cand)) {
@@ -355,7 +379,7 @@ export class AntigravityProcess extends EventEmitter {
355
379
  effectiveEffort,
356
380
  });
357
381
  const isWin = process.platform === "win32";
358
- const isBatch = isWin && isWindowsBatchScript(this.binaryPath);
382
+ const isBatch = isWin && (isWindowsBatchScript(this.binaryPath) || this.binaryPath === "agy");
359
383
  const child = spawn(this.binaryPath, args, {
360
384
  cwd: this.cwd,
361
385
  env: this.env,
package/dist/index.js CHANGED
@@ -154,7 +154,14 @@ if (args.includes("doctor") || args.includes("--doctor")) {
154
154
  const paseoRunning = isPaseoRunning();
155
155
  if (paseoRunning) {
156
156
  process.stdout.write(" [!] Paseo process is currently running.\n");
157
- process.stdout.write(" Note: If you run setup/patch, please close Paseo completely (check system tray and Task Manager) to avoid EBUSY file locking.\n");
157
+ if (isWin) {
158
+ process.stdout.write(" Tip: To restart Paseo completely on Windows, run in PowerShell:\n");
159
+ process.stdout.write(" Stop-Process -Name \"Paseo\" -Force -ErrorAction SilentlyContinue\n");
160
+ process.stdout.write(" Then launch Paseo again.\n");
161
+ }
162
+ else {
163
+ process.stdout.write(" Tip: Run 'paseo daemon restart' or close the Paseo app to reload.\n");
164
+ }
158
165
  }
159
166
  else {
160
167
  process.stdout.write(" [OK] Paseo is not currently running (safe to patch/update).\n");
@@ -184,7 +191,7 @@ if (args.includes("doctor") || args.includes("--doctor")) {
184
191
  hasIssue = true;
185
192
  if (paseoRunning) {
186
193
  process.stdout.write(` - Found ${unpatchedCount} unpatched Paseo target(s), but Paseo is currently running.\n`);
187
- process.stdout.write(" Action: Close Paseo.exe completely, then run:\n");
194
+ process.stdout.write(" Action: Close Paseo completely (Stop-Process -Name \"Paseo\" -Force), then run:\n");
188
195
  process.stdout.write(" npx -y paseo-acp-agy setup\n");
189
196
  }
190
197
  else {
@@ -225,12 +232,21 @@ if (args.includes("setup") ||
225
232
  const allPatched = [...res.patchedPaths, ...(res.patchedAsarPaths || [])];
226
233
  if (allPatched.length > 0) {
227
234
  process.stdout.write(`Successfully integrated with: \n${allPatched.map((p) => ` - ${p}`).join("\n")}\n\n` +
228
- `Antigravity quota provider and context-window telemetry are now enabled!\n` +
229
- `Please restart Paseo (or run 'paseo daemon restart') to apply changes.\n`);
235
+ `Antigravity quota provider and context-window telemetry are now enabled!\n`);
230
236
  }
231
237
  else {
232
238
  process.stdout.write("Paseo is already up-to-date and configured for Antigravity telemetry.\n");
233
239
  }
240
+ if (isPaseoRunning()) {
241
+ process.stdout.write(`\n⚠️ IMPORTANT: Paseo is currently running in the background!\n` +
242
+ ` Windows caches running executables in memory, so changes will only take effect after restarting Paseo.\n` +
243
+ ` In PowerShell, run:\n` +
244
+ ` Stop-Process -Name "Paseo" -Force -ErrorAction SilentlyContinue\n` +
245
+ ` Then launch Paseo again.\n\n`);
246
+ }
247
+ else {
248
+ process.stdout.write(`Please start Paseo to apply changes.\n\n`);
249
+ }
234
250
  if (res.errors.length > 0) {
235
251
  process.stderr.write(`Notice: Some paths could not be modified (may require admin/close Paseo):\n${res.errors.map(e => ` - ${e}`).join("\n")}\n`);
236
252
  }
@@ -209,11 +209,26 @@ function resolveAgyBinary() {
209
209
 
210
210
  // Prioritize .exe candidates over .cmd / .bat
211
211
  const exeCandidates = [
212
+ path.join(localAppData, "agy", "bin", "agy.exe"),
213
+ path.join(localAppData, "agy", "agy.exe"),
214
+ path.join(home, ".agy", "bin", "agy.exe"),
215
+ path.join(home, ".agy", "agy.exe"),
212
216
  path.join(localAppData, "Programs", "Antigravity", "bin", "agy.exe"),
213
217
  path.join(localAppData, "Programs", "antigravity", "agy.exe"),
214
218
  path.join(localAppData, "Programs", "Antigravity", "agy.exe"),
219
+ path.join(localAppData, "Programs", "agy", "bin", "agy.exe"),
220
+ path.join(localAppData, "Programs", "agy", "agy.exe"),
215
221
  path.join(programFiles, "Antigravity", "bin", "agy.exe"),
222
+ path.join(programFiles, "agy", "bin", "agy.exe"),
216
223
  path.join(programFilesX86, "Antigravity", "bin", "agy.exe"),
224
+ path.join(programFilesX86, "agy", "bin", "agy.exe"),
225
+ path.join(localAppData, "Google", "Antigravity", "agy.exe"),
226
+ path.join(localAppData, "Google", "Antigravity", "bin", "agy.exe"),
227
+ path.join(localAppData, "Google", "agy", "bin", "agy.exe"),
228
+ path.join(localAppData, "Google", "agy", "agy.exe"),
229
+ path.join(home, ".antigravity", "bin", "agy.exe"),
230
+ path.join(home, ".antigravity", "agy.exe"),
231
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.exe"),
217
232
  path.join(localAppData, "Microsoft", "WindowsApps", "agy.exe"),
218
233
  path.join(home, ".local", "bin", "agy.exe"),
219
234
  path.join(appData, "npm", "agy.exe"),
@@ -244,9 +259,16 @@ function resolveAgyBinary() {
244
259
  // Fallback to batch scripts (.cmd / .bat) if no .exe found
245
260
  if (resolved === "agy") {
246
261
  const batchCandidates = [
262
+ path.join(localAppData, "agy", "bin", "agy.cmd"),
263
+ path.join(localAppData, "agy", "agy.cmd"),
264
+ path.join(home, ".agy", "bin", "agy.cmd"),
247
265
  path.join(appData, "npm", "agy.cmd"),
248
266
  path.join(localAppData, "npm", "agy.cmd"),
249
267
  path.join(home, ".local", "bin", "agy.cmd"),
268
+ path.join(home, ".antigravity", "bin", "agy.cmd"),
269
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.cmd"),
270
+ path.join(localAppData, "agy", "bin", "agy.bat"),
271
+ path.join(localAppData, "agy", "agy.bat"),
250
272
  path.join(appData, "npm", "agy.bat"),
251
273
  path.join(localAppData, "npm", "agy.bat"),
252
274
  path.join(home, ".local", "bin", "agy.bat"),
@@ -296,13 +318,60 @@ export class AntigravityQuotaProvider {
296
318
  const isWin = process.platform === "win32";
297
319
  const bin = resolveAgyBinary();
298
320
  this.binaryPath = bin;
299
- const isBatch = isWin && /\\.(cmd|bat)$/i.test(bin);
321
+ const isBatch = isWin && (!bin.toLowerCase().endsWith(".exe"));
322
+ const home = os.homedir();
323
+ const appData = process.env.APPDATA || (home ? path.join(home, "AppData", "Roaming") : "");
324
+ const localAppData = process.env.LOCALAPPDATA || (home ? path.join(home, "AppData", "Local") : "");
325
+ const programFiles = process.env.ProgramFiles || "C:\\\\Program Files";
326
+ const programFilesX86 = process.env["ProgramFiles(x86)"] || "C:\\\\Program Files (x86)";
327
+
328
+ const extraPaths = isWin ? [
329
+ path.join(localAppData, "agy", "bin"),
330
+ path.join(localAppData, "agy"),
331
+ path.join(home, ".agy", "bin"),
332
+ path.join(localAppData, "Programs", "Antigravity", "bin"),
333
+ path.join(localAppData, "Programs", "antigravity"),
334
+ path.join(localAppData, "Programs", "agy", "bin"),
335
+ path.join(localAppData, "Google", "Antigravity", "bin"),
336
+ path.join(localAppData, "Google", "agy", "bin"),
337
+ path.join(home, ".antigravity", "bin"),
338
+ path.join(home, ".gemini", "antigravity-cli", "bin"),
339
+ path.join(home, ".local", "bin"),
340
+ path.join(appData, "npm"),
341
+ path.join(localAppData, "npm"),
342
+ path.join(localAppData, "Microsoft", "WindowsApps"),
343
+ path.join(programFiles, "nodejs"),
344
+ path.join(programFilesX86, "nodejs"),
345
+ path.join(programFiles, "Antigravity", "bin"),
346
+ path.join(programFiles, "agy", "bin"),
347
+ path.join(programFilesX86, "Antigravity", "bin"),
348
+ path.join(programFilesX86, "agy", "bin"),
349
+ ].filter(p => fs.existsSync(p)) : [];
350
+
351
+ const env = { ...process.env };
352
+ if (extraPaths.length > 0) {
353
+ const currentPath = env.PATH || env.Path || "";
354
+ const newPath = (currentPath ? currentPath + ";" : "") + extraPaths.join(";");
355
+ env.PATH = newPath;
356
+ env.Path = newPath;
357
+ }
358
+
300
359
  const [usageRes, creditsRes] = await Promise.allSettled([
301
- execFileAsync(bin, ["--print-timeout", "24h", "--print", "/usage"], { timeout: 15000, env: process.env, shell: isBatch, windowsHide: true }),
302
- execFileAsync(bin, ["--print-timeout", "24h", "--print", "/credits"], { timeout: 15000, env: process.env, shell: isBatch, windowsHide: true }),
360
+ execFileAsync(bin, ["--print-timeout", "24h", "--print", "/usage"], { timeout: 15000, env, shell: isBatch, windowsHide: true }),
361
+ execFileAsync(bin, ["--print-timeout", "24h", "--print", "/credits"], { timeout: 15000, env, shell: isBatch, windowsHide: true }),
303
362
  ]);
304
363
 
305
- const rawUsageOut = usageRes.status === "fulfilled" ? usageRes.value.stdout || usageRes.value.stderr : "";
364
+ if (usageRes.status === "rejected") {
365
+ const reason = usageRes.reason;
366
+ const msg = reason instanceof Error ? reason.message : String(reason);
367
+ return unavailableUsage({
368
+ providerId: this.providerId,
369
+ displayName: "Antigravity",
370
+ error: \`Quota fetch failed: \${msg}\`,
371
+ });
372
+ }
373
+
374
+ const rawUsageOut = usageRes.value.stdout || usageRes.value.stderr || "";
306
375
  const rawCreditsOut = creditsRes.status === "fulfilled" ? creditsRes.value.stdout || creditsRes.value.stderr : "";
307
376
 
308
377
  const usageOut = (rawUsageOut || "").replace(/\\r\\n/g, "\\n");
@@ -323,7 +392,14 @@ export class AntigravityQuotaProvider {
323
392
  scope = m[1].trim();
324
393
  limitType = m[2].trim();
325
394
  remainingPct = parseInt(m[3], 10);
326
- resetsAt = m[4] ? new Date(m[4].trim()).toISOString() : null;
395
+ if (m[4]) {
396
+ try {
397
+ const d = new Date(m[4].trim());
398
+ resetsAt = isNaN(d.getTime()) ? null : d.toISOString();
399
+ } catch {
400
+ resetsAt = null;
401
+ }
402
+ }
327
403
  } else {
328
404
  const parts = trimmed.split(/\\t+|\\s{2,}/).map(p => p.trim());
329
405
  if (parts.length >= 3) {
@@ -331,7 +407,14 @@ export class AntigravityQuotaProvider {
331
407
  limitType = parts[1];
332
408
  const remMatch = parts[2].match(/(\\d+)%/);
333
409
  if (remMatch) remainingPct = parseInt(remMatch[1], 10);
334
- resetsAt = parts[3] ? new Date(parts[3]).toISOString() : null;
410
+ if (parts[3]) {
411
+ try {
412
+ const d = new Date(parts[3]);
413
+ resetsAt = isNaN(d.getTime()) ? null : d.toISOString();
414
+ } catch {
415
+ resetsAt = null;
416
+ }
417
+ }
335
418
  }
336
419
  }
337
420
 
@@ -884,7 +967,7 @@ export async function isPaseoAsarPatched(asarPath) {
884
967
  if (!fs.existsSync(asarPath))
885
968
  return false;
886
969
  const files = listPackage(asarPath);
887
- return files.some((f) => f.includes("antigravity.js"));
970
+ return files.some((f) => f.replace(/\\/g, "/").includes("quota-fetcher/providers/antigravity.js"));
888
971
  }
889
972
  catch {
890
973
  return false;
package/dist/protocol.js CHANGED
@@ -303,7 +303,7 @@ export async function fetchAntigravityUsage(binaryPath = "agy", force = false) {
303
303
  now - lastProviderUsageFetch < PROVIDER_USAGE_CACHE_TTL_MS) {
304
304
  return cachedProviderUsage;
305
305
  }
306
- const isBatch = process.platform === "win32" && isWindowsBatchScript(binaryPath);
306
+ const isBatch = process.platform === "win32" && (isWindowsBatchScript(binaryPath) || binaryPath === "agy");
307
307
  const cmd = isBatch && binaryPath.includes(" ") && !binaryPath.startsWith('"') ? `"${binaryPath}"` : binaryPath;
308
308
  try {
309
309
  const [usageResult, creditsResult] = await Promise.allSettled([
@@ -441,7 +441,7 @@ export async function fetchAvailableModels(binaryPath = "agy", force = false) {
441
441
  return inFlightModelFetch;
442
442
  }
443
443
  inFlightModelFetch = (async () => {
444
- const isBatch = process.platform === "win32" && isWindowsBatchScript(binaryPath);
444
+ const isBatch = process.platform === "win32" && (isWindowsBatchScript(binaryPath) || binaryPath === "agy");
445
445
  const cmd = isBatch && binaryPath.includes(" ") && !binaryPath.startsWith('"') ? `"${binaryPath}"` : binaryPath;
446
446
  try {
447
447
  const { stdout } = await execFileAsync(cmd, ["models"], {
@@ -337,7 +337,7 @@ export function formatUsageOutput(rawText) {
337
337
  return out;
338
338
  }
339
339
  async function runAgySlash(binaryPath, cwd, slashCommand) {
340
- const isBatch = process.platform === "win32" && isWindowsBatchScript(binaryPath);
340
+ const isBatch = process.platform === "win32" && (isWindowsBatchScript(binaryPath) || binaryPath === "agy");
341
341
  const cmd = isBatch && binaryPath.includes(" ") && !binaryPath.startsWith('"') ? `"${binaryPath}"` : binaryPath;
342
342
  const { stdout, stderr } = await execFileAsync(cmd, ["--print-timeout", "24h", "--print", slashCommand], {
343
343
  cwd,
package/dist/version.js CHANGED
@@ -16,7 +16,7 @@ function getPackageVersion() {
16
16
  catch {
17
17
  // ignore
18
18
  }
19
- return "1.2.0";
19
+ return "1.2.2";
20
20
  }
21
21
  export const SEMVER_VERSION = getPackageVersion();
22
22
  let cachedBuildMetadata = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-acp-agy",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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",