refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -4,12 +4,12 @@ import path from "node:path";
import { describe, expect, it } from "vitest";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import { loadCostUsageSummary, loadSessionCostSummary } from "./session-cost-usage.js";
describe("session cost usage", () => {
it("aggregates daily totals with log cost and pricing fallback", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-cost-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-cost-"));
const sessionsDir = path.join(root, "agents", "main", "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
const sessionFile = path.join(sessionsDir, "sess-1.jsonl");
@@ -92,23 +92,23 @@ describe("session cost usage", () => {
},
},
},
} as MoltbotConfig;
} as OpenClawConfig;
const originalState = process.env.CLAWDBOT_STATE_DIR;
process.env.CLAWDBOT_STATE_DIR = root;
const originalState = process.env.OPENCLAW_STATE_DIR;
process.env.OPENCLAW_STATE_DIR = root;
try {
const summary = await loadCostUsageSummary({ days: 30, config });
expect(summary.daily.length).toBe(1);
expect(summary.totals.totalTokens).toBe(50);
expect(summary.totals.totalCost).toBeCloseTo(0.03003, 5);
} finally {
if (originalState === undefined) delete process.env.CLAWDBOT_STATE_DIR;
else process.env.CLAWDBOT_STATE_DIR = originalState;
if (originalState === undefined) delete process.env.OPENCLAW_STATE_DIR;
else process.env.OPENCLAW_STATE_DIR = originalState;
}
});
it("summarizes a single session file", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-cost-session-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-cost-session-"));
const sessionFile = path.join(root, "session.jsonl");
const now = new Date();