paseo-acp-agy 1.2.5 → 1.2.6

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.
@@ -444,16 +444,16 @@ export class ACPServer {
444
444
  if (step.usage) {
445
445
  const inputTokens = step.usage.input_tokens ?? 0;
446
446
  const outputTokens = step.usage.output_tokens ?? 0;
447
- if (inputTokens > 0) {
448
- latestStepContextTokens = inputTokens + outputTokens;
449
- }
450
- const turnCost = calculateUsageCostUsd(executingModel, inputTokens, outputTokens, step.usage.cache_read_tokens || 0);
451
447
  const cachedReadTokens = step.usage.cache_read_tokens ?? 0;
448
+ if (inputTokens > 0 || cachedReadTokens > 0) {
449
+ latestStepContextTokens = inputTokens + cachedReadTokens + outputTokens;
450
+ }
451
+ const turnCost = calculateUsageCostUsd(executingModel, inputTokens, outputTokens, cachedReadTokens);
452
452
  const thoughtTokens = step.usage.thinking_tokens;
453
453
  const totalTokens = step.usage.total_tokens ?? (inputTokens + outputTokens);
454
454
  const totalCostUsd = roundUsageCostUsd(session.usage.totalCostUsd + turnCost);
455
455
  const contextWindowMaxTokens = getModelContextWindow(executingModel);
456
- const contextWindowUsedTokens = Math.min(inputTokens + outputTokens, contextWindowMaxTokens);
456
+ const contextWindowUsedTokens = Math.min(latestStepContextTokens ?? (inputTokens + cachedReadTokens + outputTokens), contextWindowMaxTokens);
457
457
  this.sendNotification(ACP_METHODS.SESSION_UPDATE, {
458
458
  sessionId: session.id,
459
459
  update: {
package/dist/index.js CHANGED
@@ -160,7 +160,7 @@ if (args.includes("doctor") || args.includes("--doctor")) {
160
160
  process.stdout.write(" Then launch Paseo again.\n");
161
161
  }
162
162
  else {
163
- process.stdout.write(" Tip: Run 'paseo daemon restart' or close the Paseo app to reload.\n");
163
+ process.stdout.write(" Tip: Run 'paseo restart' or close the Paseo app/daemon to reload with updated patches.\n");
164
164
  }
165
165
  }
166
166
  else {
@@ -1579,15 +1579,28 @@ export function isPaseoRunning() {
1579
1579
  return /paseo/i.test(out) && !out.includes("INFO:") && !out.includes("No tasks");
1580
1580
  }
1581
1581
  else {
1582
- const out = execFileSync("pgrep", ["-i", "-x", "paseo"], {
1582
+ try {
1583
+ const out = execFileSync("pgrep", ["-i", "-f", "paseo (daemon|supervisor)|/paseo$|@getpaseo/server"], {
1584
+ encoding: "utf-8",
1585
+ timeout: 2000,
1586
+ });
1587
+ const pids = out
1588
+ .split(/\r?\n/)
1589
+ .map((s) => parseInt(s.trim(), 10))
1590
+ .filter((p) => !isNaN(p) && p !== process.pid && p !== process.ppid);
1591
+ if (pids.length > 0)
1592
+ return true;
1593
+ }
1594
+ catch { }
1595
+ const out2 = execFileSync("pgrep", ["-i", "-x", "paseo"], {
1583
1596
  encoding: "utf-8",
1584
1597
  timeout: 2000,
1585
1598
  });
1586
- const pids = out
1599
+ const pids2 = out2
1587
1600
  .split(/\r?\n/)
1588
1601
  .map((s) => parseInt(s.trim(), 10))
1589
- .filter((p) => !isNaN(p) && p !== process.pid);
1590
- return pids.length > 0;
1602
+ .filter((p) => !isNaN(p) && p !== process.pid && p !== process.ppid);
1603
+ return pids2.length > 0;
1591
1604
  }
1592
1605
  }
1593
1606
  catch {
package/dist/session.js CHANGED
@@ -30,15 +30,22 @@ export class Session {
30
30
  this.createdAt = new Date();
31
31
  this.lastActivity = new Date();
32
32
  this.store = options.store || sessionStore;
33
- this.usage = options.usage || {
34
- inputTokens: 0,
35
- outputTokens: 0,
36
- cachedInputTokens: 0,
37
- totalTokens: 0,
38
- totalCostUsd: 0,
39
- contextWindowUsedTokens: 0,
40
- contextWindowMaxTokens: getModelContextWindow(this.model),
41
- };
33
+ const maxTokens = getModelContextWindow(this.model);
34
+ this.usage = options.usage
35
+ ? { ...options.usage }
36
+ : {
37
+ inputTokens: 0,
38
+ outputTokens: 0,
39
+ cachedInputTokens: 0,
40
+ totalTokens: 0,
41
+ totalCostUsd: 0,
42
+ contextWindowUsedTokens: 0,
43
+ contextWindowMaxTokens: maxTokens,
44
+ };
45
+ this.usage.contextWindowMaxTokens = maxTokens;
46
+ if (this.usage.contextWindowUsedTokens > maxTokens) {
47
+ this.usage.contextWindowUsedTokens = Math.min(this.usage.contextWindowUsedTokens, maxTokens);
48
+ }
42
49
  const isSandbox = this.permission === "sandbox" || options.sandbox;
43
50
  const isBypass = this.permission === "bypass" || options.dangerouslySkipPermissions;
44
51
  const permissions = resolvePermissionSettings({
@@ -173,6 +180,9 @@ export class Session {
173
180
  if (rawTurnTokens > executingMaxTokens && numSteps > 1) {
174
181
  activeContextTokens = Math.round(rawTurnTokens / numSteps);
175
182
  }
183
+ else if (rawTurnTokens > executingMaxTokens) {
184
+ activeContextTokens = Math.min(Math.round(rawTurnTokens / 10), executingMaxTokens);
185
+ }
176
186
  else {
177
187
  activeContextTokens = rawTurnTokens;
178
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-acp-agy",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
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",