pi-zentui 0.11.0 → 0.12.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.
package/README.md CHANGED
@@ -21,7 +21,7 @@ Zentui brings two popular aesthetics to Pi:
21
21
  - `on branch` — git branch with icon
22
22
  - `[!?↑]` — git status indicators (modified, untracked, ahead/behind, stashed, etc.)
23
23
  - `via v5.5.0` — runtime detection with version and Starship-style Nerd Font runtime/language modules
24
- - Optional segments (off by default): `user@host`, current time, OS icon, session duration, and the **project package version** (e.g. `package.json` → `0.6.0`) — distinct from the runtime segment, which shows the installed toolchain
24
+ - Optional segments (off by default): session name, `user@host`, current time, OS icon, session duration, and the **project package version** (e.g. `package.json` → `0.6.0`) — distinct from the runtime segment, which shows the installed toolchain
25
25
  - Right side shows context usage, token counts, and cost
26
26
  - Built-in footer segments can be shown or hidden individually from `/zentui`
27
27
  - Fully custom Starship-style layout via a `footerFormat` template string — see [Footer Format Template](#footer-format-template)
@@ -194,6 +194,7 @@ Default config values — copy this and change any value you want:
194
194
  },
195
195
  "colors": {
196
196
  "cwd": "bold cyan",
197
+ "sessionName": "bold green",
197
198
  "gitBranch": "bold purple",
198
199
  "gitStatus": "bold red",
199
200
  "contextNormal": "bright-black",
@@ -236,6 +237,7 @@ Default config values — copy this and change any value you want:
236
237
  },
237
238
  "footerSegments": {
238
239
  "cwd": true,
240
+ "sessionName": true,
239
241
  "gitBranch": true,
240
242
  "gitStatus": true,
241
243
  "gitCounts": false,
@@ -283,7 +285,7 @@ Default config values — copy this and change any value you want:
283
285
  - `icons`: every shown icon key is configurable; omit any key to use the Zentui default. `icons.mode` is `auto` | `nerd` | `ascii` (default `auto`, same glyphs as nerd). ASCII mode swaps in plain fallbacks for statusline icons and runtime symbols — useful without a Nerd Font. Custom per-icon strings always win over mode defaults. Custom `icons.os` always wins; when left at the mode default, Zentui maps the OS icon by platform. `rail` sets the vertical glyph drawn as the left rail of the active editor frame and previous user messages when `copyFriendly` is disabled (default `│`; any single Unicode vertical or block glyph). `editorPrompt` controls an optional copy-friendly editor prompt glyph; the default is `""` so copy-friendly mode stays rail-free.
284
286
  - `colorSources`: `theme` maps styles through Pi theme tokens; `terminal` emits terminal colors. `/zentui` switches these sources; manual JSON controls specific style values.
285
287
  - `features`: `editor` enables Zentui's custom editor, selector borders, and previous-message chrome. `statusLine` enables Zentui's custom footer/status line. `copyFriendly` hides editor and previous-message rail glyphs so native terminal selection copies less chrome. All three can be changed from `/zentui` or direct slash-command arguments.
286
- - `footerSegments`: show or hide individual built-in footer segments (`cwd`, `gitBranch`, `gitStatus`, `gitCounts`, `gitCommit`, `gitMetrics`, `runtime`, `packageVersion`, `sessionDuration`, `username`, `time`, `os`, `context`, `tokens`, `cost`). Toggle them from the `Built-in segments` tab in `/zentui`.
288
+ - `footerSegments`: show or hide individual built-in footer segments (`cwd`, `sessionName`, `gitBranch`, `gitStatus`, `gitCounts`, `gitCommit`, `gitMetrics`, `runtime`, `packageVersion`, `sessionDuration`, `username`, `time`, `os`, `context`, `tokens`, `cost`). Toggle them from the `Built-in segments` tab in `/zentui`.
287
289
  - `footerFormat`: optional Starship-style template string that fully controls the footer layout. When set, it overrides `footerSegments`. See [Footer Format Template](#footer-format-template) below. The `/zentui` **Layout** tab configures context style, separator, path display mode/depth, branch length, and icon mode; set or clear custom formats with `/zentui format`.
288
290
  - `gitCommit`: Starship [`git_commit`](https://starship.rs/config/#git-commit)-style options for the `gitCommit` footer segment. `hashLength` (default `7`, clamped to `4`–`40`) controls the short-hash display length. `onlyDetached` (default `true`) shows the hash mainly on detached HEAD. `showTag` (default `true`) appends an exact-match tag (`git describe --tags --exact-match HEAD`). The tag probe piggybacks on the existing git refresh — it only runs when both the segment and `showTag` are on, and misses/failures degrade silently.
289
291
  - `gitMetrics`: Starship [`git_metrics`](https://starship.rs/config/#git-metrics)-style options for the `gitMetrics` footer segment. Uses `git diff HEAD --numstat` (staged + unstaged combined — the Starship “total dirty” view) to show aggregate `+added −deleted` line counts. `onlyNonzero` (default `true`) omits each zero component independently and hides the segment entirely at `0/0`. `ignoreSubmodules` (default `false`) adds `--ignore-submodules=all`. The numstat diff piggybacks on the existing git refresh and uses a hard 2s timeout; a metrics-only failure degrades silently without discarding fresh branch/status data. On very large monorepos the diff may lag or be omitted on timeout.
@@ -304,7 +306,7 @@ A second `$fill` creates a **centered middle zone** — content between the two
304
306
 
305
307
  ```json
306
308
  {
307
- "footerFormat": "$os $username $cwd( on $git_branch)( $git_status)( via $runtime)$fill($context)($sep$tokens)($sep$cost)($sep$time)"
309
+ "footerFormat": "$os $username $cwd($sep$session_name)( on $git_branch)( $git_status)( via $runtime)$fill($context)($sep$tokens)($sep$cost)($sep$time)"
308
310
  }
309
311
  ```
310
312
 
@@ -321,6 +323,7 @@ Center the branch between directory and cost:
321
323
  | Token | Aliases | Renders |
322
324
  | ------------------- | ------------ | ------------------------------------------------------------------- |
323
325
  | `$cwd` | `$directory` | current directory |
326
+ | `$session_name` | | current Pi session name |
324
327
  | `$git_branch` | `$branch` | git branch with icon |
325
328
  | `$git_status` | `$status` | `[!?↑]` status block |
326
329
  | `$git_state` | `$state` | `REBASING` / `MERGING` / … (optional `n/m`) |
@@ -354,6 +357,7 @@ Center the branch between directory and cost:
354
357
  - Literal text (`on branch`, `using`, `\|`, spaces) is rendered verbatim — you control all spacing.
355
358
  - Each variable renders its core value only (no `on`/`via` prefixes); add those words as literal text.
356
359
  - Conditional groups: wrap optional pieces in parentheses, e.g. `$cwd( on $git_branch)($git_status)$fill($context)`. If every `$var` inside a group is empty, the whole group (including its literals) is dropped.
360
+ - `$session_name` is available whenever `footerFormat` is set, independently of `footerSegments.sessionName`; use a conditional group such as `($sep$session_name)` so unnamed sessions leave no separator.
357
361
  - Unknown `$variables` render empty.
358
362
  - Set or clear at runtime: `/zentui format "<template>"` and `/zentui format clear`.
359
363
 
@@ -409,7 +413,7 @@ Mouse wheel scrolling is enabled by default when the fixed editor is on. Disable
409
413
 
410
414
  ## Requirements
411
415
 
412
- - [Pi](https://pi.dev) coding agent 0.80 or newer
416
+ - [Pi](https://pi.dev) coding agent 0.80.3 or newer
413
417
  - A [Nerd Font](https://www.nerdfonts.com/) for icons (or set `icons.mode` to `"ascii"`)
414
418
 
415
419
  ## Development
@@ -66,6 +66,7 @@ export type UiFeaturesConfig = {
66
66
 
67
67
  export type FooterSegmentsConfig = {
68
68
  cwd: boolean;
69
+ sessionName: boolean;
69
70
  gitBranch: boolean;
70
71
  gitStatus: boolean;
71
72
  gitCounts: boolean;
@@ -132,6 +133,7 @@ export type PolishedTuiConfig = {
132
133
  icons: ResolvedIcons;
133
134
  colors: {
134
135
  cwd: ColorSpec;
136
+ sessionName: ColorSpec;
135
137
  gitBranch: ColorSpec;
136
138
  gitStatus: ColorSpec;
137
139
  contextNormal: ColorSpec;
@@ -177,6 +179,7 @@ export type PolishedTuiConfig = {
177
179
  */
178
180
  export const FOOTER_FORMAT_VARIABLES = [
179
181
  "cwd",
182
+ "session_name",
180
183
  "git_branch",
181
184
  "git_status",
182
185
  "git_state",
@@ -229,6 +232,7 @@ export const defaultConfig: PolishedTuiConfig = {
229
232
  },
230
233
  colors: {
231
234
  cwd: "bold cyan",
235
+ sessionName: "bold green",
232
236
  gitBranch: "bold purple",
233
237
  gitStatus: "bold red",
234
238
  contextNormal: "bright-black",
@@ -260,6 +264,7 @@ export const defaultConfig: PolishedTuiConfig = {
260
264
  },
261
265
  footerSegments: {
262
266
  cwd: true,
267
+ sessionName: true,
263
268
  gitBranch: true,
264
269
  gitStatus: true,
265
270
  gitCounts: false,
@@ -431,6 +436,7 @@ function normalizeIconOverrides(record: Record<string, unknown>): Partial<IconGl
431
436
  function normalizeColors(record: Record<string, unknown>): Partial<PolishedTuiConfig["colors"]> {
432
437
  return definedColors({
433
438
  cwd: colorValue(record, "cwd") ?? colorValue(record, "cwdText"),
439
+ sessionName: colorValue(record, "sessionName"),
434
440
  gitBranch: colorValue(record, "gitBranch") ?? colorValue(record, "git"),
435
441
  gitStatus: colorValue(record, "gitStatus"),
436
442
  contextNormal: colorValue(record, "contextNormal"),
@@ -482,6 +488,7 @@ function normalizeUiFeatures(record: Record<string, unknown>): UiFeaturesConfig
482
488
  function normalizeFooterSegments(record: Record<string, unknown>): FooterSegmentsConfig {
483
489
  return {
484
490
  cwd: footerSegmentValue(record, "cwd"),
491
+ sessionName: footerSegmentValue(record, "sessionName"),
485
492
  gitBranch: footerSegmentValue(record, "gitBranch"),
486
493
  gitStatus: footerSegmentValue(record, "gitStatus"),
487
494
  gitCounts: footerSegmentValue(record, "gitCounts"),
@@ -593,6 +600,7 @@ function isUiFeatureKey(value: string): value is keyof UiFeaturesConfig {
593
600
  function isFooterSegmentKey(value: string): value is keyof FooterSegmentsConfig {
594
601
  return (
595
602
  value === "cwd" ||
603
+ value === "sessionName" ||
596
604
  value === "gitBranch" ||
597
605
  value === "gitStatus" ||
598
606
  value === "gitCounts" ||
@@ -2,7 +2,11 @@ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
3
3
  import type { PolishedTuiConfig, SeparatorStyle } from "./config";
4
4
  import { FOOTER_FORMAT_ALIASES } from "./config";
5
- import { collectExtensionStatusSegments, type ExtensionStatusSegment } from "./extension-status";
5
+ import {
6
+ collectExtensionStatusSegments,
7
+ type ExtensionStatusSegment,
8
+ sanitizeExtensionStatusText,
9
+ } from "./extension-status";
6
10
  import { parseFooterFormat, renderFormatSplit, stripOrphanSeparators } from "./footer-format";
7
11
  import {
8
12
  buildContextDisplayLabel,
@@ -195,6 +199,16 @@ export function installFooter(
195
199
  depth: config.pathDisplay.depth,
196
200
  }),
197
201
  );
202
+ const needsSessionName = config.footerFormat
203
+ ? /(?:\$session_name\b|\$\{session_name\})/.test(config.footerFormat)
204
+ : config.footerSegments.sessionName;
205
+ const sessionName = needsSessionName
206
+ ? sanitizeExtensionStatusText(ctx.sessionManager.getSessionName() ?? "")
207
+ : "";
208
+ const sessionNameLabel = sessionName
209
+ ? renderStyleForSource(theme, colorSource, config.colors.sessionName, sessionName)
210
+ : "";
211
+ const builtInSessionNameLabel = sessionNameLabel ? `in ${sessionNameLabel}` : "";
198
212
  const branch = state.branch;
199
213
  const branchText = branch
200
214
  ? formatGitBranchText(branch, config.gitBranch.maxLength)
@@ -263,6 +277,8 @@ export function installFooter(
263
277
  switch (canonical) {
264
278
  case "cwd":
265
279
  return cwdLabel;
280
+ case "session_name":
281
+ return sessionNameLabel;
266
282
  case "git_branch":
267
283
  return branchText
268
284
  ? gitIcon
@@ -491,6 +507,7 @@ export function installFooter(
491
507
  osSegment,
492
508
  usernameSegment,
493
509
  config.footerSegments.cwd ? cwdLabel : "",
510
+ config.footerSegments.sessionName ? builtInSessionNameLabel : "",
494
511
  branchLabel,
495
512
  gitCommitLabel,
496
513
  gitMetricsLabel,
@@ -536,6 +536,7 @@ export default function (pi: ExtensionAPI) {
536
536
  syncInteractiveState(event, ctx);
537
537
  });
538
538
  pi.on("thinking_level_select", syncInteractiveState);
539
+ pi.on("session_info_changed", syncInteractiveState);
539
540
  pi.on("message_update", (event) => {
540
541
  liveContext.update(event.message);
541
542
  });
@@ -124,6 +124,7 @@ const featureSettingDescriptions: Record<FeatureSettingId, string> = {
124
124
 
125
125
  const footerSegmentSettingLabels: Record<FooterSegmentSettingId, string> = {
126
126
  cwd: "Current directory",
127
+ sessionName: "Session name",
127
128
  gitBranch: "Git branch",
128
129
  gitStatus: "Git status",
129
130
  gitCounts: "Git counts",
@@ -142,6 +143,7 @@ const footerSegmentSettingLabels: Record<FooterSegmentSettingId, string> = {
142
143
 
143
144
  const footerSegmentSettingDescriptions: Record<FooterSegmentSettingId, string> = {
144
145
  cwd: "Show or hide the current working directory segment on the left.",
146
+ sessionName: "Show or hide the current Pi session name on the left, after the current directory.",
145
147
  gitBranch: "Show or hide the git branch name on the left.",
146
148
  gitStatus: "Show or hide git status icons and ahead/behind markers.",
147
149
  gitCounts:
@@ -207,6 +209,7 @@ function isFeatureSettingId(value: string): value is FeatureSettingId {
207
209
  function isFooterSegmentSettingId(value: string): value is FooterSegmentSettingId {
208
210
  return (
209
211
  value === "cwd" ||
212
+ value === "sessionName" ||
210
213
  value === "gitBranch" ||
211
214
  value === "gitStatus" ||
212
215
  value === "gitCounts" ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-zentui",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "A Starship-inspired statusline and Opencode-style TUI for Pi.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,9 +35,9 @@
35
35
  "prepublishOnly": "npm run verify && npm run pack:check"
36
36
  },
37
37
  "peerDependencies": {
38
- "@earendil-works/pi-ai": ">=0.80",
39
- "@earendil-works/pi-coding-agent": ">=0.80",
40
- "@earendil-works/pi-tui": ">=0.80"
38
+ "@earendil-works/pi-ai": ">=0.80.3",
39
+ "@earendil-works/pi-coding-agent": ">=0.80.3",
40
+ "@earendil-works/pi-tui": ">=0.80.3"
41
41
  },
42
42
  "pi": {
43
43
  "extensions": [