@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.
Files changed (2) hide show
  1. package/index.ts +5 -3
  2. 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
- // ctx.sessionManager already resolved --session-dir, the env var and settings.sessionDir.
166
- const sessionDir = ctx.sessionManager.getSessionDir();
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deathbeam/pi-usage",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Minimal extension for token usage and cost per provider, model and project.",
5
5
  "type": "module",
6
6
  "license": "MIT",