@trim21/personal-pi-extensions 0.1.20261031020401 → 0.1.20261031210431
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/package.json
CHANGED
|
@@ -42,7 +42,6 @@ const PROGRESS_MARKDOWN_MARKERS_RE = /[`*_~[\]<>#|]/g;
|
|
|
42
42
|
|
|
43
43
|
/** 进度面板要展示的运行统计(`runAgent` 的 `result.usage`)。 */
|
|
44
44
|
export interface ProgressUsage {
|
|
45
|
-
turns: number;
|
|
46
45
|
cost: number;
|
|
47
46
|
contextTokens: number;
|
|
48
47
|
}
|
|
@@ -105,11 +104,8 @@ export function formatTokens(count: number): string {
|
|
|
105
104
|
|
|
106
105
|
function formatUsageStats(usage: ProgressUsage, model?: string): string {
|
|
107
106
|
const parts: string[] = [];
|
|
108
|
-
if (usage.turns) {
|
|
109
|
-
parts.push(`${usage.turns} turn${usage.turns > 1 ? "s" : ""}`);
|
|
110
|
-
}
|
|
111
107
|
if (usage.cost) {
|
|
112
|
-
parts.push(`$${usage.cost.toFixed(
|
|
108
|
+
parts.push(`$${usage.cost.toFixed(3)}`);
|
|
113
109
|
}
|
|
114
110
|
if (usage.contextTokens > 0) {
|
|
115
111
|
parts.push(`ctx:${formatTokens(usage.contextTokens)}`);
|
package/src/spawn-agent.ts
CHANGED
|
@@ -145,7 +145,6 @@ const spawnAgentSchema = Type.Object({
|
|
|
145
145
|
interface UsageStats {
|
|
146
146
|
cost: number;
|
|
147
147
|
contextTokens: number;
|
|
148
|
-
turns: number;
|
|
149
148
|
}
|
|
150
149
|
|
|
151
150
|
/** 子 agent 的一次运行结果:runAgent 的返回值。 */
|
|
@@ -377,7 +376,6 @@ export async function runAgent(
|
|
|
377
376
|
usage: {
|
|
378
377
|
cost: 0,
|
|
379
378
|
contextTokens: 0,
|
|
380
|
-
turns: 0,
|
|
381
379
|
},
|
|
382
380
|
};
|
|
383
381
|
|
|
@@ -452,7 +450,6 @@ export async function runAgent(
|
|
|
452
450
|
const msg = event.message;
|
|
453
451
|
result.messages.push(msg);
|
|
454
452
|
if (msg.role === "assistant") {
|
|
455
|
-
result.usage.turns++;
|
|
456
453
|
result.usage.cost += msg.usage.cost.total;
|
|
457
454
|
result.usage.contextTokens = msg.usage.totalTokens;
|
|
458
455
|
if (!result.model) {
|