pi-one-ui 0.7.2 → 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 +28 -1
  2. package/README.en.md +5 -8
  3. package/README.md +6 -7
  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 +9 -9
  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 +8 -8
  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
@@ -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
 
@@ -103,7 +103,7 @@ function joinStyled(parts: string[], separator: string): string {
103
103
  }
104
104
 
105
105
  function thinkingStyle(
106
- config: ZentuiConfig,
106
+ config: PolishedTuiConfig,
107
107
  level: string,
108
108
  ): string | undefined {
109
109
  switch (level.toLowerCase()) {
@@ -134,7 +134,7 @@ function renderTopLeft(
134
134
  inputText: string,
135
135
  metadata: MinimalistEditorMetadata,
136
136
  uiTheme: Theme,
137
- config: ZentuiConfig,
137
+ config: PolishedTuiConfig,
138
138
  includeSessionName = true,
139
139
  ): string {
140
140
  const trimmed = inputText.trimStart();
@@ -184,7 +184,7 @@ function renderTopLeft(
184
184
  function renderTopRight(
185
185
  metadata: MinimalistEditorMetadata,
186
186
  uiTheme: Theme,
187
- config: ZentuiConfig,
187
+ config: PolishedTuiConfig,
188
188
  renderBorder: (text: string) => string,
189
189
  renderThinking: (text: string) => string,
190
190
  ): string {
@@ -223,7 +223,7 @@ function renderTopRight(
223
223
  function renderBottomLeft(
224
224
  metadata: MinimalistEditorMetadata,
225
225
  uiTheme: Theme,
226
- config: ZentuiConfig,
226
+ config: PolishedTuiConfig,
227
227
  ): string {
228
228
  if (!config.components.editor.styles.minimalist.showGit) return "";
229
229
  const branch = sanitizeEditorMetadataText(metadata.branch ?? "");
@@ -251,7 +251,7 @@ function renderBottomLeft(
251
251
 
252
252
  function minimalistCwdLabel(
253
253
  metadata: MinimalistEditorMetadata,
254
- config: ZentuiConfig,
254
+ config: PolishedTuiConfig,
255
255
  ): string {
256
256
  const full = () =>
257
257
  formatCwdLabel(metadata.cwd, "", { mode: "full", depth: 0 });
@@ -276,7 +276,7 @@ function minimalistCwdLabel(
276
276
  function renderBottomRight(
277
277
  metadata: MinimalistEditorMetadata,
278
278
  uiTheme: Theme,
279
- config: ZentuiConfig,
279
+ config: PolishedTuiConfig,
280
280
  ): string {
281
281
  if (config.components.editor.styles.minimalist.showCwd === false) {
282
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: [],
@@ -1,6 +1,9 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
3
- import type { SeparatorStyle, ZentuiConfig } from "../../app/config/shell.ts";
3
+ import type {
4
+ PolishedTuiConfig,
5
+ SeparatorStyle,
6
+ } from "../../app/config/shell.ts";
4
7
  import { FOOTER_FORMAT_ALIASES } from "../../app/config/shell.ts";
5
8
  import type { LiveContextOverride } from "../../services/live-context.ts";
6
9
  import {
@@ -228,7 +231,7 @@ function composeFooterContent(
228
231
  export function installFooter(
229
232
  ctx: ExtensionContext,
230
233
  state: FooterState,
231
- getConfig: () => ZentuiConfig,
234
+ getConfig: () => PolishedTuiConfig,
232
235
  hooks: {
233
236
  setRequestRender: (fn: ((force: boolean) => void) | undefined) => void;
234
237
  scheduleProjectRefresh: (ctx: ExtensionContext) => void;
@@ -3,7 +3,7 @@ import {
3
3
  SettingsSelectorComponent,
4
4
  type Theme,
5
5
  } from "@earendil-works/pi-coding-agent";
6
- import type { ZentuiConfig } from "../../app/config/shell.ts";
6
+ import type { PolishedTuiConfig } from "../../app/config/shell.ts";
7
7
  import {
8
8
  installPrototypePatch,
9
9
  removePrototypePatch,
@@ -31,7 +31,7 @@ function isHorizontalBorderLine(line: string): boolean {
31
31
  function renderBorderLine(
32
32
  width: number,
33
33
  theme: Theme | undefined,
34
- config: ZentuiConfig | undefined,
34
+ config: PolishedTuiConfig | undefined,
35
35
  ): string {
36
36
  const text = "─".repeat(Math.max(1, width));
37
37
  if (theme && config) {
@@ -49,7 +49,7 @@ function renderBorderLine(
49
49
  export function patchSelectorBorderStyle(
50
50
  prototype: PatchableSelectorPrototype,
51
51
  getTheme?: () => Theme | undefined,
52
- getConfig?: () => ZentuiConfig,
52
+ getConfig?: () => PolishedTuiConfig,
53
53
  ): Cleanup {
54
54
  return installPrototypePatch(
55
55
  prototype,
@@ -85,7 +85,7 @@ export function removeSelectorBorderStyle(): void {
85
85
 
86
86
  export function installSelectorBorderStyle(
87
87
  getTheme?: () => Theme | undefined,
88
- getConfig?: () => ZentuiConfig,
88
+ getConfig?: () => PolishedTuiConfig,
89
89
  ): Cleanup {
90
90
  const cleanupModel = patchSelectorBorderStyle(
91
91
  ModelSelectorComponent.prototype as unknown as PatchableSelectorPrototype,
@@ -48,7 +48,7 @@ export class SelectorController {
48
48
  const config = this.context.getConfig();
49
49
  const enabled =
50
50
  config.components.selectorBorders.enabled &&
51
- config.components.selectorBorders.style === "zentui" &&
51
+ config.components.selectorBorders.style === "one-ui" &&
52
52
  !hasUnsupportedComponentStyle(config, "selectorBorders");
53
53
  if (enabled) this.install();
54
54
  else this.uninstall();
@@ -65,8 +65,8 @@ export function renderEditorSettingsPreview(
65
65
  viewport,
66
66
  inputText: EDITOR_PREVIEW_INPUT,
67
67
  metadata: {
68
- cwd: "/workspace/zentui/src",
69
- projectRoot: "/workspace/zentui",
68
+ cwd: "/workspace/sample-app/src",
69
+ projectRoot: "/workspace/sample-app",
70
70
  branch: "feat/settings-previews",
71
71
  dirty: true,
72
72
  ahead: 2,
@@ -9,7 +9,9 @@ import { formatCount, formatElapsedDuration } from "../../shared/format.ts";
9
9
  import { isSafeSgrStylePrefix } from "../../shared/style.ts";
10
10
  import { renderWorkingLineHigh } from "./working-line.ts";
11
11
 
12
- export const TURN_SUMMARY_ENTRY_TYPE = "zentui-turn-summary";
12
+ export const TURN_SUMMARY_ENTRY_TYPE = "one-ui-turn-summary";
13
+ /** 历史 session 里的轮次摘要条目类型,仅用于读取。 */
14
+ export const LEGACY_TURN_SUMMARY_ENTRY_TYPE = "zentui-turn-summary";
13
15
  export const MIN_OUTPUT_RATE_WINDOW_MS = 500;
14
16
  const TURN_SUMMARY_VERSION = 3;
15
17
  const SGR_RESET = "\x1b[0m";