pi-one-ui 0.7.1 → 0.8.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 (43) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/README.en.md +5 -8
  3. package/README.md +7 -8
  4. package/extensions/app/config/footer.ts +21 -5
  5. package/extensions/app/config/renderer.ts +1 -1
  6. package/extensions/app/config/shell.ts +62 -60
  7. package/extensions/app/runtime/prototype-patch-registry.ts +13 -9
  8. package/extensions/app/runtime/tui-runtime.ts +19 -12
  9. package/extensions/app/settings/controller.ts +2 -2
  10. package/extensions/layouts/context/index.ts +2 -2
  11. package/extensions/layouts/context/message/user-message-osc.ts +1 -1
  12. package/extensions/layouts/context/message/user-message-styles.ts +9 -6
  13. package/extensions/layouts/context/message/user-message.ts +5 -5
  14. package/extensions/layouts/context/renderer/compact-mode.ts +2 -2
  15. package/extensions/layouts/context/renderer/default-mode.ts +10 -10
  16. package/extensions/layouts/context/renderer/index.ts +0 -1
  17. package/extensions/layouts/context/renderer/mouse/interaction.ts +5 -5
  18. package/extensions/layouts/context/renderer/mouse/scroll.ts +4 -4
  19. package/extensions/layouts/context/renderer/tool/diff/diff-edit-render.ts +1 -1
  20. package/extensions/layouts/context/renderer/tool/diff/index.ts +1 -1
  21. package/extensions/layouts/context/renderer/tool/grouping.ts +3 -3
  22. package/extensions/layouts/context/renderer/tool/message-display.ts +7 -7
  23. package/extensions/layouts/context/renderer/tool/result.ts +16 -16
  24. package/extensions/layouts/context/renderer/tool/toggle-render-cache.ts +33 -8
  25. package/extensions/layouts/editor/controller.ts +17 -17
  26. package/extensions/layouts/editor/editor-metadata-format.ts +5 -5
  27. package/extensions/layouts/editor/factory.ts +5 -5
  28. package/extensions/layouts/editor/minimalist-editor.ts +25 -9
  29. package/extensions/layouts/editor/ownership.ts +24 -20
  30. package/extensions/layouts/editor/ui.ts +10 -15
  31. package/extensions/layouts/footer/controller.ts +4 -4
  32. package/extensions/layouts/footer/data.ts +2 -2
  33. package/extensions/layouts/footer/extension-status.ts +4 -4
  34. package/extensions/layouts/footer/footer.ts +5 -2
  35. package/extensions/layouts/overlay/selector-border.ts +4 -4
  36. package/extensions/layouts/overlay/selector-controller.ts +1 -1
  37. package/extensions/layouts/overlay/settings-previews.ts +2 -2
  38. package/extensions/layouts/working-line/interaction-summary.ts +3 -1
  39. package/extensions/layouts/working-line/working-line.ts +4 -4
  40. package/extensions/services/package-data.ts +1 -1
  41. package/extensions/shared/style.ts +66 -56
  42. package/extensions/tools/patch-keys.ts +23 -23
  43. package/package.json +7 -7
@@ -35,7 +35,7 @@ type RenderSlot = {
35
35
  shell: "box" | "self" | "text" | null;
36
36
  callComponent: unknown;
37
37
  resultComponent: unknown;
38
- /** rendererState 中 ccstyle 渲染层的指针快照(切槽重装时恢复)。 */
38
+ /** rendererState 中 pi-one-ui 渲染层的指针快照(切槽重装时恢复)。 */
39
39
  stateSnapshot: [unknown, unknown, unknown];
40
40
  };
41
41
 
@@ -80,6 +80,25 @@ function fingerprintOf(
80
80
  ];
81
81
  }
82
82
 
83
+ /**
84
+ * 工具行是否处于「loading 图标动画应当持续」的状态。
85
+ *
86
+ * 与 default-mode renderCall 中 `scheduleAnimation` 的条件保持一致
87
+ * (本函数必须是其超集):动画 tick 经 ctx.invalidate → updateDisplay
88
+ * 回到渲染路径,缓存命中若跳过重建,renderCall 不会再执行,共享 timer
89
+ * 不再排期,长命令期间 loading 图标就会冻结在当前帧。
90
+ */
91
+ function schedulesPendingAnimation(component: any): boolean {
92
+ const visualState = component?.rendererState?.oneuiToolVisualState as
93
+ | string
94
+ | undefined;
95
+ const pending =
96
+ visualState === "pending" ||
97
+ (!visualState &&
98
+ (component.isPartial === true || component.executionStarted === true));
99
+ return Boolean(pending && component.executionStarted === true);
100
+ }
101
+
83
102
  function componentsOf(component: any): [unknown, unknown] {
84
103
  return [component.callRendererComponent, component.resultRendererComponent];
85
104
  }
@@ -147,9 +166,9 @@ function syncShell(component: any, shell: "box" | "self" | "text"): void {
147
166
  function stateSnapshotOf(component: any): [unknown, unknown, unknown] {
148
167
  const state = component?.rendererState;
149
168
  return [
150
- state?.ccstyleIoView,
151
- state?.ccstyleExpandedIoView,
152
- state?.ccstyleToolVisualState,
169
+ state?.oneuiIoView,
170
+ state?.oneuiExpandedIoView,
171
+ state?.oneuiToolVisualState,
153
172
  ];
154
173
  }
155
174
 
@@ -167,14 +186,14 @@ function restoreStateSnapshot(
167
186
  const state = (component.rendererState ??= {});
168
187
  // ioView/visualState 每槽构建时都会写入,按槽恢复;
169
188
  // expandedIoView 是跨槽保留指针(折叠 renderer 不清),只在展开槽恢复。
170
- state.ccstyleIoView = snapshot[0];
171
- state.ccstyleToolVisualState = snapshot[1];
172
- if (slotKey === "expanded") state.ccstyleExpandedIoView = snapshot[2];
189
+ state.oneuiIoView = snapshot[0];
190
+ state.oneuiToolVisualState = snapshot[1];
191
+ if (slotKey === "expanded") state.oneuiExpandedIoView = snapshot[2];
173
192
  }
174
193
 
175
194
  /**
176
195
  * 把缓存槽的 call/result 组件装回目标壳容器并恢复派生字段。
177
- * 同时恢复 ccstyle 渲染层的 rendererState 指针快照(ioView / expandedIoView /
196
+ * 同时恢复 pi-one-ui 渲染层的 rendererState 指针快照(ioView / expandedIoView /
178
197
  * visualState),补齐切槽跳过 renderer 调用导致的状态缺失;pending 展开时
179
198
  * 重新调度加载动画。text fallback 槽(无容器装载语义)返回 false,调用方
180
199
  * 退化为重建。
@@ -291,6 +310,12 @@ export function installToggleRenderCache(): ToggleRenderCacheHooks {
291
310
  if (inputsMatch && entry) {
292
311
  if (entry.current === slotKey) {
293
312
  if (sameComponents(slot.components, componentsNow)) {
313
+ // pending 行必须重建:renderCall 既刷新 loading 图标帧,也给共享
314
+ // 动画 timer 续期;指纹未变时跳过重建会中断动画循环。
315
+ if (schedulesPendingAnimation(self)) {
316
+ rebuild();
317
+ return;
318
+ }
294
319
  // 容器内容仍是该槽,无重建必要;仅恢复可能被外部改写的派生字段。
295
320
  self.hideComponent = slot.hideComponent;
296
321
  return;
@@ -20,9 +20,9 @@ import {
20
20
  } from "./factory.ts";
21
21
  import {
22
22
  type EditorFactory,
23
- getZentuiEditorBaseFactory,
23
+ getPolishedEditorBaseFactory,
24
24
  isOwnedEditorFactory,
25
- isZentuiEditorFactory,
25
+ isPolishedEditorFactory,
26
26
  } from "./ownership.ts";
27
27
 
28
28
  export type EditorChangeResult = { ok: true } | { ok: false; reason: string };
@@ -72,18 +72,18 @@ export class EditorLayoutController {
72
72
  * Installs or reconciles the configured Editor for an active session.
73
73
  *
74
74
  * @param ctx Active Pi extension context.
75
- * @param allowStaleZentui Whether a stale predecessor may be replaced.
75
+ * @param allowStalePolished Whether a stale predecessor may be replaced.
76
76
  * @returns The replacement result when a host factory changed.
77
77
  */
78
78
  install(
79
79
  ctx: ExtensionContext,
80
- allowStaleZentui = true,
80
+ allowStalePolished = true,
81
81
  ): EditorChangeResult | undefined {
82
82
  if (!this.isTuiContext(ctx)) return;
83
83
  this.activeTuiContext = ctx;
84
84
  if (this.isEditorEnabled()) this.clearEditorOwnership();
85
- else this.uninstall(ctx, { allowStaleZentui });
86
- const result = this.reconcile(ctx, { allowStaleZentui });
85
+ else this.uninstall(ctx, { allowStalePolished });
86
+ const result = this.reconcile(ctx, { allowStalePolished });
87
87
  this.scheduleReconciliation(ctx);
88
88
  return result;
89
89
  }
@@ -97,15 +97,15 @@ export class EditorLayoutController {
97
97
  */
98
98
  reconcile(
99
99
  ctx: ExtensionContext,
100
- options: { allowStaleZentui?: boolean } = {},
100
+ options: { allowStalePolished?: boolean } = {},
101
101
  ): EditorChangeResult | undefined {
102
102
  try {
103
103
  if (this.isEditorEnabled()) {
104
104
  const currentFactory = ctx.ui.getEditorComponent();
105
105
  if (
106
- isZentuiEditorFactory(currentFactory) &&
106
+ isPolishedEditorFactory(currentFactory) &&
107
107
  !this.ownsFactory(currentFactory) &&
108
- !options.allowStaleZentui
108
+ !options.allowStalePolished
109
109
  ) {
110
110
  this.clearEditorOwnership();
111
111
  return;
@@ -254,7 +254,7 @@ export class EditorLayoutController {
254
254
  */
255
255
  uninstall(
256
256
  ctx: ExtensionContext,
257
- options: { allowStaleZentui?: boolean } = {},
257
+ options: { allowStalePolished?: boolean } = {},
258
258
  ): EditorChangeResult {
259
259
  let currentFactory: EditorFactory | undefined;
260
260
  try {
@@ -266,17 +266,17 @@ export class EditorLayoutController {
266
266
  "the current editor factory could not be observed safely; reload Pi to apply this change",
267
267
  };
268
268
  }
269
- if (!currentFactory || !isZentuiEditorFactory(currentFactory)) {
269
+ if (!currentFactory || !isPolishedEditorFactory(currentFactory)) {
270
270
  this.clearEditorOwnership();
271
271
  return { ok: true };
272
272
  }
273
- if (!this.ownsFactory(currentFactory) && !options.allowStaleZentui) {
273
+ if (!this.ownsFactory(currentFactory) && !options.allowStalePolished) {
274
274
  this.clearEditorOwnership();
275
275
  return { ok: true };
276
276
  }
277
277
  const result = this.replace(
278
278
  ctx,
279
- getZentuiEditorBaseFactory(currentFactory) ??
279
+ getPolishedEditorBaseFactory(currentFactory) ??
280
280
  (this.editorInstallMode === "wrapper"
281
281
  ? this.wrappedEditorFactory
282
282
  : undefined),
@@ -299,7 +299,7 @@ export class EditorLayoutController {
299
299
  if (currentFactory && this.ownsFactory(currentFactory)) {
300
300
  this.replace(
301
301
  ctx,
302
- getZentuiEditorBaseFactory(currentFactory) ??
302
+ getPolishedEditorBaseFactory(currentFactory) ??
303
303
  (this.editorInstallMode === "wrapper"
304
304
  ? this.wrappedEditorFactory
305
305
  : undefined),
@@ -395,7 +395,7 @@ export class EditorLayoutController {
395
395
  * @param factory Factory created by this controller.
396
396
  */
397
397
  private trackFactory(factory: EditorFactory): void {
398
- const baseFactory = getZentuiEditorBaseFactory(factory);
398
+ const baseFactory = getPolishedEditorBaseFactory(factory);
399
399
  this.wrappedEditorFactory = baseFactory;
400
400
  this.installedEditorFactory = factory;
401
401
  this.editorInstallMode = baseFactory ? "wrapper" : "standalone";
@@ -444,8 +444,8 @@ export class EditorLayoutController {
444
444
  return { ok: true };
445
445
  }
446
446
  const baseFactory =
447
- getZentuiEditorBaseFactory(currentFactory) ??
448
- (currentFactory && !isZentuiEditorFactory(currentFactory)
447
+ getPolishedEditorBaseFactory(currentFactory) ??
448
+ (currentFactory && !isPolishedEditorFactory(currentFactory)
449
449
  ? currentFactory
450
450
  : undefined);
451
451
  const runtime = this.factoryRuntime(ctx);
@@ -1,5 +1,5 @@
1
1
  import type { Theme } from "@earendil-works/pi-coding-agent";
2
- import type { ZentuiConfig } from "../../app/config/shell.ts";
2
+ import type { PolishedTuiConfig } from "../../app/config/shell.ts";
3
3
  import {
4
4
  EDITOR_ACCENT_FALLBACK,
5
5
  renderThemeStyleOrFallback,
@@ -140,7 +140,7 @@ export function sanitizeEditorMetadataText(value: string): string {
140
140
  }
141
141
 
142
142
  function editorThinkingStyle(
143
- config: ZentuiConfig,
143
+ config: PolishedTuiConfig,
144
144
  level: string,
145
145
  ): string | undefined {
146
146
  switch (level.toLowerCase()) {
@@ -171,7 +171,7 @@ function renderVariable(
171
171
  name: string,
172
172
  values: EditorMetadataValues,
173
173
  uiTheme: Theme,
174
- config: ZentuiConfig,
174
+ config: PolishedTuiConfig,
175
175
  ): { plain: string; styled: string } {
176
176
  const thinking =
177
177
  values.thinking.toLowerCase() === "off" ? "" : values.thinking;
@@ -235,7 +235,7 @@ function renderTokens(
235
235
  tokens: FormatToken[],
236
236
  values: EditorMetadataValues,
237
237
  uiTheme: Theme,
238
- config: ZentuiConfig,
238
+ config: PolishedTuiConfig,
239
239
  ): RenderedTokens {
240
240
  let styled = "";
241
241
  let hasDynamic = false;
@@ -275,7 +275,7 @@ export function renderEditorMetadataFormat(
275
275
  format: string,
276
276
  values: EditorMetadataValues,
277
277
  uiTheme: Theme,
278
- config: ZentuiConfig,
278
+ config: PolishedTuiConfig,
279
279
  ): string {
280
280
  return renderTokens(
281
281
  parseFooterFormat(sanitizeEditorMetadataText(format)),
@@ -11,7 +11,7 @@ import {
11
11
  type EditorFactory,
12
12
  markEditorFactory,
13
13
  markWrappedEditorFactory,
14
- type ZentuiEditorFactory,
14
+ type PolishedEditorFactory,
15
15
  } from "./ownership.ts";
16
16
  import { PolishedEditor, WrappedPolishedEditor } from "./ui.ts";
17
17
 
@@ -38,7 +38,7 @@ export type EditorFactoryRuntime = {
38
38
  export function createEditorFactory(
39
39
  ctx: ExtensionContext,
40
40
  runtime: EditorFactoryRuntime,
41
- ): ZentuiEditorFactory {
41
+ ): PolishedEditorFactory {
42
42
  const factory = ((
43
43
  tui: TUI,
44
44
  theme: EditorTheme,
@@ -56,7 +56,7 @@ export function createEditorFactory(
56
56
  () => editorDecoration(ctx, runtime),
57
57
  runtime.onDecorationActive,
58
58
  );
59
- }) as ZentuiEditorFactory;
59
+ }) as PolishedEditorFactory;
60
60
  return markEditorFactory(factory, runtime.ownerToken);
61
61
  }
62
62
 
@@ -72,7 +72,7 @@ export function createWrappedEditorFactory(
72
72
  ctx: ExtensionContext,
73
73
  baseFactory: EditorFactory,
74
74
  runtime: EditorFactoryRuntime,
75
- ): ZentuiEditorFactory {
75
+ ): PolishedEditorFactory {
76
76
  const factory = ((
77
77
  tui: TUI,
78
78
  theme: EditorTheme,
@@ -88,7 +88,7 @@ export function createWrappedEditorFactory(
88
88
  () => editorDecoration(ctx, runtime),
89
89
  runtime.onDecorationActive,
90
90
  );
91
- }) as ZentuiEditorFactory;
91
+ }) as PolishedEditorFactory;
92
92
  return markWrappedEditorFactory(factory, baseFactory, runtime.ownerToken);
93
93
  }
94
94
 
@@ -1,7 +1,7 @@
1
1
  import { basename, isAbsolute, relative, sep } from "node:path";
2
2
  import type { Theme } from "@earendil-works/pi-coding-agent";
3
3
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
4
- import type { ColorSpec, ZentuiConfig } from "../../app/config/shell.ts";
4
+ import type { ColorSpec, PolishedTuiConfig } from "../../app/config/shell.ts";
5
5
  import { formatCwdLabel, formatElapsedDuration } from "../../shared/format.ts";
6
6
  import { sanitizeEditorMetadataText } from "./editor-metadata-format.ts";
7
7
 
@@ -46,7 +46,7 @@ export type MinimalistFrameOptions = {
46
46
  inputText: string;
47
47
  metadata: MinimalistEditorMetadata;
48
48
  uiTheme: Theme;
49
- config: ZentuiConfig;
49
+ config: PolishedTuiConfig;
50
50
  borderColor?: (text: string) => string;
51
51
  };
52
52
 
@@ -59,6 +59,22 @@ function clampLines(lines: string[], width: number): string[] {
59
59
  return lines.map((line) => truncateToWidth(line, Math.max(0, width), ""));
60
60
  }
61
61
 
62
+ /** 原生 SelectList 选中行的 `→ ` 标记;前置 SGR 是 Pi 的 selectedText 颜色。 */
63
+ const NATIVE_SELECTED_AUTOCOMPLETE_ROW = /^((?:(?:\x1b\[|\u009b)[0-9:;]*m)*)→ /;
64
+
65
+ /**
66
+ * 用帧边框色重绘原生下拉选中行:去掉 Pi 的 selectedText 颜色序列,
67
+ * 使选中项与编辑器外框共用同一条 static/adaptive 颜色链。
68
+ */
69
+ function renderSelectedAutocompleteRow(
70
+ line: string,
71
+ renderBorder: (text: string) => string,
72
+ ): string {
73
+ const match = NATIVE_SELECTED_AUTOCOMPLETE_ROW.exec(line);
74
+ if (!match) return line;
75
+ return renderBorder(line.slice((match[1] ?? "").length));
76
+ }
77
+
62
78
  export function renderFramedAutocompleteRows({
63
79
  width,
64
80
  lines,
@@ -75,7 +91,7 @@ export function renderFramedAutocompleteRows({
75
91
  `${renderBorder("├")}${renderBorder("─".repeat(width - 2))}${renderBorder("┤")}`,
76
92
  ...lines.map(
77
93
  (line) =>
78
- `${renderBorder("│")} ${fillLine(line, contentWidth)} ${renderBorder("│")}`,
94
+ `${renderBorder("│")} ${fillLine(renderSelectedAutocompleteRow(line, renderBorder), contentWidth)} ${renderBorder("│")}`,
79
95
  ),
80
96
  ],
81
97
  width,
@@ -87,7 +103,7 @@ function joinStyled(parts: string[], separator: string): string {
87
103
  }
88
104
 
89
105
  function thinkingStyle(
90
- config: ZentuiConfig,
106
+ config: PolishedTuiConfig,
91
107
  level: string,
92
108
  ): string | undefined {
93
109
  switch (level.toLowerCase()) {
@@ -118,7 +134,7 @@ function renderTopLeft(
118
134
  inputText: string,
119
135
  metadata: MinimalistEditorMetadata,
120
136
  uiTheme: Theme,
121
- config: ZentuiConfig,
137
+ config: PolishedTuiConfig,
122
138
  includeSessionName = true,
123
139
  ): string {
124
140
  const trimmed = inputText.trimStart();
@@ -168,7 +184,7 @@ function renderTopLeft(
168
184
  function renderTopRight(
169
185
  metadata: MinimalistEditorMetadata,
170
186
  uiTheme: Theme,
171
- config: ZentuiConfig,
187
+ config: PolishedTuiConfig,
172
188
  renderBorder: (text: string) => string,
173
189
  renderThinking: (text: string) => string,
174
190
  ): string {
@@ -207,7 +223,7 @@ function renderTopRight(
207
223
  function renderBottomLeft(
208
224
  metadata: MinimalistEditorMetadata,
209
225
  uiTheme: Theme,
210
- config: ZentuiConfig,
226
+ config: PolishedTuiConfig,
211
227
  ): string {
212
228
  if (!config.components.editor.styles.minimalist.showGit) return "";
213
229
  const branch = sanitizeEditorMetadataText(metadata.branch ?? "");
@@ -235,7 +251,7 @@ function renderBottomLeft(
235
251
 
236
252
  function minimalistCwdLabel(
237
253
  metadata: MinimalistEditorMetadata,
238
- config: ZentuiConfig,
254
+ config: PolishedTuiConfig,
239
255
  ): string {
240
256
  const full = () =>
241
257
  formatCwdLabel(metadata.cwd, "", { mode: "full", depth: 0 });
@@ -260,7 +276,7 @@ function minimalistCwdLabel(
260
276
  function renderBottomRight(
261
277
  metadata: MinimalistEditorMetadata,
262
278
  uiTheme: Theme,
263
- config: ZentuiConfig,
279
+ config: PolishedTuiConfig,
264
280
  ): string {
265
281
  if (config.components.editor.styles.minimalist.showCwd === false) {
266
282
  return "";
@@ -1,24 +1,28 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
 
3
- /** Symbol used to identify factories created by the Editor layout. */
4
- export const ZENTUI_EDITOR_FACTORY = Symbol.for("pi-zentui.editor-factory");
3
+ /**
4
+ * Symbol used to identify factories created by the Editor layout. All wrappers
5
+ * and marks live in one process, so the key only has to be stable across
6
+ * `/reload` within that process.
7
+ */
8
+ export const POLISHED_EDITOR_FACTORY = Symbol.for("pi-one-ui.editor-factory");
5
9
 
6
10
  /** Symbol used to retain the wrapped third-party editor factory. */
7
- export const ZENTUI_EDITOR_BASE_FACTORY = Symbol.for(
8
- "pi-zentui.editor-base-factory",
11
+ export const POLISHED_EDITOR_BASE_FACTORY = Symbol.for(
12
+ "pi-one-ui.editor-base-factory",
9
13
  );
10
14
 
11
15
  /** Symbol used to identify the active Editor layout owner. */
12
- export const ZENTUI_EDITOR_OWNER = Symbol.for("pi-zentui.editor-owner");
16
+ export const POLISHED_EDITOR_OWNER = Symbol.for("pi-one-ui.editor-owner");
13
17
 
14
18
  export type EditorFactory = NonNullable<
15
19
  Parameters<ExtensionContext["ui"]["setEditorComponent"]>[0]
16
20
  >;
17
21
 
18
- export type ZentuiEditorFactory = EditorFactory & {
19
- [ZENTUI_EDITOR_FACTORY]?: true;
20
- [ZENTUI_EDITOR_BASE_FACTORY]?: EditorFactory;
21
- [ZENTUI_EDITOR_OWNER]?: symbol;
22
+ export type PolishedEditorFactory = EditorFactory & {
23
+ [POLISHED_EDITOR_FACTORY]?: true;
24
+ [POLISHED_EDITOR_BASE_FACTORY]?: EditorFactory;
25
+ [POLISHED_EDITOR_OWNER]?: symbol;
22
26
  };
23
27
 
24
28
  /**
@@ -27,11 +31,11 @@ export type ZentuiEditorFactory = EditorFactory & {
27
31
  * @param factory Candidate host editor factory.
28
32
  * @returns Whether the factory carries the Editor layout marker.
29
33
  */
30
- export function isZentuiEditorFactory(
34
+ export function isPolishedEditorFactory(
31
35
  factory: EditorFactory | undefined,
32
36
  ): boolean {
33
37
  return Boolean(
34
- (factory as ZentuiEditorFactory | undefined)?.[ZENTUI_EDITOR_FACTORY],
38
+ (factory as PolishedEditorFactory | undefined)?.[POLISHED_EDITOR_FACTORY],
35
39
  );
36
40
  }
37
41
 
@@ -41,11 +45,11 @@ export function isZentuiEditorFactory(
41
45
  * @param factory Candidate host editor factory.
42
46
  * @returns The retained base factory, when present.
43
47
  */
44
- export function getZentuiEditorBaseFactory(
48
+ export function getPolishedEditorBaseFactory(
45
49
  factory: EditorFactory | undefined,
46
50
  ): EditorFactory | undefined {
47
- return (factory as ZentuiEditorFactory | undefined)?.[
48
- ZENTUI_EDITOR_BASE_FACTORY
51
+ return (factory as PolishedEditorFactory | undefined)?.[
52
+ POLISHED_EDITOR_BASE_FACTORY
49
53
  ];
50
54
  }
51
55
 
@@ -61,7 +65,7 @@ export function isOwnedEditorFactory(
61
65
  ownerToken: symbol,
62
66
  ): boolean {
63
67
  return (
64
- (factory as ZentuiEditorFactory | undefined)?.[ZENTUI_EDITOR_OWNER] ===
68
+ (factory as PolishedEditorFactory | undefined)?.[POLISHED_EDITOR_OWNER] ===
65
69
  ownerToken
66
70
  );
67
71
  }
@@ -77,9 +81,9 @@ export function markEditorFactory<T extends EditorFactory>(
77
81
  factory: T,
78
82
  ownerToken: symbol,
79
83
  ): T {
80
- const marked = factory as T & ZentuiEditorFactory;
81
- marked[ZENTUI_EDITOR_FACTORY] = true;
82
- marked[ZENTUI_EDITOR_OWNER] = ownerToken;
84
+ const marked = factory as T & PolishedEditorFactory;
85
+ marked[POLISHED_EDITOR_FACTORY] = true;
86
+ marked[POLISHED_EDITOR_OWNER] = ownerToken;
83
87
  return factory;
84
88
  }
85
89
 
@@ -97,7 +101,7 @@ export function markWrappedEditorFactory<T extends EditorFactory>(
97
101
  ownerToken: symbol,
98
102
  ): T {
99
103
  const marked = markEditorFactory(factory, ownerToken) as T &
100
- ZentuiEditorFactory;
101
- marked[ZENTUI_EDITOR_BASE_FACTORY] = baseFactory;
104
+ PolishedEditorFactory;
105
+ marked[POLISHED_EDITOR_BASE_FACTORY] = baseFactory;
102
106
  return factory;
103
107
  }
@@ -12,7 +12,7 @@ import {
12
12
  truncateToWidth,
13
13
  visibleWidth,
14
14
  } from "@earendil-works/pi-tui";
15
- import type { ZentuiConfig } from "../../app/config/shell.ts";
15
+ import type { PolishedTuiConfig } from "../../app/config/shell.ts";
16
16
  import {
17
17
  EDITOR_ACCENT_FALLBACK,
18
18
  EDITOR_BORDER_FALLBACK,
@@ -25,8 +25,6 @@ import {
25
25
  renderMinimalistFrame,
26
26
  } from "./minimalist-editor.ts";
27
27
 
28
- const LEGACY_SPLIT_POLISHED_FRAME = Symbol.for("pi-zentui.polished-frame");
29
-
30
28
  export type ViewportCounts = {
31
29
  above?: string;
32
30
  below?: string;
@@ -101,7 +99,7 @@ type MinimalistFrameAdapterOptions = {
101
99
  autocompleteSource: AutocompleteEditorInternals;
102
100
  autocompleteCapture?: AutocompleteCapture;
103
101
  uiTheme: Theme;
104
- config: ZentuiConfig;
102
+ config: PolishedTuiConfig;
105
103
  inputText: string;
106
104
  metadata: MinimalistEditorMetadata;
107
105
  ownedFrame?: PolishedFrameSplit;
@@ -293,7 +291,7 @@ export function renderWithAutocompleteCapture<T>(
293
291
  * (保持 Pi 原生 effort/主题变色不动)。
294
292
  */
295
293
  export function offEditorBorderColor(
296
- config: ZentuiConfig,
294
+ config: PolishedTuiConfig,
297
295
  uiTheme: Theme,
298
296
  ): ((text: string) => string) | undefined {
299
297
  const editor = config.components.editor;
@@ -316,7 +314,7 @@ function fillLine(content: string, width: number): string {
316
314
  }
317
315
 
318
316
  function getEditorChromeWidths(
319
- config: ZentuiConfig,
317
+ config: PolishedTuiConfig,
320
318
  uiTheme: Theme,
321
319
  reset: string,
322
320
  ) {
@@ -353,7 +351,7 @@ function parseEditorBorder(
353
351
 
354
352
  function unwrapPolishedFrameOnly(
355
353
  lines: string[],
356
- config: ZentuiConfig,
354
+ config: PolishedTuiConfig,
357
355
  uiTheme: Theme,
358
356
  ): { editorLines: string[]; viewport: ViewportCounts } | undefined {
359
357
  if (lines.length < 5) return undefined;
@@ -379,7 +377,7 @@ function unwrapPolishedFrameOnly(
379
377
 
380
378
  function splitPolishedFrame(
381
379
  lines: string[],
382
- config: ZentuiConfig,
380
+ config: PolishedTuiConfig,
383
381
  uiTheme: Theme,
384
382
  ): PolishedFrameSplit | undefined {
385
383
  if (!parseEditorBorder(lines[0] ?? "", "above")) return undefined;
@@ -397,9 +395,8 @@ function splitPolishedFrame(
397
395
  }
398
396
 
399
397
  function inspectPolishedFrameProvenance(
400
- base: WrappedEditor,
401
398
  rendered: string[],
402
- config: ZentuiConfig,
399
+ config: PolishedTuiConfig,
403
400
  uiTheme: Theme,
404
401
  ): { safe: boolean; ownedFrame?: PolishedFrameSplit } {
405
402
  const provenance = POLISHED_FRAME_SPLITS.get(rendered);
@@ -411,7 +408,6 @@ function inspectPolishedFrameProvenance(
411
408
  const ownedFrame = provenanceMatches ? provenance?.split : undefined;
412
409
  const unsafe =
413
410
  Boolean(provenance && !provenanceMatches) ||
414
- LEGACY_SPLIT_POLISHED_FRAME in base ||
415
411
  (!ownedFrame && Boolean(splitPolishedFrame(rendered, config, uiTheme)));
416
412
  return { safe: !unsafe, ownedFrame };
417
413
  }
@@ -485,7 +481,7 @@ export class PolishedEditor extends CustomEditor {
485
481
  private readonly getThinkingLevel: () => string | undefined;
486
482
  private readonly getMinimalistMetadata: () => MinimalistEditorMetadata;
487
483
  private readonly onMinimalistDecorationChange: (active: boolean) => void;
488
- private readonly getConfig: () => ZentuiConfig;
484
+ private readonly getConfig: () => PolishedTuiConfig;
489
485
  private readonly uiTheme: Theme;
490
486
 
491
487
  constructor(
@@ -493,7 +489,7 @@ export class PolishedEditor extends CustomEditor {
493
489
  theme: EditorTheme,
494
490
  keybindings: KeybindingsManager,
495
491
  uiTheme: Theme,
496
- getConfig: () => ZentuiConfig,
492
+ getConfig: () => PolishedTuiConfig,
497
493
  getModelMeta: () => EditorMeta,
498
494
  getThinkingLevel: () => string | undefined,
499
495
  getMinimalistMetadata: () => MinimalistEditorMetadata = () => ({ cwd: "" }),
@@ -569,7 +565,7 @@ export class WrappedPolishedEditor implements EditorComponent {
569
565
  constructor(
570
566
  private readonly base: WrappedEditor,
571
567
  private readonly uiTheme: Theme,
572
- private readonly getConfig: () => ZentuiConfig,
568
+ private readonly getConfig: () => PolishedTuiConfig,
573
569
  private readonly getModelMeta: () => EditorMeta,
574
570
  private readonly getThinkingLevel: () => string | undefined,
575
571
  private readonly getMinimalistMetadata: () => MinimalistEditorMetadata = () => ({
@@ -702,7 +698,6 @@ export class WrappedPolishedEditor implements EditorComponent {
702
698
  }
703
699
  try {
704
700
  const provenance = inspectPolishedFrameProvenance(
705
- this.base,
706
701
  captured.value,
707
702
  config,
708
703
  this.uiTheme,
@@ -15,7 +15,7 @@ import { buildSessionDurationLabel } from "../../shared/format.ts";
15
15
  import { activeFooterReferences } from "./data.ts";
16
16
  import { installFooter, installHiddenFooter } from "./footer.ts";
17
17
 
18
- const ZENTUI_FOOTER_OWNER = Symbol.for("pi-zentui.footer-owner");
18
+ const POLISHED_FOOTER_OWNER = Symbol.for("pi-one-ui.footer-owner");
19
19
 
20
20
  type FooterKind = "starship" | "hidden";
21
21
 
@@ -244,7 +244,7 @@ export class FooterLayoutController {
244
244
  */
245
245
  private footerOwner(ctx: ExtensionContext): unknown {
246
246
  return (ctx.ui as unknown as Record<PropertyKey, unknown>)[
247
- ZENTUI_FOOTER_OWNER
247
+ POLISHED_FOOTER_OWNER
248
248
  ];
249
249
  }
250
250
 
@@ -270,8 +270,8 @@ export class FooterLayoutController {
270
270
  private setOwnership(ctx: ExtensionContext, token: symbol | undefined): void {
271
271
  const ui = ctx.ui as unknown as Record<PropertyKey, unknown>;
272
272
  try {
273
- if (token) ui[ZENTUI_FOOTER_OWNER] = token;
274
- else delete ui[ZENTUI_FOOTER_OWNER];
273
+ if (token) ui[POLISHED_FOOTER_OWNER] = token;
274
+ else delete ui[POLISHED_FOOTER_OWNER];
275
275
  } catch {
276
276
  // Failure to mark ownership prevents destructive native restoration.
277
277
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FOOTER_FORMAT_ALIASES,
3
- type ZentuiConfig,
3
+ type PolishedTuiConfig,
4
4
  } from "../../app/config/shell.ts";
5
5
  import {
6
6
  collectFooterFormatReferences,
@@ -13,7 +13,7 @@ import {
13
13
  * @param config Current normalized plugin configuration.
14
14
  * @returns Names of project, session, runtime, and clock data dependencies.
15
15
  */
16
- export function activeFooterReferences(config: ZentuiConfig): Set<string> {
16
+ export function activeFooterReferences(config: PolishedTuiConfig): Set<string> {
17
17
  const starship = config.components.footer.styles.starship;
18
18
  const references = starship.format
19
19
  ? collectFooterFormatReferences(
@@ -2,7 +2,7 @@ import { stripVTControlCharacters } from "node:util";
2
2
  import type {
3
3
  ExtensionStatusColorMode,
4
4
  ExtensionStatusPlacement,
5
- ZentuiConfig,
5
+ PolishedTuiConfig,
6
6
  } from "../../app/config/shell.ts";
7
7
  import {
8
8
  getExtensionStatusColorMode,
@@ -24,7 +24,7 @@ export type ExtensionStatusSegmentsByPlacement = {
24
24
  };
25
25
 
26
26
  const safeSgrPattern = /\x1b\[[0-9;:]*m/g;
27
- const sgrPlaceholderPattern = /__ZENTUI_SGR_(\d+)__/g;
27
+ const sgrPlaceholderPattern = /__ONEUI_SGR_(\d+)__/g;
28
28
 
29
29
  function compareKeys(
30
30
  a: ExtensionStatusSegment,
@@ -53,7 +53,7 @@ export function sanitizeExtensionStatusOriginalText(value: string): string {
53
53
  const safeSequences: string[] = [];
54
54
  const protectedValue = value.replace(safeSgrPattern, (sequence) => {
55
55
  const index = safeSequences.push(sequence) - 1;
56
- return `__ZENTUI_SGR_${index}__`;
56
+ return `__ONEUI_SGR_${index}__`;
57
57
  });
58
58
  const cleaned = normalizeStatusWhitespace(
59
59
  stripVTControlCharacters(protectedValue),
@@ -71,7 +71,7 @@ export function sanitizeExtensionStatusOriginalText(value: string): string {
71
71
 
72
72
  export function collectExtensionStatusSegments(
73
73
  statuses: ReadonlyMap<string, string>,
74
- config: ZentuiConfig,
74
+ config: PolishedTuiConfig,
75
75
  ): ExtensionStatusSegmentsByPlacement {
76
76
  const segments: ExtensionStatusSegmentsByPlacement = {
77
77
  left: [],