@leo-alvarenga/pi-zen-frame 0.19.0 → 0.19.3

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.
@@ -11,7 +11,7 @@
11
11
  import type { Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
12
12
 
13
13
  import type { FrameIcons, FrameSettings, SpinnerPhase } from "../config/types";
14
- import { TokenUsage } from "../utils/token";
14
+ import type { ContextUsage } from "../utils/token";
15
15
 
16
16
  /** Where a segment renders. "top*" → the box-bottom row inside the band,
17
17
  * "bottom*" → the pseudo-footer row below it (names kept from the old
@@ -52,7 +52,7 @@ export interface FrameData {
52
52
  /** To render the agent mode (from @leo-alvarenga/pi-agent-manager) segment, if any */
53
53
  agentMode: AgentMode;
54
54
 
55
- context: TokenUsage | null;
55
+ context: ContextUsage | null;
56
56
 
57
57
  /** pi-notify toggle state (true = notifications enabled). */
58
58
  notifyEnabled: boolean;
@@ -20,7 +20,7 @@ function loadSettingsFile(): Promise<string> {
20
20
  }
21
21
 
22
22
  /** Validate a raw (possibly malformed) config against the schema shapes */
23
- function normalize(raw: unknown): Settings {
23
+ export function normalize(raw: unknown): Settings {
24
24
  if (!raw || typeof raw !== "object") return DEFAULT_SETTINGS;
25
25
 
26
26
  const num = (v: unknown, fallback: number): number =>
@@ -8,7 +8,7 @@ import { THEME_COLORS } from "../config/constants";
8
8
  export * from "./agent";
9
9
  export * from "./git";
10
10
  export * from "./path";
11
- export * from "./string";
11
+ export { capitalize } from "@leo-alvarenga/pi-ext-core";
12
12
 
13
13
  export function isThemeColor(value: string): value is ThemeColor {
14
14
  return value in THEME_COLORS;
@@ -1,21 +1,18 @@
1
1
  import { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import type { TokenUsage } from "@leo-alvarenga/pi-ext-core";
2
3
 
3
- export type TokenUsage = TokenThroughput & {
4
+ /** Token usage plus the context-window figures the panel renders. */
5
+ export type ContextUsage = TokenUsage & {
4
6
  tokens: number;
5
7
  window: number;
6
8
  percent: number;
7
9
  };
8
10
 
9
- export type TokenThroughput = {
10
- input: number;
11
- output: number;
12
- };
13
-
14
11
  type EntryUsage = {
15
- usage?: TokenThroughput;
12
+ usage?: TokenUsage;
16
13
  };
17
14
 
18
- function getUsageFromEntries(ctx: ExtensionContext): TokenThroughput {
15
+ function getUsageFromEntries(ctx: ExtensionContext): TokenUsage {
19
16
  let input = 0,
20
17
  output = 0;
21
18
 
@@ -34,7 +31,7 @@ function getUsageFromEntries(ctx: ExtensionContext): TokenThroughput {
34
31
  return { input, output };
35
32
  }
36
33
 
37
- export function getUsage(ctx?: ExtensionContext): TokenUsage | null {
34
+ export function getUsage(ctx?: ExtensionContext): ContextUsage | null {
38
35
  if (!ctx) return null;
39
36
 
40
37
  const usage = ctx.getContextUsage();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@leo-alvarenga/pi-zen-frame",
3
3
  "description": "A pi-coding-agent extension that gives the TUI editor a simple yet polished look and feel",
4
4
  "author": "Leonardo A. Alvarenga",
5
- "version": "0.19.0",
5
+ "version": "0.19.3",
6
6
  "license": "MIT",
7
7
  "repository": "github.com/leo-alvarenga/pi-mono",
8
8
  "publishConfig": {
@@ -15,13 +15,18 @@
15
15
  ],
16
16
  "files": [
17
17
  "extensions",
18
+ "!extensions/test",
18
19
  "docs",
19
20
  "README.md",
20
21
  "LICENSE"
21
22
  ],
22
23
  "peerDependencies": {
23
24
  "@earendil-works/pi-coding-agent": "*",
24
- "@earendil-works/pi-tui": "*"
25
+ "@earendil-works/pi-tui": "*",
26
+ "typebox": "*"
27
+ },
28
+ "dependencies": {
29
+ "@leo-alvarenga/pi-ext-core": "^0.3.4"
25
30
  },
26
31
  "pi": {
27
32
  "extensions": [
@@ -34,10 +39,12 @@
34
39
  },
35
40
  "devDependencies": {
36
41
  "@types/node": "^26.1.2",
37
- "typescript": "^7.0.2"
42
+ "typescript": "^7.0.2",
43
+ "vitest": "^3.2.4"
38
44
  },
39
45
  "scripts": {
40
46
  "build": "tsc",
41
- "typecheck": "tsc"
47
+ "typecheck": "tsc",
48
+ "test": "vitest run"
42
49
  }
43
50
  }
@@ -1,6 +0,0 @@
1
- /** Domain: string manipulation. */
2
-
3
- /** Uppercase the first character ("claude" → "Claude"). */
4
- export function capitalize(s: string): string {
5
- return s.charAt(0).toUpperCase() + s.slice(1);
6
- }