refactor(copilot): remove unused usage total helper

This commit is contained in:
Vincent Koc
2026-06-18 22:29:38 +08:00
parent 3f4c04f4df
commit bad21faf62
2 changed files with 0 additions and 28 deletions

View File

@@ -3,7 +3,6 @@ import type { NormalizedUsage } from "openclaw/plugin-sdk/agent-harness-runtime"
import { describe, expect, it } from "vitest";
import {
buildCopilotAssistantUsage,
deriveCopilotUsageTotal,
normalizeCopilotUsage,
} from "./usage-bridge.js";
@@ -251,21 +250,4 @@ describe("usage-bridge", () => {
});
});
describe("deriveCopilotUsageTotal", () => {
it("returns undefined when usage is undefined", () => {
expect(deriveCopilotUsageTotal(undefined)).toBeUndefined();
});
it("sums input/output/cacheRead/cacheWrite for total", () => {
const usage: NormalizedUsage = {
cacheRead: 3,
cacheWrite: 4,
input: 1,
output: 2,
total: 999,
};
expect(deriveCopilotUsageTotal(usage)).toBe(10);
});
});
});

View File

@@ -72,13 +72,3 @@ export function buildCopilotAssistantUsage(params: {
totalTokens: usage?.total ?? 0,
};
}
export function deriveCopilotUsageTotal(usage?: NormalizedUsage): number | undefined {
if (!usage) {
return undefined;
}
return (
(usage.input ?? 0) + (usage.output ?? 0) + (usage.cacheRead ?? 0) + (usage.cacheWrite ?? 0)
);
}