pi-one-ui 0.6.1 → 0.7.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/CHANGELOG.md CHANGED
@@ -6,6 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.0] - 2026-09-13
10
+
11
+ ### Added
12
+
13
+ - Added `components.editor.styles.minimalist.showCwd` to independently show or hide the Editor's working-directory label, including the `/oneui` preview. It defaults to `true`, so existing configurations need no migration. Setting it to `false` preserves `pathDisplay` and leaves Git metadata and Footer directory settings unchanged; edit the JSON configuration and run `/reload` to apply it.
14
+
15
+ ### Fixed
16
+
17
+ - Restore keyboard focus to the visible Editor after `/oneui` replaces an editor while changing its settings, including native-to-custom transitions, third-party wrappers, and replacement rollback. Closing the panel no longer sends subsequent typing to the detached previous editor in regular or fullscreen mode; existing overlays and later editor owners retain focus.
18
+
19
+ ### Migration
20
+
21
+ - No configuration migration is required. Existing configurations keep showing the Editor directory; set `components.editor.styles.minimalist.showCwd` to `false` only if you want to hide it. Footer directory settings remain independent.
22
+ - For an unpinned npm installation, run `pi update npm:pi-one-ui`; for an existing version pin, run `pi install npm:pi-one-ui@0.7.0`. Fully exit and restart Pi after updating the package. Subsequent JSON configuration edits can be applied with `/reload`.
23
+
9
24
  ## [0.6.1] - 2026-09-06
10
25
 
11
26
  ### Added
@@ -115,7 +130,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
115
130
 
116
131
  - Reduced rendering lag when expanding settled tool groups by reusing cached child output.
117
132
 
118
- [Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.6.1...HEAD
133
+ [Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.7.0...HEAD
134
+ [0.7.0]: https://github.com/kerolt/pi-one-ui/compare/v0.6.1...v0.7.0
119
135
  [0.6.1]: https://github.com/kerolt/pi-one-ui/compare/v0.6.0...v0.6.1
120
136
  [0.6.0]: https://github.com/kerolt/pi-one-ui/compare/v0.5.1...v0.6.0
121
137
  [0.5.1]: https://github.com/kerolt/pi-one-ui/compare/v0.5.0...v0.5.1
package/README.en.md CHANGED
@@ -76,6 +76,20 @@ Then open the unified settings panel:
76
76
  /oneui
77
77
  ```
78
78
 
79
+ ### Upgrading to 0.7.0
80
+
81
+ This release adds an Editor working-directory visibility switch and fixes invisible input after changing Editor settings and closing `/oneui`. Existing configurations need no migration; the directory remains visible by default.
82
+
83
+ For an unpinned npm installation, run:
84
+
85
+ ```bash
86
+ pi update npm:pi-one-ui
87
+ ```
88
+
89
+ If your installation pins a version, run `pi install npm:pi-one-ui@0.7.0` to update the pin. Fully exit and restart Pi after updating the package.
90
+
91
+ To hide the Editor directory, set `components.editor.styles.minimalist.showCwd: false`; Footer directory visibility is configured independently. See the complete example in the [configuration guide](./docs/configuration.md#隐藏-editor-目录在-footer-左侧显示).
92
+
79
93
  ## Configuration
80
94
 
81
95
  ### Configuration methods
@@ -132,7 +146,7 @@ Below is a typical v1 configuration structure:
132
146
  To keep the configuration section clean and focused, in-depth options, template variables, and color references are organized in dedicated documentation:
133
147
 
134
148
  - **Component options & layout customization**: see [Editor & Footer Configuration Guide (docs/configuration.md)](./docs/configuration.md)
135
- - **Editor**: Configure `style` (`on` for Minimalist decoration / `off` for Pi native), `borderColorMode` (`static` or `adaptive` to thinking effort), `modelLabel`, and granular Minimalist displays (directory path format, session name, timer, cost, Git status, etc.).
149
+ - **Editor**: Configure `style` (`on` for Minimalist decoration / `off` for Pi native), `borderColorMode` (`static` or `adaptive` to thinking effort), `modelLabel`, and granular Minimalist displays (directory visibility and format, session name, timer, cost, Git status, etc.). `components.editor.styles.minimalist.showCwd` (since 0.7.0, default `true`) can hide the directory independently of the Footer; `pathDisplay` continues to select its format.
136
150
  - **Footer**: Starship-style layout powered by format templates (`$cwd`, `$git_branch`, `$tokens`, `$cost`, etc.), individual `segments` toggles, customizable separators, and context-usage indicators (gauge or text).
137
151
  - **WorkingLine**: Built-in live output throughput tracking (appends e.g. `⚡12 tok/s` when a model response runs for at least 500ms, reset per turn).
138
152
  - **Settings panel (`/oneui`) customization**: the optional top-level `panel` section controls the overlay placement and size (all fields default to the values shown in the example above).
package/README.md CHANGED
@@ -76,6 +76,20 @@ pi install git:github.com/kerolt/pi-one-ui
76
76
  /oneui
77
77
  ```
78
78
 
79
+ ### 升级到 0.7.0
80
+
81
+ 本次新增 Editor 工作目录显示开关,并修复修改 Editor 配置后关闭 `/oneui` 导致输入不可见的问题。现有配置无需迁移,工作目录仍默认显示。
82
+
83
+ 未固定版本的 npm 安装可执行:
84
+
85
+ ```bash
86
+ pi update npm:pi-one-ui
87
+ ```
88
+
89
+ 若安装时固定了版本,执行 `pi install npm:pi-one-ui@0.7.0` 更新版本指定。更新安装包后,完整退出并重启 Pi。
90
+
91
+ 如需隐藏 Editor 目录,设置 `components.editor.styles.minimalist.showCwd: false`;Footer 中的目录显示独立配置。完整示例见 [配置指南](./docs/configuration.md#隐藏-editor-目录在-footer-左侧显示)。
92
+
79
93
  ## 配置
80
94
 
81
95
  ### 配置方式
@@ -132,7 +146,7 @@ pi install git:github.com/kerolt/pi-one-ui
132
146
  各项组件开关、模板变量与颜色字段的完整规范拆分收录于独立文档中,便于按需查阅:
133
147
 
134
148
  - **组件开关与排版定制**:详见 [Editor 与 Footer 配置指南 (docs/configuration.md)](./docs/configuration.md)
135
- - **Editor**:支持 `style`(`on` 极简装饰 / `off` 原生)、`borderColorMode`(固定色 / 思考档位自适应)、`modelLabel` 及 Minimalist 装饰细节(目录层级、会话名、耗时、费用、Git 状态等)。
149
+ - **Editor**:支持 `style`(`on` 极简装饰 / `off` 原生)、`borderColorMode`(固定色 / 思考档位自适应)、`modelLabel` 及 Minimalist 装饰细节(目录显示与格式、会话名、耗时、费用、Git 状态等)。`components.editor.styles.minimalist.showCwd`(0.7.0 起,默认 `true`)可单独隐藏工作目录,不影响 Footer;`pathDisplay` 继续控制目录格式。
136
150
  - **Footer**:支持 Starship 风格排版,提供丰富的模板变量(`$cwd`、`$git_branch`、`$tokens`、`$cost` 等),支持通过 `format` 自定义或通过 `segments` 控制各段开关,并可自由配置上下文占用率的展示形式(gauge / text)。
137
151
  - **WorkingLine**:内置实时输出速率检测(单次响应持续 >=500ms 自动追加如 `⚡12 tok/s`,按回合独立重置)。
138
152
  - **设置面板(`/oneui`)定制**:通过顶层 `panel` 字段控制浮层位置与尺寸,全部字段可省略(缺省值见上文示例)。
@@ -97,6 +97,8 @@ export type FooterSegmentsConfig = {
97
97
 
98
98
  export type MinimalistEditorStyleConfig = {
99
99
  pathDisplay: MinimalistPathDisplayMode;
100
+ /** Controls the Editor directory label independently of its format and the Footer. */
101
+ showCwd: boolean;
100
102
  showSessionName: boolean;
101
103
  showTimer: boolean;
102
104
  showCost: boolean;
@@ -395,6 +397,7 @@ const defaultFooterSegments: FooterSegmentsConfig = {
395
397
 
396
398
  const defaultMinimalistStyle: MinimalistEditorStyleConfig = {
397
399
  pathDisplay: "compact",
400
+ showCwd: true,
398
401
  showSessionName: true,
399
402
  showTimer: true,
400
403
  showCost: true,
@@ -1001,6 +1004,10 @@ function resolveComponents(config: ConfigRecord): ComponentsConfig {
1001
1004
  minimalist.pathDisplay === "full"
1002
1005
  ? minimalist.pathDisplay
1003
1006
  : defaultMinimalistStyle.pathDisplay,
1007
+ showCwd: parseBoolean(
1008
+ minimalist.showCwd,
1009
+ defaultMinimalistStyle.showCwd,
1010
+ ),
1004
1011
  showSessionName: parseBoolean(
1005
1012
  minimalist.showSessionName,
1006
1013
  defaultMinimalistStyle.showSessionName,
@@ -1386,6 +1393,9 @@ function applyMinimalistStylePatch(
1386
1393
  patch: Partial<MinimalistEditorStyleConfig>,
1387
1394
  ): void {
1388
1395
  if (patch.pathDisplay !== undefined) style.pathDisplay = patch.pathDisplay;
1396
+ if (patch.showCwd !== undefined) {
1397
+ style.showCwd = patch.showCwd;
1398
+ }
1389
1399
  if (patch.showSessionName !== undefined)
1390
1400
  style.showSessionName = patch.showSessionName;
1391
1401
  if (patch.showTimer !== undefined) style.showTimer = patch.showTimer;
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  type ExtensionCommandContext,
3
3
  type ExtensionContext,
4
+ type ExtensionUIContext,
4
5
  getSettingsListTheme,
5
6
  } from "@earendil-works/pi-coding-agent";
6
7
  import {
8
+ type Component,
7
9
  matchesKey,
10
+ type OverlayHandle,
8
11
  type SettingItem,
9
12
  SettingsList,
10
13
  truncateToWidth,
@@ -609,10 +612,22 @@ export async function showOneUiPanel(
609
612
  try {
610
613
  // Read fresh on every open so pi-one-ui.json edits apply without /reload.
611
614
  const panelOverlay = loadPanelOverlayConfig();
612
- let panelHandle: { focus: () => void } | undefined;
615
+ let panelHandle: Pick<OverlayHandle, "focus" | "unfocus"> | undefined;
613
616
  await overlayManager.run(() =>
614
617
  ctx.ui.custom(
615
618
  (tui, theme, _keybindings, done) => {
619
+ // Pi's concrete renderers expose focus inspection beyond the narrow TUI port.
620
+ const focusTui = tui as typeof tui & {
621
+ getFocusedComponent?: () => Component | null;
622
+ isOverlayFocused?: () => boolean;
623
+ };
624
+ const originalFocus = focusTui.getFocusedComponent?.();
625
+ let editorFocus:
626
+ | {
627
+ component: Component;
628
+ factory: ReturnType<ExtensionUIContext["getEditorComponent"]>;
629
+ }
630
+ | undefined;
616
631
  let activeIndex = 0;
617
632
  let list: SettingsList;
618
633
  const createList = () => {
@@ -621,6 +636,16 @@ export async function showOneUiPanel(
621
636
  10,
622
637
  getSettingsListTheme(),
623
638
  (id, value) => {
639
+ const updatesEditor =
640
+ id === "editorStyle" || id === "editorBorderColorMode";
641
+ if (updatesEditor && originalFocus !== undefined) {
642
+ // Suspend automatic overlay focus restoration while Pi may replace
643
+ // and roll back an editor, keeping the final instance observable.
644
+ panelHandle?.unfocus?.({
645
+ target: editorFocus?.component ?? originalFocus,
646
+ });
647
+ }
648
+ const previousFocus = focusTui.getFocusedComponent?.();
624
649
  try {
625
650
  updateSetting(id, value, ctx, deps);
626
651
  list.updateValue(id, value);
@@ -629,13 +654,50 @@ export async function showOneUiPanel(
629
654
  createList();
630
655
  list.selectItem(id);
631
656
  } finally {
632
- if (id === "editorStyle") {
657
+ if (updatesEditor) {
658
+ // Replacements (including rollback) focus the new instance, but the
659
+ // overlay still retains its old preFocus. Capture before refocusing.
660
+ const nextFocus = focusTui.getFocusedComponent?.();
661
+ if (
662
+ nextFocus &&
663
+ nextFocus !== previousFocus &&
664
+ !focusTui.isOverlayFocused?.()
665
+ ) {
666
+ try {
667
+ editorFocus = {
668
+ component: nextFocus,
669
+ factory: ctx.ui.getEditorComponent(),
670
+ };
671
+ } catch {
672
+ editorFocus = undefined;
673
+ }
674
+ }
633
675
  panelHandle?.focus();
634
676
  }
635
677
  tui.requestRender();
636
678
  }
637
679
  },
638
- () => done(undefined),
680
+ () => {
681
+ done(undefined);
682
+ // Only correct this panel's stale return target; other overlays and
683
+ // later editor owners keep their focus. Stale session contexts may throw.
684
+ if (
685
+ !editorFocus ||
686
+ tui.hasOverlay() ||
687
+ focusTui.getFocusedComponent?.() !== originalFocus
688
+ ) {
689
+ return;
690
+ }
691
+ try {
692
+ if (ctx.ui.getEditorComponent() !== editorFocus.factory) {
693
+ return;
694
+ }
695
+ } catch {
696
+ return;
697
+ }
698
+ tui.setFocus(editorFocus.component);
699
+ tui.requestRender();
700
+ },
639
701
  );
640
702
  };
641
703
  createList();
@@ -696,7 +758,7 @@ export async function showOneUiPanel(
696
758
  maxHeight: panelOverlay.maxHeight,
697
759
  margin: panelOverlay.margin,
698
760
  },
699
- onHandle: (handle: { focus: () => void }) => {
761
+ onHandle: (handle: OverlayHandle) => {
700
762
  panelHandle = handle;
701
763
  },
702
764
  },
@@ -262,6 +262,9 @@ function renderBottomRight(
262
262
  uiTheme: Theme,
263
263
  config: ZentuiConfig,
264
264
  ): string {
265
+ if (config.components.editor.styles.minimalist.showCwd === false) {
266
+ return "";
267
+ }
265
268
  const cwd = sanitizeEditorMetadataText(minimalistCwdLabel(metadata, config));
266
269
  return cwd
267
270
  ? renderSourceColor(uiTheme, config.colors.cwd, "cwd", "bold cyan", cwd)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-one-ui",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "A single, customizable Pi UI package with layout-oriented Context and Shell rendering for Pi.",
5
5
  "type": "module",
6
6
  "license": "MIT",