paseo-acp-agy 1.3.2 → 1.3.3
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/acp-server.js +2 -0
- package/dist/paseo-patcher.js +35 -1
- package/package.json +1 -1
package/dist/acp-server.js
CHANGED
|
@@ -418,6 +418,7 @@ export class ACPServer extends EventEmitter {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
if (!isNotification) {
|
|
421
|
+
this.publishUsageUpdate(session);
|
|
421
422
|
this.sendSuccess(id, await this.sessionState(session));
|
|
422
423
|
this.publishCommands(session.id);
|
|
423
424
|
this.publishUsageUpdate(session);
|
|
@@ -465,6 +466,7 @@ export class ACPServer extends EventEmitter {
|
|
|
465
466
|
catch { }
|
|
466
467
|
}
|
|
467
468
|
if (!isNotification) {
|
|
469
|
+
this.publishUsageUpdate(session);
|
|
468
470
|
this.sendSuccess(id, await this.sessionState(session));
|
|
469
471
|
this.publishCommands(session.id);
|
|
470
472
|
this.publishUsageUpdate(session);
|
package/dist/paseo-patcher.js
CHANGED
|
@@ -714,10 +714,18 @@ function toneFromUsedPct(usedPct) {
|
|
|
714
714
|
|
|
715
715
|
function isStandaloneTelemetryPluginEnabled() {
|
|
716
716
|
try {
|
|
717
|
-
|
|
717
|
+
let paseoHome = process.env.PASEO_HOME;
|
|
718
|
+
if (!paseoHome && Array.isArray(process.argv)) {
|
|
719
|
+
const homeIdx = process.argv.indexOf("--home");
|
|
720
|
+
if (homeIdx !== -1 && process.argv[homeIdx + 1]) {
|
|
721
|
+
paseoHome = process.argv[homeIdx + 1];
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
paseoHome = paseoHome || path.join(os.homedir(), ".paseo");
|
|
718
725
|
const cfgPath = path.join(paseoHome, "config.json");
|
|
719
726
|
if (!fs.existsSync(cfgPath)) return false;
|
|
720
727
|
const cfg = JSON.parse(fs.readFileSync(cfgPath, "utf-8"));
|
|
728
|
+
if (cfg && cfg.pluginsEnabled === false) return false;
|
|
721
729
|
const entry = cfg && cfg.plugins && cfg.plugins["antigravity-telemetry"];
|
|
722
730
|
return Boolean(entry && entry.enabled !== false);
|
|
723
731
|
} catch {
|
|
@@ -1265,6 +1273,28 @@ ${braceIndent}}`;
|
|
|
1265
1273
|
acpModified = true;
|
|
1266
1274
|
}
|
|
1267
1275
|
}
|
|
1276
|
+
// Patch handlePromptResponse so response.usage merges defined fields instead of wiping
|
|
1277
|
+
// totalCostUsd / contextWindowMaxTokens / contextWindowUsedTokens from this.currentTurnUsage
|
|
1278
|
+
const promptRespAssignRegex = /([ \t]*)this\.currentTurnUsage\s*=\s*mapACPUsage\(response\.usage\)\s*\?\?\s*this\.currentTurnUsage;/;
|
|
1279
|
+
if (promptRespAssignRegex.test(acpCode) && !acpCode.includes("_mappedRespUsage")) {
|
|
1280
|
+
acpCode = acpCode.replace(promptRespAssignRegex, (_m, ind) => `${ind}const _mappedRespUsage = mapACPUsage(response.usage);\n` +
|
|
1281
|
+
`${ind}if (_mappedRespUsage) {\n` +
|
|
1282
|
+
`${ind} this.currentTurnUsage = {\n` +
|
|
1283
|
+
`${ind} ...this.currentTurnUsage,\n` +
|
|
1284
|
+
`${ind} ...Object.fromEntries(Object.entries(_mappedRespUsage).filter(([, v]) => v !== undefined)),\n` +
|
|
1285
|
+
`${ind} };\n` +
|
|
1286
|
+
`${ind}}`);
|
|
1287
|
+
acpModified = true;
|
|
1288
|
+
}
|
|
1289
|
+
// Patch subscribe(callback) so any usage_update received during newSession/loadSession
|
|
1290
|
+
// (before subscribers attach, including history resumes) is replayed immediately
|
|
1291
|
+
const subscribeMethodMatch = acpCode.match(/subscribe\s*\([^)]*\)\s*\{[\s\S]*?\n\s*\}/);
|
|
1292
|
+
if (subscribeMethodMatch &&
|
|
1293
|
+
acpCode.includes('type: "thread_started"') &&
|
|
1294
|
+
!subscribeMethodMatch[0].includes("usage_updated")) {
|
|
1295
|
+
acpCode = acpCode.replace(/(\bcallback\(\{\s*type:\s*"thread_started"[\s\S]*?\}\);\s*\})/, `$1\n if (this.currentTurnUsage) {\n callback({\n type: "usage_updated",\n provider: this.provider,\n usage: this.currentTurnUsage,\n });\n }`);
|
|
1296
|
+
acpModified = true;
|
|
1297
|
+
}
|
|
1268
1298
|
// Patch mapPermissionRequest for native QuestionFormCard support in Paseo UI
|
|
1269
1299
|
if (!acpCode.includes("snapshot?.kind === \"question\" || params?.kind === \"question\"")) {
|
|
1270
1300
|
const oldMapPermRegex = /function\s+mapPermissionRequest\s*\([^)]*\)\s*\{[\s\S]*?const\s+kind\s*=\s*snapshot\.kind\s*===\s*"switch_mode"\s*\?\s*"mode"\s*:\s*"tool";/m;
|
|
@@ -1971,6 +2001,10 @@ export function isPaseoServerPatched(serverDir) {
|
|
|
1971
2001
|
if (pluginDir && (!content.includes("usageSession()") || content.includes("!this.usageProvider"))) {
|
|
1972
2002
|
return false;
|
|
1973
2003
|
}
|
|
2004
|
+
if (content.includes("mapACPUsage(response.usage) ?? this.currentTurnUsage") &&
|
|
2005
|
+
!content.includes("_mappedRespUsage")) {
|
|
2006
|
+
return false;
|
|
2007
|
+
}
|
|
1974
2008
|
}
|
|
1975
2009
|
return true;
|
|
1976
2010
|
}
|