pi-one-ui 0.3.0 → 0.3.1
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 +13 -1
- package/README.en.md +14 -14
- package/README.md +14 -14
- package/extensions/app/commands/settings-previews.ts +3 -3
- package/extensions/app/config/renderer.ts +7 -6
- package/extensions/app/config/shell.ts +4 -4
- package/extensions/app/overlay/selector-border.ts +5 -5
- package/extensions/app/ownership.ts +1 -1
- package/extensions/app/panel.ts +18 -19
- package/extensions/app/runtime/tui-runtime.ts +31 -31
- package/extensions/features/context-inspector/index.ts +3 -3
- package/extensions/features/session-reference/index.ts +5 -5
- package/extensions/features/subagent-autocomplete.ts +1 -1
- package/extensions/layouts/context/index.ts +9 -12
- package/extensions/layouts/context/renderer/compact-mode.ts +24 -24
- package/extensions/layouts/context/renderer/default-mode.ts +21 -16
- package/extensions/layouts/context/renderer/index.ts +24 -24
- package/extensions/layouts/context/renderer/mouse/hover.ts +6 -6
- package/extensions/layouts/context/renderer/mouse/interaction.ts +35 -35
- package/extensions/layouts/context/renderer/mouse/packets.ts +3 -2
- package/extensions/layouts/context/renderer/mouse/scroll.ts +2 -2
- package/extensions/layouts/context/renderer/tool/diff/diff-component.ts +2 -1
- package/extensions/layouts/context/renderer/tool/diff/diff-edit-render.ts +21 -21
- package/extensions/layouts/context/renderer/tool/diff/diff-header.ts +4 -4
- package/extensions/layouts/context/renderer/tool/diff/diff-highlight.ts +6 -6
- package/extensions/layouts/context/renderer/tool/diff/diff-inline.ts +1 -1
- package/extensions/layouts/context/renderer/tool/diff/diff-layout.ts +18 -18
- package/extensions/layouts/context/renderer/tool/diff/diff-limits.ts +5 -5
- package/extensions/layouts/context/renderer/tool/diff/diff-palette.ts +3 -3
- package/extensions/layouts/context/renderer/tool/diff/diff-presentation.ts +1 -1
- package/extensions/layouts/context/renderer/tool/diff/diff-renderer.ts +2 -1
- package/extensions/layouts/context/renderer/tool/diff/diff-write-render.ts +31 -31
- package/extensions/layouts/context/renderer/tool/diff/index.ts +4 -4
- package/extensions/layouts/context/renderer/tool/diff/line-width-safety.ts +1 -1
- package/extensions/layouts/context/renderer/tool/diff/write-execution.ts +1 -1
- package/extensions/layouts/context/renderer/tool/grouping.ts +12 -12
- package/extensions/layouts/context/renderer/tool/message-display.ts +2 -2
- package/extensions/layouts/context/renderer/tool/result.ts +199 -19
- package/extensions/layouts/context/summary/core.ts +1 -0
- package/extensions/layouts/context/summary/index.ts +3 -3
- package/extensions/layouts/context/thinking/compact-thinking.ts +12 -13
- package/extensions/layouts/editor/accent-rail-editor.ts +5 -5
- package/extensions/layouts/editor/controller.ts +4 -4
- package/extensions/layouts/editor/editor-metadata-format.ts +4 -4
- package/extensions/layouts/editor/factory.ts +3 -3
- package/extensions/layouts/editor/index.ts +7 -7
- package/extensions/layouts/editor/minimalist-editor.ts +1 -1
- package/extensions/layouts/editor/ui.ts +7 -7
- package/extensions/layouts/footer/controller.ts +3 -3
- package/extensions/layouts/footer/footer.ts +21 -21
- package/extensions/layouts/footer/index.ts +8 -8
- package/extensions/layouts/header/index.ts +1 -1
- package/extensions/layouts/header/startup-header.ts +3 -2
- package/extensions/layouts/working-line/controller.ts +6 -6
- package/extensions/services/project-refresh.ts +2 -2
- package/extensions/services/session-state.ts +1 -1
- package/extensions/shared/format.ts +2 -2
- package/package.json +8 -10
- package/extensions/features/legacy/working-message.ts +0 -226
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.1] - 2026-08-31
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Unified the test suite on Vitest and reorganized tests into domain-oriented directories.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Keep `/oneui` open and focused during in-place Editor changes, restore effective values after persistence failures, and position the panel closer to the top.
|
|
18
|
+
- Reduced global tool expansion latency and preserved pi-subagents' dedicated live progress renderer instead of wrapping and grouping it as a generic tool.
|
|
19
|
+
|
|
9
20
|
## [0.3.0] - 2026-08-30
|
|
10
21
|
|
|
11
22
|
### Added
|
|
@@ -34,6 +45,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
34
45
|
|
|
35
46
|
- Reduced rendering lag when expanding settled tool groups by reusing cached child output.
|
|
36
47
|
|
|
37
|
-
[Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.3.
|
|
48
|
+
[Unreleased]: https://github.com/kerolt/pi-one-ui/compare/v0.3.1...HEAD
|
|
49
|
+
[0.3.1]: https://github.com/kerolt/pi-one-ui/compare/v0.3.0...v0.3.1
|
|
38
50
|
[0.3.0]: https://github.com/kerolt/pi-one-ui/compare/v0.2.2...v0.3.0
|
|
39
51
|
[0.2.2]: https://github.com/kerolt/pi-one-ui/compare/v0.2.1...v0.2.2
|
package/README.en.md
CHANGED
|
@@ -39,6 +39,7 @@ Header → Context → WorkingLine → Editor → Footer
|
|
|
39
39
|
| Session reference | Searches previous Pi sessions or SubAgents and injects their useful context | `@` completion |
|
|
40
40
|
| Subagent autocomplete | Completes SubAgent names and delegation hints | `@` completion |
|
|
41
41
|
| Tool / Diff renderer | Provides unified rendering for tool calls, results, collapsed content, and Edit/Write diffs | Automatic |
|
|
42
|
+
| Subagent live renderer | Preserves pi-subagents' dedicated progress cards and keeps them out of generic tool groups | Automatic |
|
|
42
43
|
| Markdown enhancement | Adds Mermaid, admonitions, URL linking, and related rendering improvements | Automatic |
|
|
43
44
|
| Built-in themes | Provides CC Dark and CC Light themes | `/theme` |
|
|
44
45
|
| Compatibility aliases | Optionally provides common command aliases | `/clear`, `/exit` |
|
|
@@ -82,7 +83,7 @@ The configuration file is located at:
|
|
|
82
83
|
~/.pi/agent/pi-one-ui.json
|
|
83
84
|
```
|
|
84
85
|
|
|
85
|
-
Using the `/oneui` settings panel is recommended. The current configuration uses the v1 structure, for example:
|
|
86
|
+
Using the `/oneui` settings panel is recommended. The panel uses a top-centered layout, stays open while Editor enablement or style changes are applied, restores focus after Editor replacement, and restores the effective list value when persistence fails. The current configuration uses the v1 structure, for example:
|
|
86
87
|
|
|
87
88
|
```json
|
|
88
89
|
{
|
|
@@ -181,14 +182,12 @@ After changing the source, run the following command in Pi:
|
|
|
181
182
|
| --- | --- |
|
|
182
183
|
| `npm install` | Install dependencies |
|
|
183
184
|
| `npm run format` | Format source, tests, and configuration files |
|
|
184
|
-
| `npm run
|
|
185
|
-
| `npm run
|
|
185
|
+
| `npm run check` | Check formatting and import organization |
|
|
186
|
+
| `npm run fix` | Fix formatting and organize imports |
|
|
186
187
|
| `npm run typecheck` | Run TypeScript type checking |
|
|
187
|
-
| `npm test` | Run all tests |
|
|
188
|
-
| `npm run test:node` | Run Node.js test runner tests |
|
|
189
|
-
| `npm run test:vitest` | Run Vitest tests |
|
|
188
|
+
| `npm test` | Run all tests with Vitest |
|
|
190
189
|
| `npm run pack:check` | Preview the npm package contents |
|
|
191
|
-
| `npm run verify` | Run
|
|
190
|
+
| `npm run verify` | Run Biome checks, type checking, and all tests |
|
|
192
191
|
|
|
193
192
|
Before submitting changes, run at least:
|
|
194
193
|
|
|
@@ -199,14 +198,15 @@ npm run pack:check
|
|
|
199
198
|
|
|
200
199
|
### Test organization
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
All tests run through Vitest and are organized into domain directories:
|
|
203
202
|
|
|
204
|
-
- `tests/
|
|
205
|
-
- `tests/
|
|
206
|
-
- `tests/editor
|
|
207
|
-
- `tests/
|
|
208
|
-
- `tests/services
|
|
209
|
-
- `tests/shell
|
|
203
|
+
- `tests/config/`: canonical configuration, storage, and compatibility boundaries.
|
|
204
|
+
- `tests/context/`: Context content, tools, diffs, thinking, and mouse interaction.
|
|
205
|
+
- `tests/header/`, `tests/working-line/`, `tests/editor/`, and `tests/footer/`: Layout behavior and lifecycle coverage.
|
|
206
|
+
- `tests/runtime/`, `tests/overlay/`, and `tests/integration/`: runtime infrastructure, overlays, and the composed entry point.
|
|
207
|
+
- `tests/services/`: Git, runtime, project, session, and telemetry data.
|
|
208
|
+
- `tests/shell/`: remaining layout lifecycle glue and standalone compatibility.
|
|
209
|
+
- `tests/support/` and `tests/fixtures/`: shared test helpers and fixtures.
|
|
210
210
|
|
|
211
211
|
Changes involving the TUI lifecycle should specifically cover reloads, session tree rebuilds, compaction, regular/fullscreen TUI modes, headless mode, overlays, and third-party patch ownership.
|
|
212
212
|
|
package/README.md
CHANGED
|
@@ -39,6 +39,7 @@ Header → Context → WorkingLine → Editor → Footer
|
|
|
39
39
|
| Session reference | 搜索并注入历史 Pi session 或 SubAgent 的有效上下文 | `@` 补全 |
|
|
40
40
|
| Subagent autocomplete | 提供 SubAgent 名称补全和委派提示 | `@` 补全 |
|
|
41
41
|
| Tool / Diff renderer | 工具调用、结果、折叠内容和 Edit/Write diff 的统一展示 | 自动生效 |
|
|
42
|
+
| Subagent live renderer | 保留 pi-subagents 专用进度卡,并避免纳入通用工具分组 | 自动生效 |
|
|
42
43
|
| Markdown enhancement | 支持 Mermaid、提示框和 URL 链接化等增强渲染 | 自动生效 |
|
|
43
44
|
| Built-in themes | 提供 CC Dark 和 CC Light 主题 | `/theme` |
|
|
44
45
|
| Compatibility aliases | 可选提供常用命令别名 | `/clear`、`/exit` |
|
|
@@ -82,7 +83,7 @@ pi install git:github.com/kerolt/pi-one-ui
|
|
|
82
83
|
~/.pi/agent/pi-one-ui.json
|
|
83
84
|
```
|
|
84
85
|
|
|
85
|
-
推荐通过 `/oneui`
|
|
86
|
+
推荐通过 `/oneui` 设置面板修改配置。面板采用更靠近顶部的居中布局;切换 Editor 启用状态或样式时会保持打开并在 Editor 替换后恢复焦点,持久化失败时则恢复列表中的有效旧值。当前配置仍使用 v1 结构,例如:
|
|
86
87
|
|
|
87
88
|
```json
|
|
88
89
|
{
|
|
@@ -181,14 +182,12 @@ npm run pi:install-local
|
|
|
181
182
|
| ---------------------- | ---------------------------------- |
|
|
182
183
|
| `npm install` | 安装依赖 |
|
|
183
184
|
| `npm run format` | 格式化源码、测试和配置文件 |
|
|
184
|
-
| `npm run
|
|
185
|
-
| `npm run
|
|
185
|
+
| `npm run check` | 检查格式和 import organization |
|
|
186
|
+
| `npm run fix` | 修复格式并整理 imports |
|
|
186
187
|
| `npm run typecheck` | 执行 TypeScript 类型检查 |
|
|
187
|
-
| `npm test` | 运行全部测试
|
|
188
|
-
| `npm run test:node` | 运行 Node.js test runner 测试 |
|
|
189
|
-
| `npm run test:vitest` | 运行 Vitest 测试 |
|
|
188
|
+
| `npm test` | 使用 Vitest 运行全部测试 |
|
|
190
189
|
| `npm run pack:check` | 预览 npm 实际打包内容 |
|
|
191
|
-
| `npm run verify` |
|
|
190
|
+
| `npm run verify` | 执行 Biome check、类型检查和全部测试 |
|
|
192
191
|
|
|
193
192
|
提交修改前建议至少运行:
|
|
194
193
|
|
|
@@ -199,14 +198,15 @@ npm run pack:check
|
|
|
199
198
|
|
|
200
199
|
### 测试组织
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
所有测试统一由 Vitest 执行,并按照功能领域组织在子目录中:
|
|
203
202
|
|
|
204
|
-
- `tests/
|
|
205
|
-
- `tests/
|
|
206
|
-
- `tests/editor
|
|
207
|
-
- `tests/
|
|
208
|
-
- `tests/services
|
|
209
|
-
- `tests/shell
|
|
203
|
+
- `tests/config/`:canonical 配置、存储和兼容性边界。
|
|
204
|
+
- `tests/context/`:Context 内容区、Tool、Diff、Thinking 和鼠标交互。
|
|
205
|
+
- `tests/header/`、`tests/working-line/`、`tests/editor/`、`tests/footer/`:各 Layout 的行为和生命周期。
|
|
206
|
+
- `tests/runtime/`、`tests/overlay/`、`tests/integration/`:运行时基础设施、Overlay 和组合入口。
|
|
207
|
+
- `tests/services/`:Git、runtime、project、session 和 telemetry。
|
|
208
|
+
- `tests/shell/`:剩余布局生命周期 glue 和 standalone compatibility。
|
|
209
|
+
- `tests/support/`、`tests/fixtures/`:共享测试工具和 fixtures。
|
|
210
210
|
|
|
211
211
|
涉及 TUI 生命周期的修改,应特别覆盖 reload、session tree rebuild、compact、regular/fullscreen TUI、headless mode、overlay 和第三方 patch ownership 等场景。
|
|
212
212
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
3
|
+
import { renderUserMessageStyle } from "../../layouts/context/message/user-message-styles.ts";
|
|
3
4
|
import { renderAccentRailEditorFrame } from "../../layouts/editor/accent-rail-editor.ts";
|
|
4
|
-
import type { PolishedTuiConfig } from "../config/shell.ts";
|
|
5
5
|
import { sanitizeEditorMetadataText } from "../../layouts/editor/editor-metadata-format.ts";
|
|
6
6
|
import { renderMinimalistFrame } from "../../layouts/editor/minimalist-editor.ts";
|
|
7
|
-
import { safeThemeFg } from "../../shared/style.ts";
|
|
8
7
|
import { renderPolishedEditorFrame } from "../../layouts/editor/ui.ts";
|
|
9
|
-
import {
|
|
8
|
+
import { safeThemeFg } from "../../shared/style.ts";
|
|
9
|
+
import type { PolishedTuiConfig } from "../config/shell.ts";
|
|
10
10
|
|
|
11
11
|
export const SETTINGS_PREVIEW_MAX_WIDTH = 72;
|
|
12
12
|
export const SETTINGS_PREVIEW_MAX_ROWS = 10;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompactThinkingConfig } from "../../layouts/context/thinking/compact-thinking.ts";
|
|
2
|
-
import {
|
|
2
|
+
import { type ConfigRecord, configStore } from "./store.ts";
|
|
3
3
|
|
|
4
4
|
export type CompactStyleMode = "on" | "compact" | "off";
|
|
5
5
|
|
|
@@ -371,17 +371,18 @@ function loadConfig(): Config {
|
|
|
371
371
|
/**
|
|
372
372
|
* Persists the in-memory renderer projection through the shared store.
|
|
373
373
|
*/
|
|
374
|
-
export function saveConfig() {
|
|
374
|
+
export function saveConfig(next: Config = config) {
|
|
375
375
|
configStore.update((record) => {
|
|
376
376
|
record.version = 1;
|
|
377
|
-
record.renderer =
|
|
377
|
+
record.renderer = next;
|
|
378
378
|
});
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
/**
|
|
381
|
+
/** 运行时配置写入的唯一入口:规范化并持久化成功后再提交到活动配置。 */
|
|
382
382
|
export function updateConfig(partial: Partial<Config>): void {
|
|
383
|
-
|
|
384
|
-
saveConfig();
|
|
383
|
+
const next = normalizeConfig({ ...config, ...partial });
|
|
384
|
+
saveConfig(next);
|
|
385
|
+
Object.assign(config, next);
|
|
385
386
|
}
|
|
386
387
|
|
|
387
388
|
/** 整体替换配置(default export 的 configOverride 注入路径;就地覆盖,不持久化)。 */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { normalizeWorkingLineMessages } from "../../layouts/working-line/working-line.ts";
|
|
2
|
+
import { PI_WORKING_LINE_MESSAGES } from "../../layouts/working-line/working-line-messages.ts";
|
|
1
3
|
import {
|
|
2
4
|
ICON_GLYPH_KEYS,
|
|
3
5
|
type IconGlyphs,
|
|
@@ -8,13 +10,11 @@ import {
|
|
|
8
10
|
resolveConfiguredIcons,
|
|
9
11
|
} from "../../shared/icons.ts";
|
|
10
12
|
import { isSupportedColorSpec } from "../../shared/style.ts";
|
|
11
|
-
import { normalizeWorkingLineMessages } from "../../layouts/working-line/working-line.ts";
|
|
12
|
-
import { PI_WORKING_LINE_MESSAGES } from "../../layouts/working-line/working-line-messages.ts";
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
type ConfigRecord,
|
|
15
15
|
configStore,
|
|
16
|
+
configPath as defaultConfigPath,
|
|
16
17
|
mutateConfigFile,
|
|
17
|
-
type ConfigRecord,
|
|
18
18
|
} from "./store.ts";
|
|
19
19
|
|
|
20
20
|
export type ColorSpec = string;
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
SettingsSelectorComponent,
|
|
4
4
|
type Theme,
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
|
-
import type { ZentuiConfig } from "../config/shell.ts";
|
|
7
|
-
import {
|
|
8
|
-
installPrototypePatch,
|
|
9
|
-
removePrototypePatch,
|
|
10
|
-
} from "../ownership/prototype-patch-registry.ts";
|
|
11
6
|
import {
|
|
12
7
|
EDITOR_BORDER_STYLE,
|
|
13
8
|
renderChromeBorder,
|
|
14
9
|
renderEditorBorder,
|
|
15
10
|
} from "../../shared/style.ts";
|
|
11
|
+
import type { ZentuiConfig } from "../config/shell.ts";
|
|
12
|
+
import {
|
|
13
|
+
installPrototypePatch,
|
|
14
|
+
removePrototypePatch,
|
|
15
|
+
} from "../ownership/prototype-patch-registry.ts";
|
|
16
16
|
|
|
17
17
|
type PatchableSelectorPrototype = {
|
|
18
18
|
render: (width: number) => string[];
|
package/extensions/app/panel.ts
CHANGED
|
@@ -413,6 +413,13 @@ function saveNotice(ctx: any, label: string, value: string): void {
|
|
|
413
413
|
);
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
+
function notifyUpdateError(ctx: any, error: unknown): void {
|
|
417
|
+
ctx.ui?.notify?.(
|
|
418
|
+
`Could not update /oneui setting: ${error instanceof Error ? error.message : String(error)}`,
|
|
419
|
+
"error",
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
|
|
416
423
|
/**
|
|
417
424
|
* Persists one panel setting and reconciles its owning runtime layout.
|
|
418
425
|
*
|
|
@@ -605,27 +612,19 @@ export async function showOneUiPanel(
|
|
|
605
612
|
10,
|
|
606
613
|
getSettingsListTheme(),
|
|
607
614
|
(id, value) => {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
`Could not update Editor setting: ${error instanceof Error ? error.message : String(error)}`,
|
|
618
|
-
"error",
|
|
619
|
-
);
|
|
620
|
-
} finally {
|
|
615
|
+
try {
|
|
616
|
+
updateSetting(id, value, ctx, deps);
|
|
617
|
+
list.updateValue(id, value);
|
|
618
|
+
} catch (error) {
|
|
619
|
+
notifyUpdateError(ctx, error);
|
|
620
|
+
createList();
|
|
621
|
+
list.selectItem(id);
|
|
622
|
+
} finally {
|
|
623
|
+
if (id === "editorEnabled" || id === "editorStyle") {
|
|
621
624
|
panelHandle?.focus();
|
|
622
|
-
tui.requestRender();
|
|
623
625
|
}
|
|
624
|
-
|
|
626
|
+
tui.requestRender();
|
|
625
627
|
}
|
|
626
|
-
updateSetting(id, value, ctx, deps);
|
|
627
|
-
list.updateValue(id, value);
|
|
628
|
-
tui.requestRender();
|
|
629
628
|
},
|
|
630
629
|
() => done(undefined),
|
|
631
630
|
);
|
|
@@ -687,7 +686,7 @@ export async function showOneUiPanel(
|
|
|
687
686
|
width: "85%",
|
|
688
687
|
maxHeight: "90%",
|
|
689
688
|
margin: {
|
|
690
|
-
top:
|
|
689
|
+
top: 6,
|
|
691
690
|
right: 1,
|
|
692
691
|
bottom: 1,
|
|
693
692
|
left: 1,
|
|
@@ -3,56 +3,56 @@ import type {
|
|
|
3
3
|
ExtensionContext,
|
|
4
4
|
Theme,
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "
|
|
11
|
-
import { createPiUiPort, type PiUiPort } from "../host/pi-ui-port.ts";
|
|
12
|
-
import { LayoutRegistry } from "../ownership/layout-registry.ts";
|
|
13
|
-
import registerHeaderLayout from "../../layouts/header/index.ts";
|
|
14
|
-
import { EventCoordinator } from "./event-coordinator.ts";
|
|
15
|
-
import { RenderScheduler } from "./render-scheduler.ts";
|
|
16
|
-
import { RuntimeStateStore } from "./runtime-state.ts";
|
|
6
|
+
import registerContext, {
|
|
7
|
+
type ContextExtensionOptions,
|
|
8
|
+
type ContextRuntimeController,
|
|
9
|
+
} from "../../layouts/context/index.ts";
|
|
10
|
+
import type { AccentRailLayoutPatchDiagnostic } from "../../layouts/editor/accent-rail-layout-patch.ts";
|
|
17
11
|
import { EditorLayoutController } from "../../layouts/editor/controller.ts";
|
|
18
12
|
import { FooterLayoutController } from "../../layouts/footer/controller.ts";
|
|
13
|
+
import registerHeaderLayout from "../../layouts/header/index.ts";
|
|
19
14
|
import {
|
|
20
15
|
WorkingLineLayoutController,
|
|
21
16
|
type WorkingLineMessage,
|
|
22
17
|
type WorkingLineMessageEnd,
|
|
23
18
|
} from "../../layouts/working-line/controller.ts";
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "../../layouts/
|
|
28
|
-
import
|
|
19
|
+
import {
|
|
20
|
+
renderTurnSummaryEntry,
|
|
21
|
+
TURN_SUMMARY_ENTRY_TYPE,
|
|
22
|
+
} from "../../layouts/working-line/interaction-summary.ts";
|
|
23
|
+
import { LiveContextController } from "../../services/live-context.ts";
|
|
24
|
+
import {
|
|
25
|
+
ProjectRefreshService,
|
|
26
|
+
type ScheduleProjectRefreshOptions,
|
|
27
|
+
} from "../../services/project-refresh.ts";
|
|
28
|
+
import {
|
|
29
|
+
SessionStateService,
|
|
30
|
+
syncState,
|
|
31
|
+
} from "../../services/session-state.ts";
|
|
32
|
+
import { resolveFooterTelemetry } from "../../services/telemetry.ts";
|
|
29
33
|
import {
|
|
30
34
|
ensureConfigExists,
|
|
31
35
|
hasUnsupportedComponentStyle,
|
|
32
36
|
loadConfig,
|
|
33
37
|
mergeConfig,
|
|
38
|
+
type PolishedTuiConfig,
|
|
34
39
|
saveEditorComponentPatch,
|
|
35
40
|
saveFooterComponentPatch,
|
|
36
41
|
saveWorkingLineComponentPatch,
|
|
37
|
-
type PolishedTuiConfig,
|
|
38
42
|
} from "../config/shell.ts";
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
SessionStateService,
|
|
42
|
-
syncState,
|
|
43
|
-
} from "../../services/session-state.ts";
|
|
44
|
-
import {
|
|
45
|
-
renderTurnSummaryEntry,
|
|
46
|
-
TURN_SUMMARY_ENTRY_TYPE,
|
|
47
|
-
} from "../../layouts/working-line/interaction-summary.ts";
|
|
48
|
-
import { LiveContextController } from "../../services/live-context.ts";
|
|
43
|
+
import { type ConfigRecord, configStore } from "../config/store.ts";
|
|
49
44
|
import {
|
|
50
|
-
|
|
51
|
-
type
|
|
52
|
-
} from "
|
|
45
|
+
createPiExtensionPort,
|
|
46
|
+
type PiExtensionPort,
|
|
47
|
+
} from "../host/pi-extension-port.ts";
|
|
48
|
+
import { createPiUiPort, type PiUiPort } from "../host/pi-ui-port.ts";
|
|
53
49
|
import { SelectorController } from "../overlay/selector-controller.ts";
|
|
50
|
+
import { LayoutRegistry } from "../ownership/layout-registry.ts";
|
|
51
|
+
import { showOneUiPanel, type TuiPanelRuntime } from "../panel.ts";
|
|
52
|
+
import { EventCoordinator } from "./event-coordinator.ts";
|
|
53
|
+
import { RenderScheduler } from "./render-scheduler.ts";
|
|
54
|
+
import { RuntimeStateStore } from "./runtime-state.ts";
|
|
54
55
|
import { SessionLifecycle } from "./session-lifecycle.ts";
|
|
55
|
-
import { resolveFooterTelemetry } from "../../services/telemetry.ts";
|
|
56
56
|
|
|
57
57
|
export type TuiRuntimeContext = {
|
|
58
58
|
readonly extensions: PiExtensionPort;
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
type BuildSystemPromptOptions,
|
|
3
3
|
type ExtensionAPI,
|
|
4
4
|
type ExtensionCommandContext,
|
|
5
|
-
type ToolInfo,
|
|
6
5
|
estimateTokens,
|
|
7
6
|
formatSkillsForPrompt,
|
|
8
7
|
getMarkdownTheme,
|
|
8
|
+
type ToolInfo,
|
|
9
9
|
} from "@earendil-works/pi-coding-agent";
|
|
10
10
|
import {
|
|
11
11
|
Key,
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
matchesKey,
|
|
14
14
|
visibleWidth,
|
|
15
15
|
} from "@earendil-works/pi-tui";
|
|
16
|
-
import { mouseBaseButton, parseSgrMousePacket } from "../../tools/sgr-mouse.ts";
|
|
17
|
-
import { padLine } from "../../tools/format.ts";
|
|
18
16
|
import { overlayManager } from "../../app/overlay/overlay-manager.ts";
|
|
17
|
+
import { padLine } from "../../tools/format.ts";
|
|
18
|
+
import { mouseBaseButton, parseSgrMousePacket } from "../../tools/sgr-mouse.ts";
|
|
19
19
|
|
|
20
20
|
export type ContextPart = {
|
|
21
21
|
label: string;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
2
|
import {
|
|
3
|
-
SessionManager,
|
|
4
3
|
type ExtensionAPI,
|
|
5
4
|
type SessionInfo,
|
|
5
|
+
SessionManager,
|
|
6
6
|
} from "@earendil-works/pi-coding-agent";
|
|
7
7
|
import {
|
|
8
|
-
Text,
|
|
9
8
|
type AutocompleteItem,
|
|
10
9
|
type AutocompleteProvider,
|
|
11
10
|
type AutocompleteSuggestions,
|
|
12
11
|
fuzzyFilter,
|
|
12
|
+
Text,
|
|
13
13
|
} from "@earendil-works/pi-tui";
|
|
14
14
|
import {
|
|
15
|
-
SESSION_REFERENCE_CUSTOM_TYPE,
|
|
16
|
-
SESSION_REFERENCE_PREFIX,
|
|
17
15
|
buildReferenceContentFromSections,
|
|
18
16
|
extractSessionReferenceIds,
|
|
19
17
|
formatReferenceSession,
|
|
20
|
-
sessionTitle,
|
|
21
18
|
type ReferenceSessionInfo,
|
|
22
19
|
type ReferenceSource,
|
|
20
|
+
SESSION_REFERENCE_CUSTOM_TYPE,
|
|
21
|
+
SESSION_REFERENCE_PREFIX,
|
|
22
|
+
sessionTitle,
|
|
23
23
|
} from "./session.ts";
|
|
24
24
|
|
|
25
25
|
const MAX_SESSION_SUGGESTIONS = 3;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
2
|
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
4
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import {
|
|
6
6
|
type AutocompleteItem,
|
|
@@ -4,7 +4,6 @@ import type {
|
|
|
4
4
|
Theme,
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { config } from "../../app/config/renderer.ts";
|
|
7
|
-
import { configStore, type ConfigRecord } from "../../app/config/store.ts";
|
|
8
7
|
import {
|
|
9
8
|
hasUnsupportedComponentStyle,
|
|
10
9
|
loadConfig,
|
|
@@ -13,27 +12,25 @@ import {
|
|
|
13
12
|
type UserMessagesComponentConfig,
|
|
14
13
|
type ZentuiConfig,
|
|
15
14
|
} from "../../app/config/shell.ts";
|
|
16
|
-
import {
|
|
17
|
-
installUserMessageStyle,
|
|
18
|
-
removeUserMessageStyle,
|
|
19
|
-
} from "./message/user-message.ts";
|
|
20
|
-
|
|
15
|
+
import { type ConfigRecord, configStore } from "../../app/config/store.ts";
|
|
21
16
|
// shell
|
|
22
17
|
import piAliases from "../../features/aliases.ts";
|
|
18
|
+
import context from "../../features/context-inspector/index.ts";
|
|
23
19
|
import { installFlushDockedBash } from "../../features/flush-docked-bash.ts";
|
|
24
|
-
|
|
20
|
+
import sessionReference from "../../features/session-reference/index.ts";
|
|
25
21
|
// feature
|
|
26
22
|
import agentAutocomplete from "../../features/subagent-autocomplete.ts";
|
|
27
|
-
import
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
import {
|
|
24
|
+
installUserMessageStyle,
|
|
25
|
+
removeUserMessageStyle,
|
|
26
|
+
} from "./message/user-message.ts";
|
|
32
27
|
// renderer
|
|
33
28
|
import registerContextRenderer, {
|
|
34
29
|
getCompactThinkingConfig,
|
|
35
30
|
} from "./renderer/index.ts";
|
|
36
31
|
import markdownEnhance from "./renderer/markdown-enhance.ts";
|
|
32
|
+
import agentSummary from "./summary/index.ts";
|
|
33
|
+
import { installCompactThinking } from "./thinking/compact-thinking.ts";
|
|
37
34
|
|
|
38
35
|
export type ContextRuntimeController = {
|
|
39
36
|
setMode: (mode: "on" | "compact" | "off", ctx: ExtensionContext) => void;
|
|
@@ -17,41 +17,22 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import {
|
|
19
19
|
AssistantMessageComponent,
|
|
20
|
-
ToolExecutionComponent,
|
|
21
20
|
type Theme,
|
|
21
|
+
ToolExecutionComponent,
|
|
22
22
|
} from "@earendil-works/pi-coding-agent";
|
|
23
23
|
import {
|
|
24
|
-
truncateToWidth,
|
|
25
|
-
visibleWidth,
|
|
26
24
|
Box,
|
|
27
25
|
Spacer,
|
|
26
|
+
truncateToWidth,
|
|
27
|
+
visibleWidth,
|
|
28
28
|
} from "@earendil-works/pi-tui";
|
|
29
29
|
import { config, getToolDisplayConfig } from "../../../app/config/renderer.ts";
|
|
30
|
-
import { toolLoadingIcon } from "../../../tools/tool-loading-icon.ts";
|
|
31
|
-
import { sanitizeToolResultText } from "../../../tools/tool-result-sanitize.ts";
|
|
32
|
-
import { refreshContextComponent } from "./context-refresh.ts";
|
|
33
|
-
import { getMessageDisplayTheme } from "./tool/message-display.ts";
|
|
34
|
-
import { showMoreHintText } from "./tool/show-more-hint.ts";
|
|
35
|
-
import {
|
|
36
|
-
countEditDiffStats,
|
|
37
|
-
countWriteDiffStats,
|
|
38
|
-
isRichDiffComponent,
|
|
39
|
-
} from "./tool/diff/diff-renderer.ts";
|
|
40
|
-
import { renderRichToolResult } from "./tool/diff/index.ts";
|
|
41
|
-
import type { WriteExecutionMetadataStore } from "./tool/diff/write-execution.ts";
|
|
42
|
-
import { isToolCallHovered } from "./mouse/hover.ts";
|
|
43
|
-
import {
|
|
44
|
-
insetComponent,
|
|
45
|
-
renderExpandedToolResult,
|
|
46
|
-
scheduleAnimation,
|
|
47
|
-
} from "./tool/result.ts";
|
|
48
|
-
import { oneLine } from "../../../tools/format.ts";
|
|
49
|
-
import { paddedBackgroundRow } from "./tool/grouping.ts";
|
|
50
30
|
import {
|
|
51
31
|
hasVisibleText,
|
|
52
32
|
stripBackgroundAnsi,
|
|
53
33
|
} from "../../../tools/ansi-text.ts";
|
|
54
34
|
import { walkComponentTree } from "../../../tools/component-tree.ts";
|
|
35
|
+
import { oneLine } from "../../../tools/format.ts";
|
|
55
36
|
import {
|
|
56
37
|
ASSISTANT_REENTRY_DESCRIPTION,
|
|
57
38
|
ASSISTANT_REENTRY_KEY,
|
|
@@ -61,9 +42,28 @@ import {
|
|
|
61
42
|
ASSISTANT_TOGGLE_ROUND_KEY,
|
|
62
43
|
COMPACT_MODE_PATCH_KEY,
|
|
63
44
|
COMPACT_THINKING_PATCH_KEY,
|
|
64
|
-
patchRegistry,
|
|
65
45
|
PROTOTYPE_ORIGINAL_KEY,
|
|
46
|
+
patchRegistry,
|
|
66
47
|
} from "../../../tools/patch-keys.ts";
|
|
48
|
+
import { toolLoadingIcon } from "../../../tools/tool-loading-icon.ts";
|
|
49
|
+
import { sanitizeToolResultText } from "../../../tools/tool-result-sanitize.ts";
|
|
50
|
+
import { refreshContextComponent } from "./context-refresh.ts";
|
|
51
|
+
import { isToolCallHovered } from "./mouse/hover.ts";
|
|
52
|
+
import {
|
|
53
|
+
countEditDiffStats,
|
|
54
|
+
countWriteDiffStats,
|
|
55
|
+
isRichDiffComponent,
|
|
56
|
+
} from "./tool/diff/diff-renderer.ts";
|
|
57
|
+
import { renderRichToolResult } from "./tool/diff/index.ts";
|
|
58
|
+
import type { WriteExecutionMetadataStore } from "./tool/diff/write-execution.ts";
|
|
59
|
+
import { paddedBackgroundRow } from "./tool/grouping.ts";
|
|
60
|
+
import { getMessageDisplayTheme } from "./tool/message-display.ts";
|
|
61
|
+
import {
|
|
62
|
+
insetComponent,
|
|
63
|
+
renderExpandedToolResult,
|
|
64
|
+
scheduleAnimation,
|
|
65
|
+
} from "./tool/result.ts";
|
|
66
|
+
import { showMoreHintText } from "./tool/show-more-hint.ts";
|
|
67
67
|
|
|
68
68
|
/** compact 渲染层对 compact-thinking 的只读查询面(不建第二套计时器)。 */
|
|
69
69
|
export type CompactThinkingQuery = {
|