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
@@ -1,5 +1,9 @@
1
- export const ZENTUI_PROTOTYPE_PATCH_REGISTRY = Symbol.for(
2
- "pi-zentui.prototype-patch-registry",
1
+ /**
2
+ * Global registry slot for prototype patches. The key is only shared by module
3
+ * instances of the same process, so it has to stay stable across `/reload`.
4
+ */
5
+ export const POLISHED_PROTOTYPE_PATCH_REGISTRY = Symbol.for(
6
+ "pi-one-ui.prototype-patch-registry",
3
7
  );
4
8
 
5
9
  type PrototypePatchAdapter =
@@ -35,7 +39,7 @@ type PatchRegistry = Map<PrototypePatchAdapter, PatchRecord>;
35
39
  type PatchTarget = Record<PropertyKey, unknown>;
36
40
 
37
41
  function existingRegistry(target: PatchTarget): PatchRegistry | undefined {
38
- const existing = target[ZENTUI_PROTOTYPE_PATCH_REGISTRY];
42
+ const existing = target[POLISHED_PROTOTYPE_PATCH_REGISTRY];
39
43
  return existing instanceof Map ? (existing as PatchRegistry) : undefined;
40
44
  }
41
45
 
@@ -43,7 +47,7 @@ function registryFor(target: PatchTarget): PatchRegistry {
43
47
  const existing = existingRegistry(target);
44
48
  if (existing) return existing;
45
49
  const registry: PatchRegistry = new Map();
46
- Object.defineProperty(target, ZENTUI_PROTOTYPE_PATCH_REGISTRY, {
50
+ Object.defineProperty(target, POLISHED_PROTOTYPE_PATCH_REGISTRY, {
47
51
  value: registry,
48
52
  configurable: true,
49
53
  });
@@ -100,7 +104,7 @@ function createCleanup(
100
104
  if (current !== record) return;
101
105
  restorePredecessor(target, record);
102
106
  registry.delete(adapter);
103
- if (registry.size === 0) delete target[ZENTUI_PROTOTYPE_PATCH_REGISTRY];
107
+ if (registry.size === 0) delete target[POLISHED_PROTOTYPE_PATCH_REGISTRY];
104
108
  };
105
109
  }
106
110
 
@@ -124,7 +128,7 @@ export function installPrototypePatch(
124
128
  );
125
129
  const predecessor = target[method];
126
130
  if (typeof predecessor !== "function") {
127
- if (registry.size === 0) delete target[ZENTUI_PROTOTYPE_PATCH_REGISTRY];
131
+ if (registry.size === 0) delete target[POLISHED_PROTOTYPE_PATCH_REGISTRY];
128
132
  throw new TypeError(
129
133
  `Cannot patch ${method}: predecessor is not a function`,
130
134
  );
@@ -135,7 +139,7 @@ export function installPrototypePatch(
135
139
  predecessorDescriptor,
136
140
  wrapper: () => undefined,
137
141
  };
138
- const wrapper: PrototypeMethod = function zentuiPrototypeWrapper(
142
+ const wrapper: PrototypeMethod = function polishedPrototypeWrapper(
139
143
  this: unknown,
140
144
  ...args: unknown[]
141
145
  ): unknown {
@@ -152,7 +156,7 @@ export function installPrototypePatch(
152
156
  try {
153
157
  installWrapper(target, nextRecord);
154
158
  } catch (error) {
155
- if (registry.size === 0) delete target[ZENTUI_PROTOTYPE_PATCH_REGISTRY];
159
+ if (registry.size === 0) delete target[POLISHED_PROTOTYPE_PATCH_REGISTRY];
156
160
  throw error;
157
161
  }
158
162
  record = nextRecord;
@@ -179,5 +183,5 @@ export function removePrototypePatch(
179
183
  deactivateRecord(record);
180
184
  restorePredecessor(target, record);
181
185
  registry.delete(adapter);
182
- if (registry.size === 0) delete target[ZENTUI_PROTOTYPE_PATCH_REGISTRY];
186
+ if (registry.size === 0) delete target[POLISHED_PROTOTYPE_PATCH_REGISTRY];
183
187
  }
@@ -20,6 +20,7 @@ import registerHeader, {
20
20
  import { SelectorController } from "../../layouts/overlay/selector-controller.ts";
21
21
  import { WorkingLineLayoutController } from "../../layouts/working-line/controller.ts";
22
22
  import {
23
+ LEGACY_TURN_SUMMARY_ENTRY_TYPE,
23
24
  renderTurnSummaryEntry,
24
25
  TURN_SUMMARY_ENTRY_TYPE,
25
26
  } from "../../layouts/working-line/interaction-summary.ts";
@@ -192,18 +193,24 @@ export function createLayoutRuntime(
192
193
  });
193
194
  const state = sessionState.state;
194
195
  if (typeof pi.registerEntryRenderer === "function") {
195
- pi.registerEntryRenderer(
196
- TURN_SUMMARY_ENTRY_TYPE,
197
- (entry, entryOptions, theme) =>
198
- renderTurnSummaryEntry(
199
- entry,
200
- {
201
- ...entryOptions,
202
- workingLineHigh: currentConfig.colors.workingLineHigh,
203
- },
204
- theme,
205
- ),
206
- );
196
+ const renderTurnSummary = (
197
+ entry: { data?: unknown },
198
+ entryOptions: unknown,
199
+ theme: Parameters<typeof renderTurnSummaryEntry>[2],
200
+ ) => {
201
+ const options = (entryOptions ?? {}) as Record<string, unknown>;
202
+ return renderTurnSummaryEntry(
203
+ entry,
204
+ {
205
+ ...options,
206
+ workingLineHigh: currentConfig.colors.workingLineHigh,
207
+ },
208
+ theme,
209
+ );
210
+ };
211
+ pi.registerEntryRenderer(TURN_SUMMARY_ENTRY_TYPE, renderTurnSummary);
212
+ // 旧 session 的摘要条目继续可渲染。
213
+ pi.registerEntryRenderer(LEGACY_TURN_SUMMARY_ENTRY_TYPE, renderTurnSummary);
207
214
  }
208
215
  const refresh = (): void => {
209
216
  if (sessionLifecycle.isCurrent()) {
@@ -6,7 +6,7 @@ import { type Config, normalizeConfig } from "../config/renderer.ts";
6
6
  import {
7
7
  mergeConfig,
8
8
  mutateComponentsRecord,
9
- type ZentuiConfig,
9
+ type PolishedTuiConfig,
10
10
  } from "../config/shell.ts";
11
11
  import {
12
12
  type ConfigRecord,
@@ -19,7 +19,7 @@ import { applyPresetRecord, isPreset } from "./presets.ts";
19
19
  export type SettingsChange = Readonly<{ id: string; value: string }>;
20
20
 
21
21
  export type SettingsSnapshot = Readonly<{
22
- shell: ZentuiConfig;
22
+ shell: PolishedTuiConfig;
23
23
  renderer: Config;
24
24
  panel: PanelOverlayConfig;
25
25
  }>;
@@ -6,7 +6,7 @@ import type {
6
6
  import { type Config, config } from "../../app/config/renderer.ts";
7
7
  import {
8
8
  hasUnsupportedComponentStyle,
9
- type ZentuiConfig,
9
+ type PolishedTuiConfig,
10
10
  } from "../../app/config/shell.ts";
11
11
  import { installUserMessageStyle } from "./message/user-message.ts";
12
12
  import registerContextRenderer, {
@@ -22,7 +22,7 @@ export type ContextRuntimeController = RendererRuntimeController & {
22
22
  applyConfig(ctx: ExtensionContext, previous: Config): void;
23
23
  };
24
24
  export type ContextExtensionOptions = {
25
- readonly getConfig: () => ZentuiConfig;
25
+ readonly getConfig: () => PolishedTuiConfig;
26
26
  readonly services?: RendererExtensionOptions["services"];
27
27
  };
28
28
 
@@ -192,7 +192,7 @@ function filterUserMessageTerminalText(
192
192
  }
193
193
 
194
194
  // Removing an unterminated introducer prevents it from consuming
195
- // Zentui's prompt markers. Preserve visible trailing payload, except
195
+ // pi-one-ui's prompt markers. Preserve visible trailing payload, except
196
196
  // for a recognized partial OSC 133 command prefix.
197
197
  const payloadEnd = boundary?.index ?? text.length;
198
198
  const payload = text.slice(payloadStart, payloadEnd);
@@ -5,7 +5,7 @@ import {
5
5
  truncateToWidth,
6
6
  visibleWidth,
7
7
  } from "@earendil-works/pi-tui";
8
- import type { ZentuiConfig } from "../../../app/config/shell.ts";
8
+ import type { PolishedTuiConfig } from "../../../app/config/shell.ts";
9
9
  import {
10
10
  EDITOR_ACCENT_FALLBACK,
11
11
  EDITOR_BORDER_FALLBACK,
@@ -17,7 +17,7 @@ export type UserMessageStyleRenderInput = {
17
17
  text: string;
18
18
  width: number;
19
19
  theme?: Theme;
20
- config: ZentuiConfig;
20
+ config: PolishedTuiConfig;
21
21
  };
22
22
 
23
23
  function themeFg(
@@ -70,7 +70,7 @@ function fillLine(content: string, width: number): string {
70
70
 
71
71
  function accent(
72
72
  theme: Theme | undefined,
73
- config: ZentuiConfig,
73
+ config: PolishedTuiConfig,
74
74
  text: string,
75
75
  ): string {
76
76
  return theme
@@ -85,7 +85,7 @@ function accent(
85
85
 
86
86
  function border(
87
87
  theme: Theme | undefined,
88
- config: ZentuiConfig,
88
+ config: PolishedTuiConfig,
89
89
  text: string,
90
90
  ): string {
91
91
  return theme
@@ -98,7 +98,10 @@ function border(
98
98
  : text;
99
99
  }
100
100
 
101
- function renderRail(theme: Theme | undefined, config: ZentuiConfig): string {
101
+ function renderRail(
102
+ theme: Theme | undefined,
103
+ config: PolishedTuiConfig,
104
+ ): string {
102
105
  return `${accent(theme, config, config.icons.rail)} `;
103
106
  }
104
107
 
@@ -202,7 +205,7 @@ function renderLabeled({
202
205
  return [top, ...body.map(side), bottom];
203
206
  }
204
207
 
205
- export function userMessageStyleCacheKey(config: ZentuiConfig): string {
208
+ export function userMessageStyleCacheKey(config: PolishedTuiConfig): string {
206
209
  const messages = config.components.userMessages;
207
210
  switch (messages.style) {
208
211
  case "framed":
@@ -3,7 +3,7 @@ import {
3
3
  UserMessageComponent,
4
4
  } from "@earendil-works/pi-coding-agent";
5
5
  import { wrapTextWithAnsi } from "@earendil-works/pi-tui";
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,
@@ -79,11 +79,11 @@ function getCachedMarkdownText(instance: object): string | undefined {
79
79
  return text;
80
80
  }
81
81
 
82
- function renderZentuiUserMessage(
82
+ function renderPolishedUserMessage(
83
83
  instance: PatchableUserMessagePrototype,
84
84
  width: number,
85
85
  theme: Theme | undefined,
86
- config: ZentuiConfig,
86
+ config: PolishedTuiConfig,
87
87
  ): string[] | undefined {
88
88
  if (!isRecord(instance)) return undefined;
89
89
 
@@ -171,7 +171,7 @@ export function removeUserMessageStyle(): void {
171
171
 
172
172
  export function installUserMessageStyle(
173
173
  getTheme: () => Theme | undefined,
174
- getConfig: () => ZentuiConfig,
174
+ getConfig: () => PolishedTuiConfig,
175
175
  ): Cleanup {
176
176
  const prototype = UserMessageComponent.prototype;
177
177
  const cleanupInvalidate = installPrototypePatch(
@@ -195,7 +195,7 @@ export function installUserMessageStyle(
195
195
  const width = args[0];
196
196
  if (typeof width !== "number") return renderPredecessor();
197
197
  try {
198
- const lines = renderZentuiUserMessage(
198
+ const lines = renderPolishedUserMessage(
199
199
  receiver as PatchableUserMessagePrototype,
200
200
  width,
201
201
  getTheme(),
@@ -690,7 +690,7 @@ function compactEditWriteLines(
690
690
  outputText,
691
691
  theme,
692
692
  isError,
693
- state.ccstyleIoView,
693
+ state.oneuiIoView,
694
694
  component.args,
695
695
  component,
696
696
  true, // 外层 Box(1,1) 已 pad
@@ -1380,7 +1380,7 @@ export function installCompactMode(
1380
1380
  uiRef = ctx?.ui;
1381
1381
  resetRounds();
1382
1382
  // 始终保持补丁在链上:mode=on/off 走 passThrough,仍写入 lastMessage
1383
- // 与 tracked 集合,这样 /ccstyle 切回 compact 时不必 /reload。
1383
+ // 与 tracked 集合,这样 /oneui 切回 compact 时不必 /reload。
1384
1384
  patch.assertAssistantOwnership();
1385
1385
  if (config.mode === "compact") syncGlobalExpanded(ctx);
1386
1386
  else hoveredAssistantComponent = undefined;
@@ -236,8 +236,8 @@ function renderExpandedTaskResult(
236
236
  return formatted ? new Text(`↳ ${formatted}`, 0, 0) : undefined;
237
237
  }
238
238
 
239
- /** 用 ccstyle call/result 包装任意工具定义。 */
240
- function createCcstyleTool(
239
+ /** 用 pi-one-ui call/result 包装任意工具定义。 */
240
+ function createPolishedTool(
241
241
  originalTool: any,
242
242
  writeExecutionMetadata: WriteExecutionMetadataStore,
243
243
  ): any {
@@ -400,7 +400,7 @@ function createCcstyleTool(
400
400
  true, // mode=on:贴左,由外层 Box(1,1) 提供 1 格 padding
401
401
  );
402
402
  }
403
- if (context?.state) context.state.ccstyleIoView = undefined;
403
+ if (context?.state) context.state.oneuiIoView = undefined;
404
404
  let cachedWidth: number | undefined;
405
405
  let cachedLine: string | undefined;
406
406
  let cachedHoveredLine: string | undefined;
@@ -425,7 +425,7 @@ function createCcstyleTool(
425
425
  cachedWidth = undefined;
426
426
  cachedLine = undefined;
427
427
  cachedHoveredLine = undefined;
428
- context?.state?.ccstyleExpandedIoView?.invalidate?.();
428
+ context?.state?.oneuiExpandedIoView?.invalidate?.();
429
429
  },
430
430
  };
431
431
  },
@@ -465,7 +465,7 @@ function shouldGloballyStyleTool(
465
465
  const builtInDefinition = component.builtInToolDefinition;
466
466
  const definition = extensionDefinition ?? builtInDefinition;
467
467
  const toolName = String(component.toolName || definition?.name || "");
468
- const useCcstyle =
468
+ const usePolishedToolStyle =
469
469
  patch.mode() === "on" &&
470
470
  !DEDICATED_RENDERER_TOOLS.has(toolName) &&
471
471
  !preservesOriginalRenderer(
@@ -473,8 +473,8 @@ function shouldGloballyStyleTool(
473
473
  toolName,
474
474
  builtInDefinition,
475
475
  );
476
- component[COMPONENT_TOOL_RENDER_MODE] = useCcstyle;
477
- return useCcstyle;
476
+ component[COMPONENT_TOOL_RENDER_MODE] = usePolishedToolStyle;
477
+ return usePolishedToolStyle;
478
478
  }
479
479
 
480
480
  function getGloballyStyledTool(
@@ -607,7 +607,7 @@ function installGlobalToolRendering(
607
607
  active: true,
608
608
  enabled: () => config.mode === "on",
609
609
  mode: () => config.mode,
610
- wrap: (tool: any) => createCcstyleTool(tool, writeExecutionMetadata),
610
+ wrap: (tool: any) => createPolishedTool(tool, writeExecutionMetadata),
611
611
  byDefinition: new WeakMap(),
612
612
  byName: new Map(),
613
613
  downstream,
@@ -626,8 +626,8 @@ function installGlobalToolRendering(
626
626
  getRenderShell: function (this: any, ...args: any[]) {
627
627
  if (!patch.active)
628
628
  return patch.downstream.getRenderShell.apply(this, args);
629
- const useCcstyle = shouldGloballyStyleTool(this, patch);
630
- const shell = useCcstyle
629
+ const usePolishedToolStyle = shouldGloballyStyleTool(this, patch);
630
+ const shell = usePolishedToolStyle
631
631
  ? this.expanded
632
632
  ? "default"
633
633
  : "self"
@@ -243,7 +243,6 @@ export default function (
243
243
  hooks.toolGrouping.setTheme(ctx.ui.theme);
244
244
  hooks.toggleRenderCache.setTheme(ctx.ui.theme);
245
245
  setMessageDisplayTheme(ctx.ui.theme);
246
- ctx.ui.setStatus("ccstyle", undefined);
247
246
  // Collect the resumed context before syncing compact patches and expansion state.
248
247
  syncCompactMode(ctx);
249
248
  // compact-thinking 的 session_start 处理在本 handler 之后执行(在其之上再装
@@ -97,10 +97,10 @@ type InteractionRegion = {
97
97
 
98
98
  type InteractionFrame = { regions: InteractionRegion[] };
99
99
 
100
- const TOOL_MOUSE_WIDGET_KEY = "ccstyle-tool-mouse";
100
+ const TOOL_MOUSE_WIDGET_KEY = "oneui-tool-mouse";
101
101
  const TOOL_MOUSE_MOTION_ENABLE = "\x1b[?1003h\x1b[?1006h";
102
102
  const TOOL_MOUSE_MOTION_DISABLE = "\x1b[?1003l";
103
- const FULLSCREEN_MOTION_ENABLED = Symbol("ccstyle.fullscreen-motion-enabled");
103
+ const FULLSCREEN_MOTION_ENABLED = Symbol("pi-one-ui.fullscreen-motion-enabled");
104
104
  const DEFAULT_TOOL_MOUSE_OWNER = {};
105
105
  export const TOOL_MOUSE_DISABLE = "\x1b[?1006l\x1b[?1003l\x1b[?1000l";
106
106
 
@@ -118,7 +118,7 @@ let ownsFullscreenMotion = false;
118
118
  let sessionRenderTimer: ReturnType<typeof setTimeout> | null = null;
119
119
  let latestInteractionFrame: InteractionFrame = { regions: [] };
120
120
 
121
- /** Summary markers used by Pi and ccstyle; unlike the trailing hint, these survive truncation. */
121
+ /** Summary markers used by Pi and pi-one-ui; unlike the trailing hint, these survive truncation. */
122
122
  const COLLAPSED_TOOL_SUMMARY = /^\s*(?:↳|└|⎿|●|✓|✗|…)/;
123
123
 
124
124
  function interactionRegionAt(packet: SgrMousePacket): InteractionRegion | null {
@@ -298,9 +298,9 @@ function releaseFullscreenToolMouseMotion(tui?: any): void {
298
298
  }
299
299
  }
300
300
 
301
- const FULLSCREEN_VIEWPORT_PATCH = Symbol("ccstyle.fullscreen-viewport-patch");
301
+ const FULLSCREEN_VIEWPORT_PATCH = Symbol("pi-one-ui.fullscreen-viewport-patch");
302
302
  const FULLSCREEN_WHEEL_SCROLL_ORIGINAL = Symbol(
303
- "ccstyle.fullscreen-wheel-scroll-original",
303
+ "pi-one-ui.fullscreen-wheel-scroll-original",
304
304
  );
305
305
 
306
306
  /**
@@ -14,9 +14,9 @@ import {
14
14
  } from "../../../../tools/patch-keys.ts";
15
15
  import { parseSgrMousePackets } from "./packets.ts";
16
16
 
17
- const ZENTUI_PAGE_UP_INPUT =
17
+ const PAGE_UP_INPUT =
18
18
  /^\x1b\[5;9(?::[12])?~$|^\x1b\[57421;9(?::[12])?u$|^\x1b\[1;6A$/;
19
- const ZENTUI_PAGE_DOWN_INPUT =
19
+ const PAGE_DOWN_INPUT =
20
20
  /^\x1b\[6;9(?::[12])?~$|^\x1b\[57422;9(?::[12])?u$|^\x1b\[1;6B$/;
21
21
  const SCROLL_BOTTOM_SHORTCUT = "ctrl+end";
22
22
 
@@ -123,8 +123,8 @@ function isScrollNavigationInput(data: string): boolean {
123
123
  if (
124
124
  matchesKey(data, "pageUp") ||
125
125
  matchesKey(data, "pageDown") ||
126
- ZENTUI_PAGE_UP_INPUT.test(data) ||
127
- ZENTUI_PAGE_DOWN_INPUT.test(data) ||
126
+ PAGE_UP_INPUT.test(data) ||
127
+ PAGE_DOWN_INPUT.test(data) ||
128
128
  // 官方 fullscreen viewport 的可滚动键(half-page/prompt/top/bottom)。
129
129
  [
130
130
  "tui.altScreen.pageUp",
@@ -119,7 +119,7 @@ export function renderEditDiffResult(
119
119
  showHashlineAnchors,
120
120
  );
121
121
  const palette = resolveDiffPalette(theme);
122
- // Rich diffs use ccstyle's self shell. Keep the panel transparent so the
122
+ // Rich diffs use pi-one-ui's self shell. Keep the panel transparent so the
123
123
  // separator cannot leak toolSuccessBg across the entire new column.
124
124
  const containerBgAnsi = undefined;
125
125
  const language = resolveLanguageFromPath(options.filePath);
@@ -46,7 +46,7 @@ export function renderRichToolResult(
46
46
  theme: any,
47
47
  context: any,
48
48
  writeMetadata: WriteExecutionMetadataStore,
49
- /** Plain snapshot or live getter — getter lets /ccstyle panel changes repaint existing diffs. */
49
+ /** Plain snapshot or live getter — getter lets /oneui panel changes repaint existing diffs. */
50
50
  displayConfig: DisplayConfigInput = DEFAULT_TOOL_DISPLAY_CONFIG,
51
51
  ): any | undefined {
52
52
  if (options?.isPartial || options?.isError || context?.isError)
@@ -213,8 +213,8 @@ type SettledExpandedChildCache = {
213
213
 
214
214
  function toolIoView(tool: any): ExpandedToolIoView | undefined {
215
215
  for (const candidate of [
216
- tool?.rendererState?.ccstyleIoView,
217
- tool?.state?.ccstyleIoView,
216
+ tool?.rendererState?.oneuiIoView,
217
+ tool?.state?.oneuiIoView,
218
218
  tool?.resultRendererComponent,
219
219
  ]) {
220
220
  if (isExpandedToolIoView(candidate)) {
@@ -237,7 +237,7 @@ function ioRenderRevision(
237
237
  }
238
238
 
239
239
  export class ToolGroupComponent extends Container {
240
- readonly toolCallId = `ccstyle-tool-group-${nextGroupId++}`;
240
+ readonly toolCallId = `oneui-tool-group-${nextGroupId++}`;
241
241
  readonly toolName = "Tool group";
242
242
  private _expanded = false;
243
243
  /** 分组是否展开(只读;测试与外部读状态用)。 */
@@ -13,7 +13,7 @@ import {
13
13
  import { showMoreHintText } from "./show-more-hint.ts";
14
14
 
15
15
  /**
16
- * 接管三个消息组件(`<skill>` 块、压缩摘要、分支摘要),ccstyle on 时渲染为
16
+ * 接管三个消息组件(`<skill>` 块、压缩摘要、分支摘要),pi-one-ui on 时渲染为
17
17
  * 与工具调用一致的单行风格(● Title · hint),off 时回退原生。
18
18
  *
19
19
  * 三者结构同构:Box + markdownTheme + updateDisplay,构造/setExpanded/invalidate
@@ -68,12 +68,12 @@ function ensureHintHover(component: any): void {
68
68
  };
69
69
  }
70
70
 
71
- function renderCcstyle(component: any, kind: DisplayKind): void {
71
+ function renderPolishedMessage(component: any, kind: DisplayKind): void {
72
72
  const theme = displayTheme;
73
73
  if (!theme) return; // 主题未就绪时保留原生渲染
74
74
  if (component.bgFn) component.setBgFn?.(undefined); // 与工具调用一致,去掉灰底
75
75
  if (component.paddingY !== 0) {
76
- component._ccstyleOriginalPaddingY = component.paddingY;
76
+ component._oneuiOriginalPaddingY = component.paddingY;
77
77
  component.paddingY = 0; // 工具组件 paddingY=0;原生 Box 默认 1,会上下各留一个空行
78
78
  }
79
79
  component.clear();
@@ -128,16 +128,16 @@ export function installMessageDisplayRendering(): () => void {
128
128
  const installed = function (this: any) {
129
129
  if (patch.active && config.mode !== "off") {
130
130
  try {
131
- renderCcstyle(this, kind);
131
+ renderPolishedMessage(this, kind);
132
132
  return;
133
133
  } catch {
134
134
  // 渲染失败回退原生
135
135
  }
136
136
  }
137
137
  // 回退原生前恢复 paddingY,避免原生渲染丢失上下内边距
138
- if (this._ccstyleOriginalPaddingY !== undefined) {
139
- this.paddingY = this._ccstyleOriginalPaddingY;
140
- delete this._ccstyleOriginalPaddingY;
138
+ if (this._oneuiOriginalPaddingY !== undefined) {
139
+ this.paddingY = this._oneuiOriginalPaddingY;
140
+ delete this._oneuiOriginalPaddingY;
141
141
  }
142
142
  original.call(this);
143
143
  };
@@ -247,8 +247,8 @@ const activeAnimationContexts = new Set<any>();
247
247
  let sharedAnimationTimer: ReturnType<typeof setTimeout> | null = null;
248
248
 
249
249
  function clearAnimation(context: any) {
250
- if (!context?.state?.ccstyleAnimationScheduled) return;
251
- context.state.ccstyleAnimationScheduled = false;
250
+ if (!context?.state?.oneuiAnimationScheduled) return;
251
+ context.state.oneuiAnimationScheduled = false;
252
252
  activeAnimationContexts.delete(context);
253
253
  if (activeAnimationContexts.size === 0 && sharedAnimationTimer) {
254
254
  clearTimeout(sharedAnimationTimer);
@@ -258,7 +258,7 @@ function clearAnimation(context: any) {
258
258
 
259
259
  export function clearAllAnimations() {
260
260
  for (const ctx of activeAnimationContexts) {
261
- ctx.state.ccstyleAnimationScheduled = false;
261
+ ctx.state.oneuiAnimationScheduled = false;
262
262
  }
263
263
  activeAnimationContexts.clear();
264
264
  if (sharedAnimationTimer) {
@@ -272,8 +272,8 @@ export function scheduleAnimation(
272
272
  intervalMs = TOOL_LOADING_INTERVAL_MS,
273
273
  ) {
274
274
  const state = (context.state ??= {});
275
- if (state.ccstyleAnimationScheduled) return;
276
- state.ccstyleAnimationScheduled = true;
275
+ if (state.oneuiAnimationScheduled) return;
276
+ state.oneuiAnimationScheduled = true;
277
277
  activeAnimationContexts.add(context);
278
278
  if (!sharedAnimationTimer) {
279
279
  sharedAnimationTimer = setTimeout(() => {
@@ -281,7 +281,7 @@ export function scheduleAnimation(
281
281
  const contexts = Array.from(activeAnimationContexts);
282
282
  activeAnimationContexts.clear();
283
283
  for (const ctx of contexts) {
284
- ctx.state.ccstyleAnimationScheduled = false;
284
+ ctx.state.oneuiAnimationScheduled = false;
285
285
  ctx.invalidate?.();
286
286
  }
287
287
  }, intervalMs);
@@ -307,8 +307,8 @@ export function settledIcon(
307
307
  export function setToolVisualState(context: any, visualState: ToolVisualState) {
308
308
  const state = (context.state ??= {});
309
309
  if (visualState !== "pending") clearAnimation(context);
310
- if (state.ccstyleToolVisualState === visualState) return;
311
- state.ccstyleToolVisualState = visualState;
310
+ if (state.oneuiToolVisualState === visualState) return;
311
+ state.oneuiToolVisualState = visualState;
312
312
  // Do not invalidate synchronously from renderResult. Pi is already rendering
313
313
  // this tool row; recursively scheduling another render here can retain both
314
314
  // the finalized result component and its previous secondary/partial component,
@@ -317,7 +317,7 @@ export function setToolVisualState(context: any, visualState: ToolVisualState) {
317
317
  }
318
318
 
319
319
  function getToolVisualState(context: any): ToolVisualState | undefined {
320
- return context?.state?.ccstyleToolVisualState as ToolVisualState | undefined;
320
+ return context?.state?.oneuiToolVisualState as ToolVisualState | undefined;
321
321
  }
322
322
 
323
323
  export function resolveToolVisualState(
@@ -346,7 +346,7 @@ export function toolIconColor(
346
346
  }
347
347
 
348
348
  export function isToolExpanded(options: any, context: any): boolean {
349
- const local = context?.state?.ccstyleToolExpanded;
349
+ const local = context?.state?.oneuiToolExpanded;
350
350
  return typeof local === "boolean"
351
351
  ? local
352
352
  : Boolean(options?.expanded ?? context?.expanded);
@@ -407,7 +407,7 @@ export type ToolIoSection = "input" | "output";
407
407
  // Module-local token: /reload creates a fresh token, so stale view instances are
408
408
  // replaced instead of retaining their old render implementation.
409
409
  const EXPANDED_TOOL_IO_VIEW_GENERATION = Symbol(
410
- "ccstyle-expanded-tool-io-view",
410
+ "pi-one-ui.expanded-tool-io-view",
411
411
  );
412
412
 
413
413
  /**
@@ -931,7 +931,7 @@ export function renderExpandedToolResult(
931
931
 
932
932
  // Prefer structured Input/Output when we have args or non-empty output.
933
933
  if (inputBody.trim() || outputBody.trim()) {
934
- const cached = context?.state?.ccstyleExpandedIoView;
934
+ const cached = context?.state?.oneuiExpandedIoView;
935
935
  let view: ExpandedToolIoView;
936
936
  if (isExpandedToolIoView(lastComponent)) {
937
937
  view = lastComponent;
@@ -962,8 +962,8 @@ export function renderExpandedToolResult(
962
962
  }
963
963
 
964
964
  if (context?.state) {
965
- context.state.ccstyleIoView = undefined;
966
- context.state.ccstyleExpandedIoView = undefined;
965
+ context.state.oneuiIoView = undefined;
966
+ context.state.oneuiExpandedIoView = undefined;
967
967
  }
968
968
  const color = isError ? "error" : "muted";
969
969
  return new Text(theme.fg(color, renderCollapsedToolResult("Done")), 0, 0);
@@ -1079,8 +1079,8 @@ function rememberIoView(context: any, view: ExpandedToolIoView): void {
1079
1079
  ioViewInvalidators.set(view, () => context.invalidate());
1080
1080
  }
1081
1081
  if (!context.state || typeof context.state !== "object") context.state = {};
1082
- context.state.ccstyleIoView = view;
1083
- context.state.ccstyleExpandedIoView = view;
1082
+ context.state.oneuiIoView = view;
1083
+ context.state.oneuiExpandedIoView = view;
1084
1084
  }
1085
1085
 
1086
1086
  /** hover 状态变更后刷新上一个/下一个视图(context.invalidate 缓存于 ioViewInvalidators)。 */