@linxiraos/pi-tui 1.4.9 → 1.4.11

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
@@ -1,5 +1,135 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.4.11] - 2026-11-06
4
+
5
+ - Released as part of Zeta 1.4.11; no package-specific user-visible changes.
6
+
7
+ ## [9.4.0] - 2026-01-31
8
+
9
+ ### Added
10
+
11
+ - Exported `padding` utility function for creating space-padded strings efficiently
12
+
13
+ ### Changed
14
+
15
+ - Optimized padding operations across all components to use pre-allocated space buffer for better performance
16
+
17
+ ## [8.4.1] - 2026-01-25
18
+
19
+ ### Added
20
+
21
+ - Added fuzzy match function for autocomplete suggestions
22
+
23
+ ## [8.4.0] - 2026-01-25
24
+
25
+ ### Fixed
26
+
27
+ - Terminal gracefully handles write failures by marking dead instead of exiting the process
28
+
29
+ ## [8.2.0] - 2026-01-24
30
+
31
+ ### Added
32
+
33
+ - Added mermaid diagram rendering engine (renderMermaidToPng) with mmdc CLI integration
34
+
35
+ ### Fixed
36
+
37
+ - Fixed crash when terminal becomes unavailable (EIO errors) by exiting gracefully instead of throwing
38
+
39
+ ## [6.8.3] - 2026-01-21
40
+
41
+ ### Added
42
+
43
+ - Added undo support in the editor via `Ctrl+-`
44
+
45
+ ### Changed
46
+
47
+ - Improved fuzzy matching to handle alphanumeric swaps
48
+
49
+ ## [5.6.7] - 2026-01-18
50
+
51
+ ### Added
52
+
53
+ - Added configurable editor padding via `editorPaddingX` theme option
54
+
55
+ ### Changed
56
+
57
+ - Updated tab bar rendering to wrap text across multiple lines when content exceeds available width
58
+
59
+ ### Fixed
60
+
61
+ - Fixed key detection for shifted symbol characters
62
+
63
+ ## [5.1.0] - 2026-01-14
64
+
65
+ ### Changed
66
+
67
+ - Changed `OverlayOptions` to use `SizeValue` type for `width`, `maxHeight`, `row`, and `col` properties
68
+
69
+ ### Fixed
70
+
71
+ - Fixed numbered list items showing "1." for all items when code blocks break list continuity
72
+
73
+ ## [4.6.0] - 2026-01-12
74
+
75
+ ### Added
76
+
77
+ - Add fuzzy matching module (`fuzzyMatch`, `fuzzyFilter`) for command autocomplete
78
+
79
+ ## [4.2.1] - 2026-01-11
80
+
81
+ ### Fixed
82
+
83
+ - Fixed editor redraw glitch when canceling autocomplete suggestions
84
+
85
+ ## [4.1.0] - 2026-01-10
86
+
87
+ ### Added
88
+
89
+ - Added persistent prompt history storage support via `setHistoryStorage()` method, allowing history to be saved and restored across sessions
90
+
91
+ ## [3.32.0] - 2026-01-08
92
+
93
+ ### Fixed
94
+
95
+ - Fixed text wrapping allowing long whitespace tokens to exceed line width
96
+
97
+ ## [3.20.0] - 2026-01-06
98
+
99
+ ### Changed
100
+
101
+ - Settings list descriptions now wrap to the available width instead of truncating
102
+
103
+ ### Fixed
104
+
105
+ - Fixed Shift+Enter detection in legacy terminals that send ESC+CR sequence
106
+
107
+ ## [3.15.0] - 2026-01-05
108
+
109
+ ### Added
110
+
111
+ - Added `inputCursor` symbol for customizing the text input cursor character
112
+
113
+ ## [3.9.1337] - 2026-01-04
114
+
115
+ ### Changed
116
+
117
+ - Changed Editor component to use proper box borders with vertical side borders instead of horizontal-only borders
118
+
119
+ ## [1.500.0] - 2026-01-03
120
+
121
+ ### Added
122
+
123
+ - Added `getText()` method to Text component for retrieving current text content
124
+
125
+ ## [1.337.0] - 2026-01-02
126
+
127
+ Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mono](https://github.com/badlogic/pi-mono).
128
+
129
+ ## [1.4.10] - 2026-11-05
130
+
131
+ - Released as part of Zeta 1.4.10; no package-specific user-visible changes.
132
+
3
133
  ## [1.4.9] - 2026-11-03
4
134
 
5
135
  - Synced with upstream OMP v18.16.0: composer predictions, status glyph changes, and TUI link handling.
@@ -213,128 +343,6 @@ Older entries are archived in [packages/tui/CHANGELOG.md@58141d4e5fa8](https://g
213
343
  - Removed `truncateToWidth`, `sliceWithWidth`, and `extractSegments` functions from public API (now re-exported directly from @linxiraos/pi-natives)
214
344
  - `SingleResult` (and the task tool's settled payload) carries the failure diagnostics an agent-driven model switch needs: optional `failureClass` (`usage-limit` / `auth` / `account-policy` / `context-overflow` / `transient` / `aborted` / `unknown`), optional `fallbackCandidates` (other selectors this session could run), and optional `modelChange` (`{ source: "spawn-param" | "wake-param", from?, to }`) recording that a caller-supplied model replaced the default one. All three stay absent unless a run actually reports them.
215
345
 
216
- ## [9.4.0] - 2026-01-31
217
-
218
- ### Added
219
-
220
- - Exported `padding` utility function for creating space-padded strings efficiently
221
-
222
- ### Changed
223
-
224
- - Optimized padding operations across all components to use pre-allocated space buffer for better performance
225
-
226
- ## [8.4.1] - 2026-01-25
227
-
228
- ### Added
229
-
230
- - Added fuzzy match function for autocomplete suggestions
231
-
232
- ## [8.4.0] - 2026-01-25
233
-
234
- ### Fixed
235
-
236
- - Terminal gracefully handles write failures by marking dead instead of exiting the process
237
-
238
- ## [8.2.0] - 2026-01-24
239
-
240
- ### Added
241
-
242
- - Added mermaid diagram rendering engine (renderMermaidToPng) with mmdc CLI integration
243
-
244
- ### Fixed
245
-
246
- - Fixed crash when terminal becomes unavailable (EIO errors) by exiting gracefully instead of throwing
247
-
248
- ## [6.8.3] - 2026-01-21
249
-
250
- ### Added
251
-
252
- - Added undo support in the editor via `Ctrl+-`
253
-
254
- ### Changed
255
-
256
- - Improved fuzzy matching to handle alphanumeric swaps
257
-
258
- ## [5.6.7] - 2026-01-18
259
-
260
- ### Added
261
-
262
- - Added configurable editor padding via `editorPaddingX` theme option
263
-
264
- ### Changed
265
-
266
- - Updated tab bar rendering to wrap text across multiple lines when content exceeds available width
267
-
268
- ### Fixed
269
-
270
- - Fixed key detection for shifted symbol characters
271
-
272
- ## [5.1.0] - 2026-01-14
273
-
274
- ### Changed
275
-
276
- - Changed `OverlayOptions` to use `SizeValue` type for `width`, `maxHeight`, `row`, and `col` properties
277
-
278
- ### Fixed
279
-
280
- - Fixed numbered list items showing "1." for all items when code blocks break list continuity
281
-
282
- ## [4.6.0] - 2026-01-12
283
-
284
- ### Added
285
-
286
- - Add fuzzy matching module (`fuzzyMatch`, `fuzzyFilter`) for command autocomplete
287
-
288
- ## [4.2.1] - 2026-01-11
289
-
290
- ### Fixed
291
-
292
- - Fixed editor redraw glitch when canceling autocomplete suggestions
293
-
294
- ## [4.1.0] - 2026-01-10
295
-
296
- ### Added
297
-
298
- - Added persistent prompt history storage support via `setHistoryStorage()` method, allowing history to be saved and restored across sessions
299
-
300
- ## [3.32.0] - 2026-01-08
301
-
302
- ### Fixed
303
-
304
- - Fixed text wrapping allowing long whitespace tokens to exceed line width
305
-
306
- ## [3.20.0] - 2026-01-06
307
-
308
- ### Changed
309
-
310
- - Settings list descriptions now wrap to the available width instead of truncating
311
-
312
- ### Fixed
313
-
314
- - Fixed Shift+Enter detection in legacy terminals that send ESC+CR sequence
315
-
316
- ## [3.15.0] - 2026-01-05
317
-
318
- ### Added
319
-
320
- - Added `inputCursor` symbol for customizing the text input cursor character
321
-
322
- ## [3.9.1337] - 2026-01-04
323
-
324
- ### Changed
325
-
326
- - Changed Editor component to use proper box borders with vertical side borders instead of horizontal-only borders
327
-
328
- ## [1.500.0] - 2026-01-03
329
-
330
- ### Added
331
-
332
- - Added `getText()` method to Text component for retrieving current text content
333
-
334
- ## [1.337.0] - 2026-01-02
335
-
336
- Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mono](https://github.com/badlogic/pi-mono).
337
-
338
346
  ## [1.4.7] - 2026-10-30
339
347
 
340
348
  - Synced with upstream OMP v18.14.0; no package-specific user-visible changes.
@@ -5,6 +5,50 @@ This generated, self-contained aggregate accompanies Zeta release artifacts.
5
5
  It does not replace package-level license files. First-party licensing grants
6
6
  no rights in third-party code, fonts, data, or marks identified below.
7
7
 
8
+ ZETA IS A FORK AND REDISTRIBUTION
9
+ =================================
10
+
11
+ Zeta is a downstream distribution of oh-my-pi (OMP), and it also contains forks
12
+ of OMP Web, OMP Studio and TermIDE. Upstream copyright notices stay with their
13
+ files and are not restated here. This section states, for every forked or
14
+ vendored application tree, where it came from, what Zeta changed, and why.
15
+ Upstream URLs are the ones configured in `.git/config`; the per-tree deviation
16
+ ledgers are authoritative for details.
17
+
18
+ Forked application trees:
19
+
20
+ | Path | Upstream | Snapshot | License | What Zeta changed |
21
+ |---|---|---|---|---|
22
+ | `packages/ main/ crates/ python/ lsp/ sdk/ types/ skills/` | oh-my-pi (OMP), https://github.com/can1357/oh-my-pi | integrated through tag `v18.15.0` (`document/upstream-sync.md`) | see upstream files | product name, paths, command names and env prefixes; branded assets; internal identifiers renamed to `__zeta*` |
23
+ | `web-ui/` | OMP Web, https://github.com/17380936778/omp-web | frozen snapshot + manual cherry-picks (`document/upstream-sync.md`) | see upstream files | gateway transport, theme token bridge, page routing |
24
+ | `web-app/` (`src/studio`, `src/vendor/*`) | OMP Studio 0.1.17, https://github.com/the-snowpear/omp-studio | `0.1.17`, ported into the product renderer | MIT | maintained by Zeta now: the host contract is reimplemented in `studio-host` (pair/CSRF/query/command/events), the renderer was rebranded (`zeta-studio` wire name, Zeta links/fixtures), and Zeta adds windowed transcripts, precompressed static serving, the plugin registry, and the usage dashboard |
25
+ | `termide/` | TermIDE, https://github.com/termide/termide | tag `0.46.0` = `a027ca788cd4c9d24f060cdcd3195ca2e475617b` | MIT | deviations listed in `termide/VENDOR.md` (28 entries) |
26
+ | `editor/npm/*` (`@linxiraos/editor*`) | TermIDE `panel-editor` | same tree as `termide/` | MIT | built as the editor-only bin `termide-editor` (`editor/npm/editor/VENDOR.md`) |
27
+ | `plugins/official/*` | per plugin | per plugin | per plugin | each directory carries `plugin.json`, README with source, and its license |
28
+
29
+ Why the fork renames things at all: the upstream licenses and the product
30
+ identity both require that a downstream distribution not present itself as the
31
+ upstream. Renames therefore cover the product name, command names
32
+ (`zetawork` / `zetacode` / `zetaide`), the `zeta://` scheme, the npm scope
33
+ `@linxiraos/*`, and release asset names (`zeta-cli-*`). User-visible
34
+ configuration keeps accepting the legacy names during the transition, so an
35
+ existing installation does not silently break.
36
+
37
+ Brand and assets:
38
+
39
+ * Product marks — name, logos, app icons, wordmarks, splash art — are Zeta's own
40
+ and are not redistributed from any upstream. Upstream marks are not shipped.
41
+ * Assets that do come from an upstream are enumerated in the per-tree ledgers
42
+ above; each keeps its upstream license notice in place.
43
+
44
+ Frozen counterpart constants (interoperability, not branding):
45
+
46
+ * Stencil OIDC `client-id "omp"`, its issuer and scopes; `catalog.stencil.so`;
47
+ `docs.stencil.so/tern/protocol/`; `my.omp.sh` as the collaboration relay
48
+ constant; the `__omp_judgment_images` upload key. These are wire-compatible
49
+ identifiers Zeta must keep, listed here so that a brand sweep does not break
50
+ them.
51
+
8
52
  PYTHON DEPENDENCY DISTRIBUTION ROLE
9
53
  ===================================
10
54
 
@@ -385,6 +429,62 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
385
429
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
386
430
  SOFTWARE.
387
431
 
432
+ -------------------------------------------------------------------------------
433
+ web-app/src/studio + web-app/src/vendor/* + web-ui/components/studio +
434
+ web-ui/styles/studio + web-ui/lib/studio-protocol
435
+
436
+ Ported UI surface and protocol types from OMP Studio 0.1.17 (MIT).
437
+
438
+ - `web-ui/components/studio/` and `web-ui/styles/studio/` are derived from the
439
+ OMP Studio renderer (`apps/renderer/src`).
440
+ - `web-ui/lib/studio-protocol/` vendors the type and validation surface of
441
+ `@omp-studio/client-contract` and `@omp-studio/studio-protocol` (78 files, no
442
+ runtime dependency), so the ported renderer keeps its own read models.
443
+ - `web-ui/lib/studio-client/` is Zeta's own implementation of the
444
+ `StudioClient` interface over the Zeta gateway; it is not derived from
445
+ `@omp-studio/client`.
446
+
447
+ The data plumbing, transport and packaging are Zeta's own and are not part of
448
+ that derivation.
449
+
450
+ Copyright (c) 2026 snowpear and OMP Studio contributors
451
+ Copyright (c) 2026 Linxira-OS and Zeta contributors (Zeta modifications and additions)
452
+
453
+ Local modifications: the product renderer moved to `web-app/` (Vite 7) with
454
+ its own node project, and the host contract is Zeta's `studio-host` rather than
455
+ Studio's server. `@omp-studio/client-contract` and
456
+ `@omp-studio/studio-protocol` imports were rewritten to the vendored copies in
457
+ both trees; `@omp-studio/client` is replaced by `web-ui/lib/studio-client` (the
458
+ frozen snapshot) and by the host-backed transport in `web-app/`. The wire
459
+ protocol name is `zeta-studio`, the desktop bridge global is
460
+ `zetaStudioChrome`, Studio's design tokens were rebound to Zeta's theme alias
461
+ layer (`--studio-*` → `--zeta-alias-*`), and surfaces with no Zeta backend were
462
+ dropped rather than ported. Zeta-only additions: windowed transcript
463
+ pagination, precompressed static assets, the real plugin registry, the usage
464
+ dashboard, and the brand sweep. The MIT notice above covers the unmodified
465
+ upstream portions; Zeta's changes are additionally under
466
+ `Copyright (c) 2026 Linxira-OS and Zeta contributors`.
467
+
468
+ MIT License
469
+
470
+ Permission is hereby granted, free of charge, to any person obtaining a copy
471
+ of this software and associated documentation files (the "Software"), to deal
472
+ in the Software without restriction, including without limitation the rights
473
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
474
+ copies of the Software, and to permit persons to whom the Software is
475
+ furnished to do so, subject to the following conditions:
476
+
477
+ The above copyright notice and this permission notice shall be included in all
478
+ copies or substantial portions of the Software.
479
+
480
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
481
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
482
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
483
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
484
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
485
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
486
+ SOFTWARE.
487
+
388
488
  -------------------------------------------------------------------------------
389
489
  packages/coding-agent/src/export/html/vendor/NOTICE
390
490
 
@@ -1,7 +1,7 @@
1
1
  import type { ThinkingLevel } from "@linxiraos/pi-agent-core";
2
2
  import type { Effort } from "@linxiraos/pi-ai";
3
3
  import { type Component, type ImageBudget } from "../index.js";
4
- import type { ShapeTarget } from "@linxiraos/pi-snapcompact";
4
+ import type { ShapeTarget } from "@linxiraos/zeta-compact";
5
5
  import type { ContextLineMode, StatusLinePreset, StatusLineSegmentId, StatusLineSeparatorStyle } from "../status-line/schema.js";
6
6
  import { type SettingsHost } from "./settings-defs.js";
7
7
  import { type ComposerPreviewStatusSource } from "./composer-shape-preview.js";
@@ -13,7 +13,7 @@
13
13
  * line plus a dim notice.
14
14
  */
15
15
  import { type Component, type ImageBudget } from "../index.js";
16
- import { type ShapeTarget } from "@linxiraos/pi-snapcompact";
16
+ import { type ShapeTarget } from "@linxiraos/zeta-compact";
17
17
  import type { DescribeContext, NativeNode } from "../native/node.js";
18
18
  export interface SnapcompactShapePreviewOptions {
19
19
  /** Active model (api + id); resolves what `auto` maps to for this reader. */
@@ -0,0 +1,3 @@
1
+ import type { SetupScene } from "./types.js";
2
+ /** Pick the UI and settings language before the provider/model scenes run. */
3
+ export declare const languageSetupScene: SetupScene;
@@ -11,6 +11,8 @@ export interface StyledLine {
11
11
  readonly text: string;
12
12
  readonly color: ThemeColor;
13
13
  }
14
+ /** Catalogue tag selectable during onboarding. */
15
+ export type SetupLanguage = "en" | "zh";
14
16
  /** Terminal capabilities used by setup overlays and the startup splash. */
15
17
  export interface SetupUiHost {
16
18
  readonly ui: Pick<TUI, "showOverlay" | "setFocus" | "requestRender" | "invalidate"> & {
@@ -26,6 +28,8 @@ export interface SetupHost extends SetupUiHost {
26
28
  readonly symbolPreset: SymbolPreset;
27
29
  readonly colorBlindMode: boolean;
28
30
  readonly disabledProviders: readonly string[];
31
+ /** Effective UI/settings language; the onboarding language scene starts here. */
32
+ readonly language: SetupLanguage;
29
33
  readonly authStorage: AuthStorage;
30
34
  readonly modelSource: ModelBrowserSource;
31
35
  /** Available and catalog models of every kind; role chips resolve over all of them, rows list chat models. */
@@ -39,6 +43,7 @@ export interface SetupHost extends SetupUiHost {
39
43
  refreshProvider(provider: string): Promise<void>;
40
44
  saveComposerShape(shape: ComposerShape): Promise<void>;
41
45
  saveSymbolPreset(preset: SymbolPreset): void;
46
+ saveLanguage(language: SetupLanguage): Promise<void> | void;
42
47
  saveColorBlindMode(enabled: boolean): void;
43
48
  saveTheme(mode: "dark" | "light", name: string): void;
44
49
  captureBrowserSession(request: OAuthBrowserSessionRequest, signal?: AbortSignal): Promise<string>;
@@ -8,4 +8,4 @@
8
8
  * the overlay component and their TUI deps. MUST equal `max(scene.minVersion)`
9
9
  * across `ALL_SCENES`; the setup scene selection tests guard this invariant.
10
10
  */
11
- export declare const CURRENT_SETUP_VERSION = 2;
11
+ export declare const CURRENT_SETUP_VERSION = 3;
@@ -5,7 +5,7 @@ export type { SetupScene, SetupSceneController, SetupSceneHost, SetupSceneResult
5
5
  export { runStartupSplash } from "./startup-splash.js";
6
6
  export { CURRENT_SETUP_VERSION };
7
7
  /** Ordered onboarding scenes with independent version gates. */
8
- export declare const ALL_SCENES: readonly [SetupScene, SetupScene, SetupScene, SetupScene, SetupScene];
8
+ export declare const ALL_SCENES: readonly [SetupScene, SetupScene, SetupScene, SetupScene, SetupScene, SetupScene];
9
9
  /** Environment and invocation gates for onboarding scene selection. */
10
10
  export interface SetupSceneSelectionOptions {
11
11
  resuming?: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@linxiraos/pi-tui",
4
- "version": "1.4.9",
4
+ "version": "1.4.11",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://linxira-os.github.io/zeta/",
7
7
  "author": "Linxira-OS",
@@ -38,14 +38,14 @@
38
38
  "gen:glyphs": "bun scripts/gen-glyphs.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@linxiraos/pi-omptype": "1.4.9",
42
- "@linxiraos/pi-agent-core": "1.4.9",
43
- "@linxiraos/pi-ai": "1.4.9",
44
- "@linxiraos/pi-catalog": "1.4.9",
45
- "@linxiraos/pi-natives": "1.4.9",
46
- "@linxiraos/pi-utils": "1.4.9",
47
- "@linxiraos/pi-wire": "1.4.9",
48
- "@linxiraos/pi-snapcompact": "1.4.9"
41
+ "@linxiraos/zeta-schema": "1.4.11",
42
+ "@linxiraos/pi-agent-core": "1.4.11",
43
+ "@linxiraos/pi-ai": "1.4.11",
44
+ "@linxiraos/pi-catalog": "1.4.11",
45
+ "@linxiraos/pi-natives": "1.4.11",
46
+ "@linxiraos/pi-utils": "1.4.11",
47
+ "@linxiraos/pi-wire": "1.4.11",
48
+ "@linxiraos/zeta-compact": "1.4.11"
49
49
  },
50
50
  "devDependencies": {
51
51
  "kitty-vt-wasm": "^0.2.0"
@@ -128,6 +128,7 @@ export const TAB_GROUPS: Record<SettingTab, readonly string[]> = {
128
128
  "Startup & Updates",
129
129
  "Power",
130
130
  "Agent",
131
+ "Compatibility",
131
132
  "Git",
132
133
  "Skills",
133
134
  ],
@@ -23,7 +23,7 @@ import {
23
23
  truncateToWidth,
24
24
  visibleWidth,
25
25
  } from "../index";
26
- import type { ShapeTarget } from "@linxiraos/pi-snapcompact";
26
+ import type { ShapeTarget } from "@linxiraos/zeta-compact";
27
27
  import type {
28
28
  ContextLineMode,
29
29
  StatusLinePreset,
@@ -629,6 +629,18 @@ export class SettingsSelectorComponent implements Component {
629
629
  /** Single-line editor backing the search banner (cursor, word ops, paste). */
630
630
  #searchInput = new Input();
631
631
  #searchMatchCount = 0;
632
+ /**
633
+ * Bumped whenever the native page's structure or values may have changed.
634
+ * `#describePrefs` uses it to skip rebuilding hundreds of rows on frames
635
+ * where nothing moved; the terminal patches the same node in place.
636
+ */
637
+ #prefsRevision = 0;
638
+ /**
639
+ * Search text typed since the last frame. Keys can arrive in a burst (a
640
+ * paste, fast typing); ranking every settings tab for each byte makes the
641
+ * page stutter, so the burst is coalesced into one rebuild per frame.
642
+ */
643
+ #pendingSearchQuery: string | null = null;
632
644
  /** First matching item id per tab id, for Tab-key jumps while searching. */
633
645
  #searchFirstMatch = new Map<string, string>();
634
646
  /**
@@ -675,6 +687,7 @@ export class SettingsSelectorComponent implements Component {
675
687
  }
676
688
 
677
689
  invalidate(): void {
690
+ this.#prefsRevision += 1;
678
691
  this.#tabBar.invalidate();
679
692
  this.#currentList?.invalidate();
680
693
  this.#searchList?.invalidate();
@@ -683,12 +696,22 @@ export class SettingsSelectorComponent implements Component {
683
696
 
684
697
  /** Swap the active content (per-tab list, search list, or plugins). */
685
698
  #setContent(build: () => void): void {
699
+ this.#prefsRevision += 1;
686
700
  this.#currentList = null;
687
701
  this.#searchList = null;
688
702
  this.#pluginComponent = null;
689
703
  build();
690
704
  }
691
705
 
706
+ /** Apply search text typed since the last frame, once. */
707
+ #flushSearchQuery(): void {
708
+ const pending = this.#pendingSearchQuery;
709
+ if (pending === null) return;
710
+ this.#pendingSearchQuery = null;
711
+ if (pending.length === 0) this.#endSearch(false);
712
+ else this.#setSearchQuery(pending);
713
+ }
714
+
692
715
  #switchToTab(tabId: SettingTab | "plugins"): void {
693
716
  this.#currentTabId = tabId;
694
717
  this.#setContent(() => {
@@ -737,6 +760,7 @@ export class SettingsSelectorComponent implements Component {
737
760
  * then a footer hint pinned above the bottom border.
738
761
  */
739
762
  render(width: number): readonly string[] {
763
+ this.#flushSearchQuery();
740
764
  const height = Math.max(14, process.stdout.rows || 40);
741
765
  const innerWidth = Math.max(1, width - 4);
742
766
 
@@ -801,6 +825,7 @@ export class SettingsSelectorComponent implements Component {
801
825
  * root card of today's generic composition.
802
826
  */
803
827
  describe(cx: DescribeContext): NativeNode {
828
+ this.#flushSearchQuery();
804
829
  return cx.supports("prefs") ? this.#describePrefs() : this.#describeCard();
805
830
  }
806
831
 
@@ -826,14 +851,45 @@ export class SettingsSelectorComponent implements Component {
826
851
  });
827
852
  pages.push({ id: PLUGINS_PAGE, label: "Installed", icon: "plugins", group: "Plugins" });
828
853
 
829
- let sections: TspPrefsProps["sections"] = [];
830
854
  let focus: string | null = null;
831
855
  let editing: TspPrefsProps["editing"] = null;
832
- const children: NativeChild[] = [];
833
856
  if (pluginPage) {
834
- sections = pluginPage.sections;
835
857
  focus = pluginPage.focus;
836
858
  editing = pluginPage.editing;
859
+ } else if (list) {
860
+ const at = list.prefsFocus();
861
+ focus = at.row ?? (at.section ? prefsSectionId(at.section) : null);
862
+ editing = list.prefsEditing(id => this.#inlineMenu(id));
863
+ }
864
+
865
+ // Rebuilding every row and JSON-stringifying them each frame is what
866
+ // made the page stutter while typing in search. The revision covers
867
+ // every value/list change; focus, editing, the open menu and the search
868
+ // text cover the rest. Only a real change pays for the full build.
869
+ let signature: string | null = null;
870
+ if (!pluginPage) {
871
+ const preview = tab === "appearance" && !searching ? this.#getStatusPreviewString() : "";
872
+ const pageKey = pages.map(page => `${page.id}:${page.changed ?? 0}`).join(",");
873
+ const cursor = searching ? this.#searchInput.getCursor() : -1;
874
+ signature = [
875
+ this.#prefsRevision,
876
+ this.#currentTabId,
877
+ searching ? 1 : 0,
878
+ this.#searchQuery,
879
+ cursor,
880
+ pageKey,
881
+ focus ?? "",
882
+ editing ? JSON.stringify(editing) : "",
883
+ list?.openSubmenu?.id ?? "",
884
+ preview,
885
+ ].join("\u0000");
886
+ if (memo.prefs?.signature === signature) return memo.prefs.node;
887
+ }
888
+
889
+ let sections: TspPrefsProps["sections"] = [];
890
+ const children: NativeChild[] = [];
891
+ if (pluginPage) {
892
+ sections = pluginPage.sections;
837
893
  if (pluginPage.editor) children.push(pluginPage.editor);
838
894
  } else if (list) {
839
895
  sections = list.prefsSections(
@@ -845,9 +901,6 @@ export class SettingsSelectorComponent implements Component {
845
901
  },
846
902
  item => this.#prefsControl(item.id, item.currentValue),
847
903
  );
848
- const at = list.prefsFocus();
849
- focus = at.row ?? (at.section ? prefsSectionId(at.section) : null);
850
- editing = list.prefsEditing(id => this.#inlineMenu(id));
851
904
  const open = list.openSubmenu;
852
905
  if (open && !editing) {
853
906
  // Pickers describe themselves as a sheet; anything else sits in a card over the page.
@@ -889,15 +942,17 @@ export class SettingsSelectorComponent implements Component {
889
942
  focus,
890
943
  editing,
891
944
  };
892
- const signature = JSON.stringify(props);
893
- if (memo.prefs && memo.prefs.signature === signature && sameItems(memo.prefs.children, children)) {
894
- return memo.prefs.node;
945
+ if (signature === null) {
946
+ // The plugin page owns its own structure; keep the structural memo.
947
+ signature = JSON.stringify(props);
948
+ if (memo.prefs && memo.prefs.signature === signature && sameItems(memo.prefs.children, children)) {
949
+ return memo.prefs.node;
950
+ }
895
951
  }
896
952
  const root = node("prefs", props, children);
897
953
  memo.prefs = { signature, children, node: root };
898
954
  return root;
899
955
  }
900
-
901
956
  /** Settings changed from their default on `tab` (visible ones only); cached until the items rebuild. */
902
957
  #changedCount(tab: SettingTab): number {
903
958
  const cached = this.#changedCounts.get(tab);
@@ -1032,6 +1087,10 @@ export class SettingsSelectorComponent implements Component {
1032
1087
  }
1033
1088
  if (list.openSubmenu) list.handleInput(ESCAPE);
1034
1089
  list.selectItem(event.item);
1090
+ // Tern reports a click on the row itself (not its control) as
1091
+ // `select`. A label click is the click users make to open a popup or
1092
+ // a text field, so open the editor the control would have opened.
1093
+ if (this.#opensOnRowClick(event.item)) list.openSubmenuFor(event.item);
1035
1094
  return;
1036
1095
  }
1037
1096
  case "activate":
@@ -1051,6 +1110,31 @@ export class SettingsSelectorComponent implements Component {
1051
1110
  if (id !== this.#currentTabId) this.#tabBar.selectTab(id);
1052
1111
  }
1053
1112
 
1113
+ /**
1114
+ * Rows whose control is a popup, a text field or an action button: a click
1115
+ * on the row's label should open it. Segments, switches, steppers and chip
1116
+ * rows act in place and must not grow a menu from a label click.
1117
+ */
1118
+ #opensOnRowClick(id: string): boolean {
1119
+ const def = getSettingDef(this.#context.settings.entries, id);
1120
+ if (!def) return false;
1121
+ if (def.type === "text" || def.type === "providerLimits") return true;
1122
+ if (def.type === "submenu") {
1123
+ if (numberSteps(def)) return false;
1124
+ const options = this.#submenuOptions(def);
1125
+ return (
1126
+ PREVIEWED_SETTINGS.has(def.path) ||
1127
+ options.some(option => option.description) ||
1128
+ options.length > 4 ||
1129
+ options.reduce((width, option) => width + option.label.length, 0) > 28
1130
+ );
1131
+ }
1132
+ if (def.type === "enum") {
1133
+ return def.values.length > 4 || def.values.reduce((width, value) => width + value.length, 0) > 28;
1134
+ }
1135
+ return false;
1136
+ }
1137
+
1054
1138
  /** A pointer value change on row `id`, through the path its keys take (see {@link #handlePrefsEvent}). */
1055
1139
  #applyPrefsChange(
1056
1140
  list: SettingsList,
@@ -1121,7 +1205,9 @@ export class SettingsSelectorComponent implements Component {
1121
1205
 
1122
1206
  /** Rebuilds the visible items after a change made outside a list's own `onChange` (changed flags, conditions). */
1123
1207
  #refreshItems(): void {
1208
+ this.#prefsRevision += 1;
1124
1209
  if (this.#searchList) {
1210
+ this.#flushSearchQuery();
1125
1211
  this.#searchCorpora = null;
1126
1212
  this.#setSearchQuery(this.#searchQuery);
1127
1213
  } else if (this.#currentTabId !== "plugins")
@@ -1213,6 +1299,8 @@ export class SettingsSelectorComponent implements Component {
1213
1299
  * jump, while searching), unless an open submenu owns the pointer.
1214
1300
  */
1215
1301
  handleNativeEvent(event: NativeUiEvent): void {
1302
+ this.#flushSearchQuery();
1303
+ this.#prefsRevision += 1;
1216
1304
  if (event.key === "") {
1217
1305
  this.#handlePrefsEvent(event);
1218
1306
  return;
@@ -1230,6 +1318,7 @@ export class SettingsSelectorComponent implements Component {
1230
1318
  * activates it (toggle / open submenu).
1231
1319
  */
1232
1320
  #handleMouse(data: string): boolean {
1321
+ this.#flushSearchQuery();
1233
1322
  return routeSgrMouseInput(data, event => this.#routeMouseEvent(event));
1234
1323
  }
1235
1324
 
@@ -1274,6 +1363,7 @@ export class SettingsSelectorComponent implements Component {
1274
1363
  return true;
1275
1364
  }
1276
1365
  if (overContent && list) {
1366
+ this.#prefsRevision += 1;
1277
1367
  const itemId = list.hoverTest(contentLine, innerCol);
1278
1368
  const id = itemId ?? list.hitTest(contentLine, innerCol);
1279
1369
  if (id !== undefined) {
@@ -1292,6 +1382,7 @@ export class SettingsSelectorComponent implements Component {
1292
1382
 
1293
1383
  /** Swap the tab content for the global search result list. */
1294
1384
  #startSearch(initialQuery: string): void {
1385
+ this.#pendingSearchQuery = null;
1295
1386
  this.#preSearchTabId = this.#currentTabId;
1296
1387
  this.#searchCorpora = null;
1297
1388
  this.#searchInput = new Input();
@@ -1325,10 +1416,12 @@ export class SettingsSelectorComponent implements Component {
1325
1416
  */
1326
1417
  #setSearchQuery(query: string): void {
1327
1418
  if (!this.#searchList) return;
1419
+ this.#pendingSearchQuery = null;
1328
1420
  if (query.length === 0) {
1329
1421
  this.#endSearch(false);
1330
1422
  return;
1331
1423
  }
1424
+ this.#prefsRevision += 1;
1332
1425
  this.#searchQuery = query;
1333
1426
  this.#changedCounts.clear();
1334
1427
 
@@ -1390,6 +1483,8 @@ export class SettingsSelectorComponent implements Component {
1390
1483
  */
1391
1484
  #endSearch(jumpToSelection: boolean): void {
1392
1485
  if (!this.#searchList) return;
1486
+ this.#pendingSearchQuery = null;
1487
+ this.#prefsRevision += 1;
1393
1488
  const selected = jumpToSelection ? this.#searchList.getSelectedItem() : undefined;
1394
1489
  const selectedDef = selected ? getSettingDef(this.#context.settings.entries, selected.id) : undefined;
1395
1490
  const targetTab: SettingTab | "plugins" = selectedDef?.tab ?? this.#preSearchTabId;
@@ -1875,6 +1970,7 @@ export class SettingsSelectorComponent implements Component {
1875
1970
  /** Re-evaluate condition gates against the current settings and refresh the active list. */
1876
1971
  #refreshCurrentTabItems(defs: SettingDef[]): void {
1877
1972
  if (this.#currentTabId === "plugins" || !this.#currentList) return;
1973
+ this.#prefsRevision += 1;
1878
1974
  this.#currentList.setItems(this.#buildItemsForDefs(defs));
1879
1975
  }
1880
1976
 
@@ -1917,6 +2013,9 @@ export class SettingsSelectorComponent implements Component {
1917
2013
  this.#handleMouse(data);
1918
2014
  return;
1919
2015
  }
2016
+ this.#flushSearchQuery();
2017
+ // Any key can move the selection, edit a draft or change the search.
2018
+ this.#prefsRevision += 1;
1920
2019
 
1921
2020
  // Text-input submenus take every byte: arrow keys must reach the
1922
2021
  // cursor and Tab must not switch tabs.
@@ -1998,6 +2097,9 @@ export class SettingsSelectorComponent implements Component {
1998
2097
  // cursor movement, word ops, kill ring, undo, paste.
1999
2098
  this.#searchInput.handleInput(data);
2000
2099
  const value = this.#searchInput.getValue();
2001
- if (value !== this.#searchQuery) this.#setSearchQuery(value);
2100
+ if (value !== this.#searchQuery) {
2101
+ this.#pendingSearchQuery = value;
2102
+ this.#context.requestRender?.();
2103
+ }
2002
2104
  }
2003
2105
  }
@@ -27,7 +27,7 @@ import {
27
27
  type ShapeGeometry,
28
28
  type ShapeTarget,
29
29
  type ShapeVariantName,
30
- } from "@linxiraos/pi-snapcompact";
30
+ } from "@linxiraos/zeta-compact";
31
31
  import { theme } from "../theme/theme";
32
32
  import sampleDoc from "./snapcompact-shape-preview-doc.md" with { type: "text" };
33
33
  import type { DescribeContext, NativeNode } from "../native/node";
@@ -0,0 +1,122 @@
1
+ import { type SelectItem, SelectList } from "../../components/select-list";
2
+ import { Text } from "../../components/text";
3
+ import { WizardStep } from "../../components/wizard-step";
4
+ import { getSelectListTheme } from "../../theme/theme";
5
+ import { tuiText } from "../../i18n";
6
+ import { col, span, text } from "../../native/describe";
7
+ import type { NativeNode } from "../../native/node";
8
+ import { Memo } from "../../native/memo";
9
+ import type { SetupLanguage, SetupScene, SetupSceneController, SetupSceneHost } from "./types";
10
+
11
+ /** The two catalogues shipped by the coding agent. Values match `cfgLanguage`. */
12
+ const LANGUAGE_ITEMS: readonly SelectItem[] = [
13
+ { value: "en", label: "English", description: "English interface" },
14
+ { value: "zh", label: "简体中文", description: "Chinese interface" },
15
+ ];
16
+
17
+ class LanguageSceneController implements SetupSceneController {
18
+ get title(): string {
19
+ return tuiText("setupLanguageTitle", "Choose language");
20
+ }
21
+
22
+ get subtitle(): string {
23
+ return tuiText("setupLanguageSubtitle", "Choose the language for the CLI and settings.");
24
+ }
25
+
26
+ readonly #host: SetupSceneHost;
27
+ readonly #selectList: SelectList;
28
+ readonly #native = new Memo();
29
+ #step: WizardStep | undefined;
30
+ #committing = false;
31
+
32
+ constructor(host: SetupSceneHost) {
33
+ this.#host = host;
34
+ this.#selectList = new SelectList(LANGUAGE_ITEMS, LANGUAGE_ITEMS.length, getSelectListTheme());
35
+ const currentIndex = LANGUAGE_ITEMS.findIndex(item => item.value === host.ctx.language);
36
+ this.#selectList.setSelectedIndex(currentIndex >= 0 ? currentIndex : 0);
37
+ this.#selectList.onSelect = item => {
38
+ void this.#commit(item.value as SetupLanguage);
39
+ };
40
+ this.#selectList.onCancel = () => host.finish("skipped");
41
+ }
42
+
43
+ invalidate(): void {
44
+ this.#native.clear();
45
+ if (this.#step) this.#step.invalidate();
46
+ else this.#selectList.invalidate();
47
+ }
48
+
49
+ handleInput(data: string): void {
50
+ if (this.#committing) return;
51
+ if (this.#step) this.#step.handleInput(data);
52
+ else this.#selectList.handleInput(data);
53
+ }
54
+
55
+ routeMouse(event: Parameters<SelectList["routeMouse"]>[0], line: number, col: number): void {
56
+ if (this.#committing) return;
57
+ this.#step?.routeMouse(event, line, col);
58
+ }
59
+
60
+ render(width: number, maxLines?: number): readonly string[] {
61
+ if (!this.#step) {
62
+ this.#step = new WizardStep({
63
+ kind: "choice",
64
+ intro: new Text(
65
+ tuiText("setupLanguageHint", "The choice applies to the rest of onboarding immediately."),
66
+ 0,
67
+ 0,
68
+ ),
69
+ content: this.#selectList,
70
+ minContentLines: LANGUAGE_ITEMS.length,
71
+ fitContent: () => {
72
+ this.#selectList.setMaxVisible(LANGUAGE_ITEMS.length);
73
+ },
74
+ });
75
+ }
76
+ this.#step.setMaxHeight(maxLines);
77
+ return this.#step.render(width);
78
+ }
79
+
80
+ describe(): NativeNode {
81
+ return this.#native.get([this.#selectList], () =>
82
+ col(
83
+ [
84
+ text([
85
+ span(
86
+ tuiText("setupLanguageHint", "The choice applies to the rest of onboarding immediately."),
87
+ "muted",
88
+ ),
89
+ ]),
90
+ this.#selectList,
91
+ ],
92
+ { gap: "sm", role: "zeta.setup.language" },
93
+ ),
94
+ );
95
+ }
96
+
97
+ async #commit(language: SetupLanguage): Promise<void> {
98
+ if (this.#committing) return;
99
+ this.#committing = true;
100
+ try {
101
+ await this.#host.ctx.saveLanguage(language);
102
+ this.#host.ctx.ui.invalidate();
103
+ this.#host.requestRender();
104
+ this.#host.finish("done");
105
+ } catch (error) {
106
+ this.#committing = false;
107
+ this.#host.ctx.showError(`Could not save the language: ${error instanceof Error ? error.message : error}`);
108
+ this.#host.requestRender();
109
+ }
110
+ }
111
+ }
112
+
113
+ /** Pick the UI and settings language before the provider/model scenes run. */
114
+ export const languageSetupScene: SetupScene = {
115
+ id: "language",
116
+ get title(): string {
117
+ return tuiText("setupLanguageTitle", "Choose language");
118
+ },
119
+ step: "Language",
120
+ minVersion: 3,
121
+ mount: host => new LanguageSceneController(host),
122
+ };
@@ -13,6 +13,9 @@ export interface StyledLine {
13
13
  readonly color: ThemeColor;
14
14
  }
15
15
 
16
+ /** Catalogue tag selectable during onboarding. */
17
+ export type SetupLanguage = "en" | "zh";
18
+
16
19
  /** Terminal capabilities used by setup overlays and the startup splash. */
17
20
  export interface SetupUiHost {
18
21
  readonly ui: Pick<TUI, "showOverlay" | "setFocus" | "requestRender" | "invalidate"> & {
@@ -27,6 +30,8 @@ export interface SetupHost extends SetupUiHost {
27
30
  readonly symbolPreset: SymbolPreset;
28
31
  readonly colorBlindMode: boolean;
29
32
  readonly disabledProviders: readonly string[];
33
+ /** Effective UI/settings language; the onboarding language scene starts here. */
34
+ readonly language: SetupLanguage;
30
35
  readonly authStorage: AuthStorage;
31
36
  readonly modelSource: ModelBrowserSource;
32
37
  /** Available and catalog models of every kind; role chips resolve over all of them, rows list chat models. */
@@ -36,6 +41,7 @@ export interface SetupHost extends SetupUiHost {
36
41
  refreshProvider(provider: string): Promise<void>;
37
42
  saveComposerShape(shape: ComposerShape): Promise<void>;
38
43
  saveSymbolPreset(preset: SymbolPreset): void;
44
+ saveLanguage(language: SetupLanguage): Promise<void> | void;
39
45
  saveColorBlindMode(enabled: boolean): void;
40
46
  saveTheme(mode: "dark" | "light", name: string): void;
41
47
  captureBrowserSession(request: OAuthBrowserSessionRequest, signal?: AbortSignal): Promise<string>;
@@ -8,4 +8,4 @@
8
8
  * the overlay component and their TUI deps. MUST equal `max(scene.minVersion)`
9
9
  * across `ALL_SCENES`; the setup scene selection tests guard this invariant.
10
10
  */
11
- export const CURRENT_SETUP_VERSION = 2;
11
+ export const CURRENT_SETUP_VERSION = 3;
@@ -2,6 +2,7 @@ import { CURRENT_SETUP_VERSION } from "./setup-version";
2
2
  import type { SetupHost } from "./scenes/types";
3
3
  import { composerSetupScene } from "./scenes/composer";
4
4
  import { glyphSetupScene } from "./scenes/glyph";
5
+ import { languageSetupScene } from "./scenes/language";
5
6
  import { modelSetupScene } from "./scenes/model";
6
7
  import { providersSetupScene } from "./scenes/sign-in";
7
8
  import { themeSetupScene } from "./scenes/theme";
@@ -15,6 +16,7 @@ export { CURRENT_SETUP_VERSION };
15
16
 
16
17
  /** Ordered onboarding scenes with independent version gates. */
17
18
  export const ALL_SCENES = [
19
+ languageSetupScene,
18
20
  providersSetupScene,
19
21
  modelSetupScene,
20
22
  glyphSetupScene,
@@ -13,7 +13,7 @@
13
13
  * statusLine.attachToEditor(editor, getComposerStyle(shape));
14
14
  * ```
15
15
  */
16
- import { type } from "@linxiraos/pi-omptype";
16
+ import { type } from "@linxiraos/zeta-schema";
17
17
  import type { ThinkingLevel } from "@linxiraos/pi-agent-core";
18
18
  import type { Model } from "@linxiraos/pi-catalog/types";
19
19
  import { parseThinkingLevel } from "../thinking";
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import type { SpinnerFramesOverride } from "./symbols";
3
3
  import type { ThemeJson } from "./schema";
4
4
 
package/src/tools/task.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import type { Usage } from "@linxiraos/pi-ai";
3
3
  import type { ThemeColor } from "../theme/theme";
4
4
  import type { ConfiguredThinkingLevel } from "../render/render-utils";