paseo-acp-agy 1.2.0 → 1.2.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.
@@ -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) {
@@ -42,6 +42,11 @@ export function resolveDefaultAgyBinary(force = false) {
42
42
  path.join(localAppData, "Programs", "Antigravity", "agy.exe"),
43
43
  path.join(programFiles, "Antigravity", "bin", "agy.exe"),
44
44
  path.join(programFilesX86, "Antigravity", "bin", "agy.exe"),
45
+ path.join(localAppData, "Google", "Antigravity", "agy.exe"),
46
+ path.join(localAppData, "Google", "Antigravity", "bin", "agy.exe"),
47
+ path.join(home, ".antigravity", "bin", "agy.exe"),
48
+ path.join(home, ".antigravity", "agy.exe"),
49
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.exe"),
45
50
  path.join(localAppData, "Microsoft", "WindowsApps", "agy.exe"),
46
51
  path.join(home, ".local", "bin", "agy.exe"),
47
52
  path.join(appData, "npm", "agy.exe"),
@@ -79,7 +84,11 @@ export function resolveDefaultAgyBinary(force = false) {
79
84
  path.join(appData, "npm", "agy.cmd"),
80
85
  path.join(localAppData, "npm", "agy.cmd"),
81
86
  path.join(home, ".local", "bin", "agy.cmd"),
87
+ path.join(home, ".antigravity", "bin", "agy.cmd"),
88
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.cmd"),
82
89
  path.join(appData, "npm", "agy.bat"),
90
+ path.join(localAppData, "npm", "agy.bat"),
91
+ path.join(home, ".local", "bin", "agy.bat"),
83
92
  ];
84
93
  for (const cand of batchCandidates) {
85
94
  if (fs.existsSync(cand)) {
@@ -355,7 +364,7 @@ export class AntigravityProcess extends EventEmitter {
355
364
  effectiveEffort,
356
365
  });
357
366
  const isWin = process.platform === "win32";
358
- const isBatch = isWin && isWindowsBatchScript(this.binaryPath);
367
+ const isBatch = isWin && (isWindowsBatchScript(this.binaryPath) || this.binaryPath === "agy");
359
368
  const child = spawn(this.binaryPath, args, {
360
369
  cwd: this.cwd,
361
370
  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
  }
@@ -214,6 +214,11 @@ function resolveAgyBinary() {
214
214
  path.join(localAppData, "Programs", "Antigravity", "agy.exe"),
215
215
  path.join(programFiles, "Antigravity", "bin", "agy.exe"),
216
216
  path.join(programFilesX86, "Antigravity", "bin", "agy.exe"),
217
+ path.join(localAppData, "Google", "Antigravity", "agy.exe"),
218
+ path.join(localAppData, "Google", "Antigravity", "bin", "agy.exe"),
219
+ path.join(home, ".antigravity", "bin", "agy.exe"),
220
+ path.join(home, ".antigravity", "agy.exe"),
221
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.exe"),
217
222
  path.join(localAppData, "Microsoft", "WindowsApps", "agy.exe"),
218
223
  path.join(home, ".local", "bin", "agy.exe"),
219
224
  path.join(appData, "npm", "agy.exe"),
@@ -247,6 +252,8 @@ function resolveAgyBinary() {
247
252
  path.join(appData, "npm", "agy.cmd"),
248
253
  path.join(localAppData, "npm", "agy.cmd"),
249
254
  path.join(home, ".local", "bin", "agy.cmd"),
255
+ path.join(home, ".antigravity", "bin", "agy.cmd"),
256
+ path.join(home, ".gemini", "antigravity-cli", "bin", "agy.cmd"),
250
257
  path.join(appData, "npm", "agy.bat"),
251
258
  path.join(localAppData, "npm", "agy.bat"),
252
259
  path.join(home, ".local", "bin", "agy.bat"),
@@ -296,13 +303,48 @@ export class AntigravityQuotaProvider {
296
303
  const isWin = process.platform === "win32";
297
304
  const bin = resolveAgyBinary();
298
305
  this.binaryPath = bin;
299
- const isBatch = isWin && /\\.(cmd|bat)$/i.test(bin);
306
+ const isBatch = isWin && (!bin.toLowerCase().endsWith(".exe"));
307
+ const home = os.homedir();
308
+ const appData = process.env.APPDATA || (home ? path.join(home, "AppData", "Roaming") : "");
309
+ const localAppData = process.env.LOCALAPPDATA || (home ? path.join(home, "AppData", "Local") : "");
310
+ const programFiles = process.env.ProgramFiles || "C:\\\\Program Files";
311
+ const programFilesX86 = process.env["ProgramFiles(x86)"] || "C:\\\\Program Files (x86)";
312
+
313
+ const extraPaths = isWin ? [
314
+ path.join(appData, "npm"),
315
+ path.join(localAppData, "npm"),
316
+ path.join(programFiles, "nodejs"),
317
+ path.join(programFilesX86, "nodejs"),
318
+ path.join(localAppData, "Programs", "Antigravity", "bin"),
319
+ path.join(localAppData, "Programs", "antigravity"),
320
+ path.join(home, ".antigravity", "bin"),
321
+ path.join(home, ".local", "bin"),
322
+ ].filter(p => fs.existsSync(p)) : [];
323
+
324
+ const env = { ...process.env };
325
+ if (extraPaths.length > 0) {
326
+ const currentPath = env.PATH || env.Path || "";
327
+ const newPath = (currentPath ? currentPath + ";" : "") + extraPaths.join(";");
328
+ env.PATH = newPath;
329
+ env.Path = newPath;
330
+ }
331
+
300
332
  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 }),
333
+ execFileAsync(bin, ["--print-timeout", "24h", "--print", "/usage"], { timeout: 15000, env, shell: isBatch, windowsHide: true }),
334
+ execFileAsync(bin, ["--print-timeout", "24h", "--print", "/credits"], { timeout: 15000, env, shell: isBatch, windowsHide: true }),
303
335
  ]);
304
336
 
305
- const rawUsageOut = usageRes.status === "fulfilled" ? usageRes.value.stdout || usageRes.value.stderr : "";
337
+ if (usageRes.status === "rejected") {
338
+ const reason = usageRes.reason;
339
+ const msg = reason instanceof Error ? reason.message : String(reason);
340
+ return unavailableUsage({
341
+ providerId: this.providerId,
342
+ displayName: "Antigravity",
343
+ error: \`Quota fetch failed: \${msg}\`,
344
+ });
345
+ }
346
+
347
+ const rawUsageOut = usageRes.value.stdout || usageRes.value.stderr || "";
306
348
  const rawCreditsOut = creditsRes.status === "fulfilled" ? creditsRes.value.stdout || creditsRes.value.stderr : "";
307
349
 
308
350
  const usageOut = (rawUsageOut || "").replace(/\\r\\n/g, "\\n");
@@ -323,7 +365,14 @@ export class AntigravityQuotaProvider {
323
365
  scope = m[1].trim();
324
366
  limitType = m[2].trim();
325
367
  remainingPct = parseInt(m[3], 10);
326
- resetsAt = m[4] ? new Date(m[4].trim()).toISOString() : null;
368
+ if (m[4]) {
369
+ try {
370
+ const d = new Date(m[4].trim());
371
+ resetsAt = isNaN(d.getTime()) ? null : d.toISOString();
372
+ } catch {
373
+ resetsAt = null;
374
+ }
375
+ }
327
376
  } else {
328
377
  const parts = trimmed.split(/\\t+|\\s{2,}/).map(p => p.trim());
329
378
  if (parts.length >= 3) {
@@ -331,7 +380,14 @@ export class AntigravityQuotaProvider {
331
380
  limitType = parts[1];
332
381
  const remMatch = parts[2].match(/(\\d+)%/);
333
382
  if (remMatch) remainingPct = parseInt(remMatch[1], 10);
334
- resetsAt = parts[3] ? new Date(parts[3]).toISOString() : null;
383
+ if (parts[3]) {
384
+ try {
385
+ const d = new Date(parts[3]);
386
+ resetsAt = isNaN(d.getTime()) ? null : d.toISOString();
387
+ } catch {
388
+ resetsAt = null;
389
+ }
390
+ }
335
391
  }
336
392
  }
337
393
 
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.1";
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.1",
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",