@d3ara1n/pi-editor-shell 0.5.0 → 0.6.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 (3) hide show
  1. package/README.md +5 -11
  2. package/package.json +1 -1
  3. package/src/index.ts +12 -2
package/README.md CHANGED
@@ -5,7 +5,7 @@ Replaces pi's default editor and status bar with a unified rounded-corner shell
5
5
  ## What shows up where
6
6
 
7
7
  - **Top border** — `  provider/model ·  thinking-level ` (left) + pinned extension statuses (right, via `pinnedStatus` config)
8
- - **Bottom border** — `  ctx NN%/NNNk · ⚡ cacheRead (total)  hitRate% ` (left) + `  ~/Projects (main +2 ~1) ` (right, shows git branch + dirty state when in a repo)
8
+ - **Bottom border** — `  ctx NN%/NNk|N.NM · ⚡ cacheRead (total)  hitRate% ` (left) + `  ~/Projects (main +2 ~1) ` (right, shows git branch + dirty state when in a repo)
9
9
  - **Below shell** — Auto-wrapping extension status line (all `setStatus` entries not pinned to the top)
10
10
  - **Border color** follows pi's thinking-level / bash-mode indicator automatically.
11
11
 
@@ -15,19 +15,13 @@ All segments are re-read from live session state on every paint, so switching th
15
15
 
16
16
  In `~/.pi/agent/settings.json` under the `editorShell` key:
17
17
 
18
- ```jsonc
18
+ ```json
19
19
  {
20
20
  "editorShell": {
21
- // Status keys to pin to the top-right corner of the shell.
22
- // Only keys set via ctx.ui.setStatus() are eligible.
23
21
  "pinnedStatus": ["subagent", "access-denied"],
24
-
25
- // Per-slot border-icon overrides. Any subset; missing keys fall back
26
- // to the built-in Nerd Font set (see table below). Values are raw
27
- // characters — "\uf0e7" for a Nerd Font glyph, "🤖" for an emoji.
28
22
  "icons": {
29
- "model": "🤖",
30
- "cache": "\uf0e7"
23
+ "model": "robot",
24
+ "cache": "\\uf0e7"
31
25
  }
32
26
  }
33
27
  }
@@ -64,7 +58,7 @@ pi install npm:@d3ara1n/pi-editor-shell
64
58
 
65
59
  Or add to `~/.pi/agent/settings.json`:
66
60
 
67
- ```jsonc
61
+ ```json
68
62
  {
69
63
  "extensions": [
70
64
  "/absolute/path/to/pi-extensions/packages/pi-editor-shell"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3ara1n/pi-editor-shell",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "Replaces pi's default editor and status bar with a unified rounded-corner shell embedding status info in the border",
6
6
  "keywords": [
package/src/index.ts CHANGED
@@ -47,6 +47,16 @@ function contextToken(pct: number | null | undefined): ThemeColor {
47
47
  return "success";
48
48
  }
49
49
 
50
+ function trimFixed1(n: number): string {
51
+ const text = n.toFixed(1);
52
+ return text.endsWith(".0") ? text.slice(0, -2) : text;
53
+ }
54
+
55
+ function formatContextWindow(tokens: number): string {
56
+ if (tokens >= 1_000_000) return `${trimFixed1(tokens / 1_000_000)}M`;
57
+ return `${(tokens / 1_000).toFixed(0)}k`;
58
+ }
59
+
50
60
  // ── Built-in icon set (Nerd Font). Users can override any subset via the
51
61
  // `editorShell.icons` config — see config.ts. `cache` uses U+26A1, which
52
62
  // Nerd Fonts maps `oct-zap` to directly (no dedicated glyph), so it is
@@ -280,8 +290,8 @@ export default function (pi: ExtensionAPI) {
280
290
  const ctxWindow = usage?.contextWindow ?? ctx.model?.contextWindow;
281
291
  const ctxText =
282
292
  pct != null && ctxWindow
283
- ? `${pct.toFixed(1)}%/${(ctxWindow / 1000).toFixed(0)}k`
284
- : "?/??k";
293
+ ? `${pct.toFixed(1)}%/${formatContextWindow(ctxWindow)}`
294
+ : "?/??";
285
295
 
286
296
  // Cache-read tokens — per-turn figure first, session total in parens,
287
297
  // then hit rate (pi's "CHxx%" formula). All refreshed at agent_end and