opencode-tps-meter 0.1.6 → 0.1.7
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.d.ts.map +1 -1
- package/dist/index.js +25 -5
- package/dist/index.mjs +25 -5
- package/dist/ui.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAOf,MAAM,YAAY,CAAC;AAoHpB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,aAAa,GACrB,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EAOf,MAAM,YAAY,CAAC;AAoHpB;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,aAAa,GACrB,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CA2wBxC;AAGD,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -238,8 +238,21 @@ function createUIManager(client, config) {
|
|
|
238
238
|
}
|
|
239
239
|
function formatAgentLine(agent) {
|
|
240
240
|
const segments = [];
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
if (uiConfig.showInstant || uiConfig.showAverage) {
|
|
242
|
+
const tpsParts = [];
|
|
243
|
+
if (uiConfig.showInstant) {
|
|
244
|
+
tpsParts.push(`${agent.instantTps.toFixed(1)}`);
|
|
245
|
+
}
|
|
246
|
+
if (uiConfig.showAverage) {
|
|
247
|
+
tpsParts.push(`(avg ${agent.avgTps.toFixed(1)})`);
|
|
248
|
+
}
|
|
249
|
+
if (tpsParts.length > 0) {
|
|
250
|
+
segments.push(tpsParts.join(" "));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (uiConfig.showTotalTokens) {
|
|
254
|
+
segments.push(`tokens: ${formatNumberWithCommas(agent.totalTokens)}`);
|
|
255
|
+
}
|
|
243
256
|
if (uiConfig.showElapsed) {
|
|
244
257
|
segments.push(formatElapsedTime(agent.elapsedMs));
|
|
245
258
|
}
|
|
@@ -338,7 +351,11 @@ function createUIManager(client, config) {
|
|
|
338
351
|
function flushPendingUpdate() {
|
|
339
352
|
if (pendingState) {
|
|
340
353
|
const formatted = formatDisplay(pendingState);
|
|
341
|
-
|
|
354
|
+
let tpsForColor = pendingState.instantTps;
|
|
355
|
+
if (pendingState.totalTokens === 0 && pendingState.agents?.length) {
|
|
356
|
+
tpsForColor = Math.max(...pendingState.agents.map((a) => a.instantTps));
|
|
357
|
+
}
|
|
358
|
+
display(formatted, false, tpsForColor);
|
|
342
359
|
lastDisplayedState = { ...pendingState };
|
|
343
360
|
pendingState = null;
|
|
344
361
|
}
|
|
@@ -1000,8 +1017,11 @@ function TpsMeterPlugin(context) {
|
|
|
1000
1017
|
const roleCache = messageRoleCache.get(info.sessionID) || new Map;
|
|
1001
1018
|
messageRoleCache.set(info.sessionID, roleCache);
|
|
1002
1019
|
roleCache.set(info.id, info.role);
|
|
1003
|
-
if (info.agent
|
|
1004
|
-
|
|
1020
|
+
if (info.agent || info.agentType) {
|
|
1021
|
+
const agentName = info.agent?.name || info.agent?.type || info.agentType || info.agent?.id;
|
|
1022
|
+
if (agentName && typeof agentName === "string") {
|
|
1023
|
+
sessionAgentNameCache.set(info.sessionID, agentName);
|
|
1024
|
+
}
|
|
1005
1025
|
}
|
|
1006
1026
|
if (info.role === "assistant") {
|
|
1007
1027
|
const sessionId = info.sessionID;
|
package/dist/index.mjs
CHANGED
|
@@ -191,8 +191,21 @@ function createUIManager(client, config) {
|
|
|
191
191
|
}
|
|
192
192
|
function formatAgentLine(agent) {
|
|
193
193
|
const segments = [];
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
if (uiConfig.showInstant || uiConfig.showAverage) {
|
|
195
|
+
const tpsParts = [];
|
|
196
|
+
if (uiConfig.showInstant) {
|
|
197
|
+
tpsParts.push(`${agent.instantTps.toFixed(1)}`);
|
|
198
|
+
}
|
|
199
|
+
if (uiConfig.showAverage) {
|
|
200
|
+
tpsParts.push(`(avg ${agent.avgTps.toFixed(1)})`);
|
|
201
|
+
}
|
|
202
|
+
if (tpsParts.length > 0) {
|
|
203
|
+
segments.push(tpsParts.join(" "));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (uiConfig.showTotalTokens) {
|
|
207
|
+
segments.push(`tokens: ${formatNumberWithCommas(agent.totalTokens)}`);
|
|
208
|
+
}
|
|
196
209
|
if (uiConfig.showElapsed) {
|
|
197
210
|
segments.push(formatElapsedTime(agent.elapsedMs));
|
|
198
211
|
}
|
|
@@ -291,7 +304,11 @@ function createUIManager(client, config) {
|
|
|
291
304
|
function flushPendingUpdate() {
|
|
292
305
|
if (pendingState) {
|
|
293
306
|
const formatted = formatDisplay(pendingState);
|
|
294
|
-
|
|
307
|
+
let tpsForColor = pendingState.instantTps;
|
|
308
|
+
if (pendingState.totalTokens === 0 && pendingState.agents?.length) {
|
|
309
|
+
tpsForColor = Math.max(...pendingState.agents.map((a) => a.instantTps));
|
|
310
|
+
}
|
|
311
|
+
display(formatted, false, tpsForColor);
|
|
295
312
|
lastDisplayedState = { ...pendingState };
|
|
296
313
|
pendingState = null;
|
|
297
314
|
}
|
|
@@ -953,8 +970,11 @@ function TpsMeterPlugin(context) {
|
|
|
953
970
|
const roleCache = messageRoleCache.get(info.sessionID) || new Map;
|
|
954
971
|
messageRoleCache.set(info.sessionID, roleCache);
|
|
955
972
|
roleCache.set(info.id, info.role);
|
|
956
|
-
if (info.agent
|
|
957
|
-
|
|
973
|
+
if (info.agent || info.agentType) {
|
|
974
|
+
const agentName = info.agent?.name || info.agent?.type || info.agentType || info.agent?.id;
|
|
975
|
+
if (agentName && typeof agentName === "string") {
|
|
976
|
+
sessionAgentNameCache.set(info.sessionID, agentName);
|
|
977
|
+
}
|
|
958
978
|
}
|
|
959
979
|
if (info.role === "assistant") {
|
|
960
980
|
const sessionId = info.sessionID;
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAmC,SAAS,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnH;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,GACb,UAAU,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAmC,SAAS,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnH;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,GACb,UAAU,CA+VZ;AAED,eAAe,eAAe,CAAC"}
|