@narumitw/pi-usage 0.43.0 → 0.49.0

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/package.json +3 -3
  2. package/src/usage.ts +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narumitw/pi-usage",
3
- "version": "0.43.0",
3
+ "version": "0.49.0",
4
4
  "description": "Pi extension that shows current-account usage for Codex, GitHub Copilot, and OpenRouter.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "peerDependencies": {
34
- "@earendil-works/pi-coding-agent": ">=0.81.0"
34
+ "@earendil-works/pi-coding-agent": "*"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@biomejs/biome": "2.5.6",
@@ -45,6 +45,6 @@
45
45
  "directory": "extensions/pi-usage"
46
46
  },
47
47
  "dependencies": {
48
- "@narumitw/pi-tui-kit": "^0.41.0"
48
+ "@narumitw/pi-tui-kit": "^0.46.0"
49
49
  }
50
50
  }
package/src/usage.ts CHANGED
@@ -3,7 +3,6 @@ import type {
3
3
  ExtensionCommandContext,
4
4
  ExtensionContext,
5
5
  } from "@earendil-works/pi-coding-agent";
6
- import { defineMenu, runMenu, runTask } from "@narumitw/pi-tui-kit";
7
6
  import {
8
7
  awaitWithDeadline,
9
8
  errorMessage,
@@ -348,6 +347,8 @@ export default function usageExtension(pi: ExtensionAPI) {
348
347
  parentSignal: AbortSignal,
349
348
  operation: (signal: AbortSignal) => Promise<T>,
350
349
  ): Promise<T | undefined> => {
350
+ const { runTask } = await import("@narumitw/pi-tui-kit");
351
+ if (parentSignal.aborted) return undefined;
351
352
  const result = await runTask(ctx, {
352
353
  label,
353
354
  signal: parentSignal,
@@ -464,6 +465,8 @@ export default function usageExtension(pi: ExtensionAPI) {
464
465
  publishStableCurrent(ctx, stableCurrent);
465
466
  let current = stableCurrent.outcome;
466
467
  let visibleStates: ProviderUsageState[] = [current.state];
468
+ const { defineMenu, runMenu } = await import("@narumitw/pi-tui-kit");
469
+ if (controller.signal.aborted || statusGeneration !== menuGeneration) return;
467
470
  type Screen = "main" | "providers";
468
471
  type Action = "refresh" | "another" | "all" | "provider";
469
472
  const menu = defineMenu<undefined, Screen, Action, ExtensionCommandContext>({