@deathbeam/pi-usage 0.0.9 → 0.0.10
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/index.ts +5 -3
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** /usage — fullscreen token usage and cost dashboard. */
|
|
2
2
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
4
|
+
import { basename, dirname, join } from "node:path";
|
|
5
5
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import { matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
@@ -162,8 +162,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
162
162
|
};
|
|
163
163
|
let render = () => {};
|
|
164
164
|
const agentDir = getAgentDir();
|
|
165
|
-
//
|
|
166
|
-
|
|
165
|
+
// getSessionDir() is this project's encoded-cwd dir under the default layout; count every project.
|
|
166
|
+
// shortcut: a custom dir named like --x-- reads as the default layout, use usesDefaultSessionDir() once it is exposed
|
|
167
|
+
const projectDir = ctx.sessionManager.getSessionDir();
|
|
168
|
+
const sessionDir = basename(projectDir).startsWith("-") ? dirname(projectDir) : projectDir;
|
|
167
169
|
const abort = new AbortController();
|
|
168
170
|
const loaded = collectUsage(
|
|
169
171
|
sessionDir,
|