pi-one-ui 0.5.1 → 0.6.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 +25 -1
- package/README.en.md +59 -44
- package/README.md +60 -46
- package/extensions/app/config/panel.ts +117 -0
- package/extensions/app/config/renderer.ts +4 -0
- package/extensions/app/config/shell.ts +5 -111
- package/extensions/app/overlay/selector-border.ts +6 -5
- package/extensions/app/panel.ts +20 -34
- package/extensions/app/runtime/tui-runtime.ts +0 -1
- package/extensions/features/effort-command.ts +79 -0
- package/extensions/layouts/context/index.ts +4 -0
- package/extensions/layouts/context/message/user-message-styles.ts +6 -13
- package/extensions/layouts/editor/editor-metadata-format.ts +4 -8
- package/extensions/layouts/editor/minimalist-editor.ts +20 -73
- package/extensions/layouts/editor/ui.ts +4 -11
- package/extensions/layouts/footer/footer.ts +32 -122
- package/extensions/layouts/working-line/controller.ts +0 -1
- package/extensions/layouts/working-line/interaction-summary.ts +1 -3
- package/extensions/layouts/working-line/working-line.ts +8 -22
- package/extensions/shared/format.ts +6 -20
- package/extensions/shared/style.ts +37 -110
- package/package.json +1 -1
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
} from "./store.ts";
|
|
19
19
|
|
|
20
20
|
export type ColorSpec = string;
|
|
21
|
-
export type ColorSource = "theme" | "terminal";
|
|
22
21
|
export type { IconMode } from "../../shared/icons.ts";
|
|
23
22
|
|
|
24
23
|
export type ContextStyle = "text" | "gauge" | "text+gauge";
|
|
@@ -70,12 +69,6 @@ export type GitBranchConfig = {
|
|
|
70
69
|
maxLength: GitBranchMaxLength;
|
|
71
70
|
};
|
|
72
71
|
|
|
73
|
-
export type ColorSourcesConfig = {
|
|
74
|
-
starship: ColorSource;
|
|
75
|
-
editor: ColorSource;
|
|
76
|
-
userMessages: ColorSource;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
72
|
export type UiFeaturesConfig = {
|
|
80
73
|
editor: boolean;
|
|
81
74
|
statusLine: boolean;
|
|
@@ -119,7 +112,6 @@ export type EditorStylesConfig = {
|
|
|
119
112
|
|
|
120
113
|
export type EditorComponentConfig = {
|
|
121
114
|
style: EditorStyle;
|
|
122
|
-
colorSource: ColorSource;
|
|
123
115
|
borderColorMode: EditorBorderColorMode;
|
|
124
116
|
modelLabel: ModelLabelSource;
|
|
125
117
|
viewportIndicators: boolean;
|
|
@@ -136,7 +128,6 @@ export type LabeledUserMessageStyleConfig = Record<string, never>;
|
|
|
136
128
|
export type UserMessagesComponentConfig = {
|
|
137
129
|
enabled: boolean;
|
|
138
130
|
style: UserMessageStyle;
|
|
139
|
-
colorSource: ColorSource;
|
|
140
131
|
styles: {
|
|
141
132
|
framed: FramedUserMessageStyleConfig;
|
|
142
133
|
"framed-copy-friendly": FramedCopyFriendlyUserMessageStyleConfig;
|
|
@@ -148,7 +139,6 @@ export type UserMessagesComponentConfig = {
|
|
|
148
139
|
export type SelectorBordersComponentConfig = {
|
|
149
140
|
enabled: boolean;
|
|
150
141
|
style: SelectorBorderStyle;
|
|
151
|
-
colorSource: ColorSource;
|
|
152
142
|
};
|
|
153
143
|
|
|
154
144
|
export type StarshipFooterStyleConfig = {
|
|
@@ -169,7 +159,6 @@ export type StarshipFooterStyleConfig = {
|
|
|
169
159
|
|
|
170
160
|
export type FooterComponentConfig = {
|
|
171
161
|
style: FooterStyle;
|
|
172
|
-
colorSource: ColorSource;
|
|
173
162
|
modelLabel: ModelLabelSource;
|
|
174
163
|
styles: {
|
|
175
164
|
starship: StarshipFooterStyleConfig;
|
|
@@ -210,7 +199,6 @@ export type WorkingLineComponentConfig = {
|
|
|
210
199
|
animateSpinnerColor: boolean;
|
|
211
200
|
textIntervalMs: number;
|
|
212
201
|
textAnimation: WorkingLineTextAnimation;
|
|
213
|
-
colorSource: ColorSource;
|
|
214
202
|
messages: WorkingLineMessagesConfig;
|
|
215
203
|
segments: WorkingLineSegmentsConfig;
|
|
216
204
|
};
|
|
@@ -326,7 +314,6 @@ export type PolishedTuiConfig = ZentuiConfig & {
|
|
|
326
314
|
contextThresholds: ContextThresholds;
|
|
327
315
|
pathDisplay: PathDisplayConfig;
|
|
328
316
|
gitBranch: GitBranchConfig;
|
|
329
|
-
colorSources: ColorSourcesConfig;
|
|
330
317
|
features: UiFeaturesConfig;
|
|
331
318
|
footerSegments: FooterSegmentsConfig;
|
|
332
319
|
gitCommit: GitCommitConfig;
|
|
@@ -437,7 +424,6 @@ const defaultStarshipStyle: StarshipFooterStyleConfig = {
|
|
|
437
424
|
const defaultComponents: ComponentsConfig = {
|
|
438
425
|
editor: {
|
|
439
426
|
style: "on",
|
|
440
|
-
colorSource: "theme",
|
|
441
427
|
borderColorMode: "static",
|
|
442
428
|
modelLabel: "id",
|
|
443
429
|
viewportIndicators: true,
|
|
@@ -448,7 +434,6 @@ const defaultComponents: ComponentsConfig = {
|
|
|
448
434
|
userMessages: {
|
|
449
435
|
enabled: true,
|
|
450
436
|
style: "framed",
|
|
451
|
-
colorSource: "theme",
|
|
452
437
|
styles: {
|
|
453
438
|
framed: {},
|
|
454
439
|
"framed-copy-friendly": {},
|
|
@@ -464,14 +449,12 @@ const defaultComponents: ComponentsConfig = {
|
|
|
464
449
|
animateSpinnerColor: false,
|
|
465
450
|
textIntervalMs: DEFAULT_WORKING_LINE_TEXT_INTERVAL_MS,
|
|
466
451
|
textAnimation: "classic",
|
|
467
|
-
colorSource: "theme",
|
|
468
452
|
messages: { custom: true, values: [...PI_WORKING_LINE_MESSAGES] },
|
|
469
453
|
segments: { tool: true, elapsed: true, thought: true, tokens: true },
|
|
470
454
|
},
|
|
471
|
-
selectorBorders: { enabled: true, style: "zentui"
|
|
455
|
+
selectorBorders: { enabled: true, style: "zentui" },
|
|
472
456
|
footer: {
|
|
473
457
|
style: "starship",
|
|
474
|
-
colorSource: "theme",
|
|
475
458
|
modelLabel: "id",
|
|
476
459
|
styles: { starship: defaultStarshipStyle },
|
|
477
460
|
},
|
|
@@ -516,7 +499,6 @@ export const defaultConfig: PolishedTuiConfig = {
|
|
|
516
499
|
contextThresholds: defaultStarshipStyle.contextThresholds,
|
|
517
500
|
pathDisplay: defaultStarshipStyle.pathDisplay,
|
|
518
501
|
gitBranch: defaultStarshipStyle.gitBranch,
|
|
519
|
-
colorSources: { starship: "theme", editor: "theme", userMessages: "theme" },
|
|
520
502
|
features: {
|
|
521
503
|
editor: true,
|
|
522
504
|
statusLine: true,
|
|
@@ -814,10 +796,6 @@ function normalizeExtensionStatuses(
|
|
|
814
796
|
};
|
|
815
797
|
}
|
|
816
798
|
|
|
817
|
-
function isColorSourceKey(value: string): value is keyof ColorSourcesConfig {
|
|
818
|
-
return value === "starship" || value === "editor" || value === "userMessages";
|
|
819
|
-
}
|
|
820
|
-
|
|
821
799
|
function isUiFeatureKey(value: string): value is keyof UiFeaturesConfig {
|
|
822
800
|
return (
|
|
823
801
|
value === "editor" ||
|
|
@@ -850,21 +828,6 @@ function isFooterSegmentKey(
|
|
|
850
828
|
);
|
|
851
829
|
}
|
|
852
830
|
|
|
853
|
-
function validColorSourceEntries(
|
|
854
|
-
record: Record<string, unknown>,
|
|
855
|
-
): Partial<ColorSourcesConfig> {
|
|
856
|
-
return Object.fromEntries(
|
|
857
|
-
Object.entries(record).filter(
|
|
858
|
-
(entry): entry is [keyof ColorSourcesConfig, ColorSource] => {
|
|
859
|
-
const [key, value] = entry;
|
|
860
|
-
return (
|
|
861
|
-
isColorSourceKey(key) && (value === "theme" || value === "terminal")
|
|
862
|
-
);
|
|
863
|
-
},
|
|
864
|
-
),
|
|
865
|
-
) as Partial<ColorSourcesConfig>;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
831
|
function validUiFeatureEntries(
|
|
869
832
|
record: Record<string, unknown>,
|
|
870
833
|
): Partial<UiFeaturesConfig> {
|
|
@@ -924,10 +887,6 @@ function parseBoolean(value: unknown, fallback: boolean): boolean {
|
|
|
924
887
|
return typeof value === "boolean" ? value : fallback;
|
|
925
888
|
}
|
|
926
889
|
|
|
927
|
-
function parseColorSource(value: unknown, fallback: ColorSource): ColorSource {
|
|
928
|
-
return value === "theme" || value === "terminal" ? value : fallback;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
890
|
function parseSelectorBorderStyle(value: unknown): SelectorBorderStyle {
|
|
932
891
|
return value === "zentui" ? value : "zentui";
|
|
933
892
|
}
|
|
@@ -1025,10 +984,6 @@ function resolveComponents(config: ConfigRecord): ComponentsConfig {
|
|
|
1025
984
|
parseBoolean(editor.enabled, true) === false
|
|
1026
985
|
? "off"
|
|
1027
986
|
: parseEditorStyle(editor.style),
|
|
1028
|
-
colorSource: parseColorSource(
|
|
1029
|
-
editor.colorSource,
|
|
1030
|
-
defaultComponents.editor.colorSource,
|
|
1031
|
-
),
|
|
1032
987
|
borderColorMode: parseEditorBorderColorMode(editor.borderColorMode),
|
|
1033
988
|
modelLabel: parseEditorModelLabel(
|
|
1034
989
|
editor.modelLabel,
|
|
@@ -1071,10 +1026,6 @@ function resolveComponents(config: ConfigRecord): ComponentsConfig {
|
|
|
1071
1026
|
defaultComponents.userMessages.enabled,
|
|
1072
1027
|
),
|
|
1073
1028
|
style: parseUserMessageStyle(userMessages.style),
|
|
1074
|
-
colorSource: parseColorSource(
|
|
1075
|
-
userMessages.colorSource,
|
|
1076
|
-
defaultComponents.userMessages.colorSource,
|
|
1077
|
-
),
|
|
1078
1029
|
styles: {
|
|
1079
1030
|
framed: {},
|
|
1080
1031
|
"framed-copy-friendly": {},
|
|
@@ -1117,10 +1068,6 @@ function resolveComponents(config: ConfigRecord): ComponentsConfig {
|
|
|
1117
1068
|
workingLine.textAnimation === "disabled"
|
|
1118
1069
|
? workingLine.textAnimation
|
|
1119
1070
|
: defaultComponents.workingLine.textAnimation,
|
|
1120
|
-
colorSource: parseColorSource(
|
|
1121
|
-
workingLine.colorSource,
|
|
1122
|
-
defaultComponents.workingLine.colorSource,
|
|
1123
|
-
),
|
|
1124
1071
|
messages: resolveWorkingLineMessages(workingLineMessages),
|
|
1125
1072
|
segments: {
|
|
1126
1073
|
tool: parseBoolean(
|
|
@@ -1147,17 +1094,9 @@ function resolveComponents(config: ConfigRecord): ComponentsConfig {
|
|
|
1147
1094
|
defaultComponents.selectorBorders.enabled,
|
|
1148
1095
|
),
|
|
1149
1096
|
style: parseSelectorBorderStyle(selectorBorders.style),
|
|
1150
|
-
colorSource: parseColorSource(
|
|
1151
|
-
selectorBorders.colorSource,
|
|
1152
|
-
defaultComponents.selectorBorders.colorSource,
|
|
1153
|
-
),
|
|
1154
1097
|
},
|
|
1155
1098
|
footer: {
|
|
1156
1099
|
style: parseFooterStyle(footer.style),
|
|
1157
|
-
colorSource: parseColorSource(
|
|
1158
|
-
footer.colorSource,
|
|
1159
|
-
defaultComponents.footer.colorSource,
|
|
1160
|
-
),
|
|
1161
1100
|
modelLabel: parseEditorModelLabel(
|
|
1162
1101
|
footer.modelLabel,
|
|
1163
1102
|
defaultComponents.footer.modelLabel,
|
|
@@ -1220,11 +1159,6 @@ function derivedRuntimeView(config: ZentuiConfig): PolishedTuiConfig {
|
|
|
1220
1159
|
editorMetadataFormat: DEFAULT_EDITOR_METADATA_FORMAT,
|
|
1221
1160
|
editorBorderColorMode: config.components.editor.borderColorMode,
|
|
1222
1161
|
editorModelLabel: config.components.editor.modelLabel,
|
|
1223
|
-
colorSources: {
|
|
1224
|
-
starship: config.components.footer.colorSource,
|
|
1225
|
-
editor: config.components.editor.colorSource,
|
|
1226
|
-
userMessages: config.components.userMessages.colorSource,
|
|
1227
|
-
},
|
|
1228
1162
|
features: {
|
|
1229
1163
|
editor: config.components.editor.style === "on",
|
|
1230
1164
|
statusLine: config.components.footer.style === "starship",
|
|
@@ -1418,17 +1352,11 @@ function applyEditorComponentPatch(
|
|
|
1418
1352
|
patch: Partial<
|
|
1419
1353
|
Pick<
|
|
1420
1354
|
EditorComponentConfig,
|
|
1421
|
-
| "
|
|
1422
|
-
| "colorSource"
|
|
1423
|
-
| "borderColorMode"
|
|
1424
|
-
| "modelLabel"
|
|
1425
|
-
| "viewportIndicators"
|
|
1355
|
+
"style" | "borderColorMode" | "modelLabel" | "viewportIndicators"
|
|
1426
1356
|
>
|
|
1427
1357
|
>,
|
|
1428
1358
|
): void {
|
|
1429
1359
|
if (patch.style !== undefined) component.style = patch.style;
|
|
1430
|
-
if (patch.colorSource !== undefined)
|
|
1431
|
-
component.colorSource = patch.colorSource;
|
|
1432
1360
|
if (patch.borderColorMode !== undefined)
|
|
1433
1361
|
component.borderColorMode = patch.borderColorMode;
|
|
1434
1362
|
if (patch.modelLabel !== undefined) component.modelLabel = patch.modelLabel;
|
|
@@ -1441,11 +1369,7 @@ export function saveEditorComponentPatch(
|
|
|
1441
1369
|
patch: Partial<
|
|
1442
1370
|
Pick<
|
|
1443
1371
|
EditorComponentConfig,
|
|
1444
|
-
| "
|
|
1445
|
-
| "colorSource"
|
|
1446
|
-
| "borderColorMode"
|
|
1447
|
-
| "modelLabel"
|
|
1448
|
-
| "viewportIndicators"
|
|
1372
|
+
"style" | "borderColorMode" | "modelLabel" | "viewportIndicators"
|
|
1449
1373
|
>
|
|
1450
1374
|
>,
|
|
1451
1375
|
path = configPath,
|
|
@@ -1481,9 +1405,7 @@ export function saveMinimalistEditorStylePatch(
|
|
|
1481
1405
|
}
|
|
1482
1406
|
|
|
1483
1407
|
export function saveUserMessagesComponentPatch(
|
|
1484
|
-
patch: Partial<
|
|
1485
|
-
Pick<UserMessagesComponentConfig, "enabled" | "style" | "colorSource">
|
|
1486
|
-
>,
|
|
1408
|
+
patch: Partial<Pick<UserMessagesComponentConfig, "enabled" | "style">>,
|
|
1487
1409
|
path = configPath,
|
|
1488
1410
|
): PolishedTuiConfig {
|
|
1489
1411
|
return saveComponentsMutation(
|
|
@@ -1491,8 +1413,6 @@ export function saveUserMessagesComponentPatch(
|
|
|
1491
1413
|
const component = components.userMessages;
|
|
1492
1414
|
if (patch.enabled !== undefined) component.enabled = patch.enabled;
|
|
1493
1415
|
if (patch.style !== undefined) component.style = patch.style;
|
|
1494
|
-
if (patch.colorSource !== undefined)
|
|
1495
|
-
component.colorSource = patch.colorSource;
|
|
1496
1416
|
},
|
|
1497
1417
|
path,
|
|
1498
1418
|
patch.style !== undefined ? "userMessages" : undefined,
|
|
@@ -1517,8 +1437,6 @@ export function saveWorkingLineComponentPatch(
|
|
|
1517
1437
|
component.textIntervalMs = patch.textIntervalMs;
|
|
1518
1438
|
if (patch.textAnimation !== undefined)
|
|
1519
1439
|
component.textAnimation = patch.textAnimation;
|
|
1520
|
-
if (patch.colorSource !== undefined)
|
|
1521
|
-
component.colorSource = patch.colorSource;
|
|
1522
1440
|
if (patch.messages?.custom !== undefined)
|
|
1523
1441
|
component.messages.custom = patch.messages.custom;
|
|
1524
1442
|
if (patch.messages?.values !== undefined) {
|
|
@@ -1546,8 +1464,6 @@ export function saveSelectorBordersComponentPatch(
|
|
|
1546
1464
|
const component = components.selectorBorders;
|
|
1547
1465
|
if (patch.enabled !== undefined) component.enabled = patch.enabled;
|
|
1548
1466
|
if (patch.style !== undefined) component.style = patch.style;
|
|
1549
|
-
if (patch.colorSource !== undefined)
|
|
1550
|
-
component.colorSource = patch.colorSource;
|
|
1551
1467
|
},
|
|
1552
1468
|
path,
|
|
1553
1469
|
patch.style !== undefined ? "selectorBorders" : undefined,
|
|
@@ -1555,17 +1471,13 @@ export function saveSelectorBordersComponentPatch(
|
|
|
1555
1471
|
}
|
|
1556
1472
|
|
|
1557
1473
|
export function saveFooterComponentPatch(
|
|
1558
|
-
patch: Partial<
|
|
1559
|
-
Pick<FooterComponentConfig, "style" | "colorSource" | "modelLabel">
|
|
1560
|
-
>,
|
|
1474
|
+
patch: Partial<Pick<FooterComponentConfig, "style" | "modelLabel">>,
|
|
1561
1475
|
path = configPath,
|
|
1562
1476
|
): PolishedTuiConfig {
|
|
1563
1477
|
return saveComponentsMutation(
|
|
1564
1478
|
(components) => {
|
|
1565
1479
|
const component = components.footer;
|
|
1566
1480
|
if (patch.style !== undefined) component.style = patch.style;
|
|
1567
|
-
if (patch.colorSource !== undefined)
|
|
1568
|
-
component.colorSource = patch.colorSource;
|
|
1569
1481
|
if (patch.modelLabel !== undefined)
|
|
1570
1482
|
component.modelLabel = patch.modelLabel;
|
|
1571
1483
|
},
|
|
@@ -1630,24 +1542,6 @@ export function saveStarshipFooterStylePatch(
|
|
|
1630
1542
|
);
|
|
1631
1543
|
}
|
|
1632
1544
|
|
|
1633
|
-
export function saveColorSourcesPatch(
|
|
1634
|
-
patch: Partial<ColorSourcesConfig>,
|
|
1635
|
-
path = configPath,
|
|
1636
|
-
): PolishedTuiConfig {
|
|
1637
|
-
const valid = validColorSourceEntries(patch);
|
|
1638
|
-
return saveComponentsMutation((components) => {
|
|
1639
|
-
if (valid.starship !== undefined)
|
|
1640
|
-
components.footer.colorSource = valid.starship;
|
|
1641
|
-
if (valid.editor !== undefined) {
|
|
1642
|
-
components.editor.colorSource = valid.editor;
|
|
1643
|
-
components.selectorBorders.colorSource = valid.editor;
|
|
1644
|
-
}
|
|
1645
|
-
if (valid.userMessages !== undefined) {
|
|
1646
|
-
components.userMessages.colorSource = valid.userMessages;
|
|
1647
|
-
}
|
|
1648
|
-
}, path);
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
1545
|
export function saveUiFeaturesPatch(
|
|
1652
1546
|
patch: Partial<UiFeaturesConfig>,
|
|
1653
1547
|
path = configPath,
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
type Theme,
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
renderChromeBorder,
|
|
7
|
+
EDITOR_BORDER_FALLBACK,
|
|
9
8
|
renderEditorBorder,
|
|
9
|
+
renderThemeStyleOrFallback,
|
|
10
10
|
} from "../../shared/style.ts";
|
|
11
11
|
import type { ZentuiConfig } from "../config/shell.ts";
|
|
12
12
|
import {
|
|
@@ -35,10 +35,11 @@ function renderBorderLine(
|
|
|
35
35
|
): string {
|
|
36
36
|
const text = "─".repeat(Math.max(1, width));
|
|
37
37
|
if (theme && config) {
|
|
38
|
-
|
|
38
|
+
// 选择器边框跟随主题 borderMuted 语义色。
|
|
39
|
+
return renderThemeStyleOrFallback(
|
|
39
40
|
theme,
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
undefined,
|
|
42
|
+
EDITOR_BORDER_FALLBACK,
|
|
42
43
|
text,
|
|
43
44
|
);
|
|
44
45
|
}
|
package/extensions/app/panel.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
renderEditorSettingsPreview,
|
|
14
14
|
renderUserMessageSettingsPreview,
|
|
15
15
|
} from "./commands/settings-previews.ts";
|
|
16
|
+
import { loadPanelOverlayConfig } from "./config/panel.ts";
|
|
16
17
|
import {
|
|
17
18
|
type CompactStyleMode,
|
|
18
19
|
type Config as ContextConfig,
|
|
@@ -26,7 +27,6 @@ import {
|
|
|
26
27
|
type FooterComponentConfig,
|
|
27
28
|
type FooterStyle,
|
|
28
29
|
loadConfig as loadShellConfig,
|
|
29
|
-
saveColorSourcesPatch,
|
|
30
30
|
saveEditorBorderColorMode,
|
|
31
31
|
saveEditorComponentPatch,
|
|
32
32
|
saveFooterComponentPatch,
|
|
@@ -133,14 +133,6 @@ function editorItems(): SettingItem[] {
|
|
|
133
133
|
currentValue: config.components.editor.style,
|
|
134
134
|
values: ["on", "off"],
|
|
135
135
|
},
|
|
136
|
-
{
|
|
137
|
-
id: "editorColorSource",
|
|
138
|
-
label: "Color source",
|
|
139
|
-
description:
|
|
140
|
-
"theme resolves colors through the active Pi theme; terminal uses fixed terminal colors.",
|
|
141
|
-
currentValue: config.components.editor.colorSource,
|
|
142
|
-
values: ["theme", "terminal"],
|
|
143
|
-
},
|
|
144
136
|
{
|
|
145
137
|
id: "editorBorderColorMode",
|
|
146
138
|
label: "Border color",
|
|
@@ -312,6 +304,13 @@ function featureItems(config: ContextConfig): SettingItem[] {
|
|
|
312
304
|
currentValue: onOff(config.enableAliases),
|
|
313
305
|
values: ["on", "off"],
|
|
314
306
|
},
|
|
307
|
+
{
|
|
308
|
+
id: "enableEffortCommand",
|
|
309
|
+
label: "Effort command",
|
|
310
|
+
description: "Register the /effort thinking-level command.",
|
|
311
|
+
currentValue: onOff(config.enableEffortCommand),
|
|
312
|
+
values: ["on", "off"],
|
|
313
|
+
},
|
|
315
314
|
];
|
|
316
315
|
}
|
|
317
316
|
|
|
@@ -446,24 +445,13 @@ function updateSetting(
|
|
|
446
445
|
return;
|
|
447
446
|
}
|
|
448
447
|
if (
|
|
449
|
-
id === "
|
|
450
|
-
(value === "
|
|
448
|
+
id === "editorBorderColorMode" &&
|
|
449
|
+
(value === "static" || value === "adaptive")
|
|
451
450
|
) {
|
|
452
451
|
if (deps.runtime)
|
|
453
|
-
deps.runtime.setEditorComponent({
|
|
454
|
-
else
|
|
455
|
-
saveNotice(ctx, "
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
if (id === "editorBorderColorMode") {
|
|
459
|
-
const valid =
|
|
460
|
-
value === "static" || value === "adaptive" ? value : undefined;
|
|
461
|
-
if (valid) {
|
|
462
|
-
if (deps.runtime)
|
|
463
|
-
deps.runtime.setEditorComponent({ borderColorMode: valid }, ctx);
|
|
464
|
-
else saveEditorBorderColorMode(valid);
|
|
465
|
-
saveNotice(ctx, "Border color", value);
|
|
466
|
-
}
|
|
452
|
+
deps.runtime.setEditorComponent({ borderColorMode: value }, ctx);
|
|
453
|
+
else saveEditorBorderColorMode(value);
|
|
454
|
+
saveNotice(ctx, "Border color", value);
|
|
467
455
|
return;
|
|
468
456
|
}
|
|
469
457
|
if (id === "userMessagesEnabled") {
|
|
@@ -567,6 +555,7 @@ function updateSetting(
|
|
|
567
555
|
id === "enableContextCommand" ||
|
|
568
556
|
id === "enableAgentSummary" ||
|
|
569
557
|
id === "enableAliases" ||
|
|
558
|
+
id === "enableEffortCommand" ||
|
|
570
559
|
id === "showStartupHeader"
|
|
571
560
|
) {
|
|
572
561
|
const patch = { [id]: isOn(value) } as Partial<ContextConfig>;
|
|
@@ -618,6 +607,8 @@ export async function showOneUiPanel(
|
|
|
618
607
|
|
|
619
608
|
unifiedPanelOpen = true;
|
|
620
609
|
try {
|
|
610
|
+
// Read fresh on every open so pi-one-ui.json edits apply without /reload.
|
|
611
|
+
const panelOverlay = loadPanelOverlayConfig();
|
|
621
612
|
let panelHandle: { focus: () => void } | undefined;
|
|
622
613
|
await overlayManager.run(() =>
|
|
623
614
|
ctx.ui.custom(
|
|
@@ -700,15 +691,10 @@ export async function showOneUiPanel(
|
|
|
700
691
|
{
|
|
701
692
|
overlay: true,
|
|
702
693
|
overlayOptions: {
|
|
703
|
-
anchor:
|
|
704
|
-
width:
|
|
705
|
-
maxHeight:
|
|
706
|
-
margin:
|
|
707
|
-
top: 6,
|
|
708
|
-
right: 1,
|
|
709
|
-
bottom: 1,
|
|
710
|
-
left: 1,
|
|
711
|
-
},
|
|
694
|
+
anchor: panelOverlay.anchor,
|
|
695
|
+
width: panelOverlay.width,
|
|
696
|
+
maxHeight: panelOverlay.maxHeight,
|
|
697
|
+
margin: panelOverlay.margin,
|
|
712
698
|
},
|
|
713
699
|
onHandle: (handle: { focus: () => void }) => {
|
|
714
700
|
panelHandle = handle;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effort Command Feature
|
|
3
|
+
*
|
|
4
|
+
* Registers the /effort command for selecting the active thinking level:
|
|
5
|
+
* /effort → interactive level picker
|
|
6
|
+
* /effort high → apply a level directly (with autocomplete)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
|
|
11
|
+
const EFFORT_LEVELS = [
|
|
12
|
+
"off",
|
|
13
|
+
"minimal",
|
|
14
|
+
"low",
|
|
15
|
+
"medium",
|
|
16
|
+
"high",
|
|
17
|
+
"xhigh",
|
|
18
|
+
"max",
|
|
19
|
+
] as const;
|
|
20
|
+
type EffortLevel = (typeof EFFORT_LEVELS)[number];
|
|
21
|
+
|
|
22
|
+
/** Reports whether a command argument is a supported thinking-effort level. */
|
|
23
|
+
function isEffortLevel(value: string): value is EffortLevel {
|
|
24
|
+
return EFFORT_LEVELS.some((level) => level === value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Registers the /effort command for selecting the active thinking level. */
|
|
28
|
+
export default function effortCommand(pi: ExtensionAPI): void {
|
|
29
|
+
pi.registerCommand("effort", {
|
|
30
|
+
description:
|
|
31
|
+
"Set thinking effort: off, minimal, low, medium, high, xhigh, or max",
|
|
32
|
+
getArgumentCompletions: (prefix) => {
|
|
33
|
+
const normalizedPrefix = prefix.toLowerCase();
|
|
34
|
+
const matches = EFFORT_LEVELS.filter((level) =>
|
|
35
|
+
level.startsWith(normalizedPrefix),
|
|
36
|
+
).map((level) => ({
|
|
37
|
+
value: level,
|
|
38
|
+
label: level,
|
|
39
|
+
}));
|
|
40
|
+
return matches.length > 0 ? matches : null;
|
|
41
|
+
},
|
|
42
|
+
handler: async (args, ctx) => {
|
|
43
|
+
let requested = args.trim().toLowerCase();
|
|
44
|
+
if (!requested) {
|
|
45
|
+
if (!ctx.hasUI) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const selected = await ctx.ui.select(
|
|
49
|
+
`Thinking effort (current: ${pi.getThinkingLevel()})`,
|
|
50
|
+
[...EFFORT_LEVELS],
|
|
51
|
+
);
|
|
52
|
+
if (!selected) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
requested = selected;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!isEffortLevel(requested)) {
|
|
59
|
+
ctx.ui.notify(
|
|
60
|
+
`Unknown effort "${requested}". Expected: ${EFFORT_LEVELS.join(", ")}`,
|
|
61
|
+
"error",
|
|
62
|
+
);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
pi.setThinkingLevel(requested);
|
|
67
|
+
// The active model may clamp unsupported levels; surface the applied value.
|
|
68
|
+
const applied = pi.getThinkingLevel();
|
|
69
|
+
if (applied !== requested) {
|
|
70
|
+
ctx.ui.notify(
|
|
71
|
+
`Requested ${requested}; active model applied ${applied}`,
|
|
72
|
+
"warning",
|
|
73
|
+
);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
ctx.ui.notify(`Thinking effort: ${applied}`, "info");
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
@@ -16,6 +16,7 @@ import { type ConfigRecord, configStore } from "../../app/config/store.ts";
|
|
|
16
16
|
// shell
|
|
17
17
|
import piAliases from "../../features/aliases.ts";
|
|
18
18
|
import context from "../../features/context-inspector/index.ts";
|
|
19
|
+
import effortCommand from "../../features/effort-command.ts";
|
|
19
20
|
import { installFlushDockedBash } from "../../features/flush-docked-bash.ts";
|
|
20
21
|
import sessionReference from "../../features/session-reference/index.ts";
|
|
21
22
|
// feature
|
|
@@ -154,6 +155,9 @@ export default function (
|
|
|
154
155
|
): void {
|
|
155
156
|
// shell chrome
|
|
156
157
|
if (config.enableAliases) piAliases(pi);
|
|
158
|
+
if (config.enableEffortCommand) {
|
|
159
|
+
effortCommand(pi);
|
|
160
|
+
}
|
|
157
161
|
installFlushDockedBash();
|
|
158
162
|
// The thinking controller is queried directly by the context render stack.
|
|
159
163
|
markdownEnhance(pi);
|
|
@@ -9,7 +9,7 @@ import type { ZentuiConfig } from "../../../app/config/shell.ts";
|
|
|
9
9
|
import {
|
|
10
10
|
EDITOR_ACCENT_FALLBACK,
|
|
11
11
|
EDITOR_BORDER_FALLBACK,
|
|
12
|
-
|
|
12
|
+
renderThemeStyleOrFallbackStrict,
|
|
13
13
|
} from "../../../shared/style.ts";
|
|
14
14
|
import { sanitizeUserMessageSourceText } from "./user-message-osc.ts";
|
|
15
15
|
|
|
@@ -74,9 +74,8 @@ function accent(
|
|
|
74
74
|
text: string,
|
|
75
75
|
): string {
|
|
76
76
|
return theme
|
|
77
|
-
?
|
|
77
|
+
? renderThemeStyleOrFallbackStrict(
|
|
78
78
|
theme,
|
|
79
|
-
config.components.userMessages.colorSource,
|
|
80
79
|
config.colors.editorAccent,
|
|
81
80
|
EDITOR_ACCENT_FALLBACK,
|
|
82
81
|
text,
|
|
@@ -90,9 +89,8 @@ function border(
|
|
|
90
89
|
text: string,
|
|
91
90
|
): string {
|
|
92
91
|
return theme
|
|
93
|
-
?
|
|
92
|
+
? renderThemeStyleOrFallbackStrict(
|
|
94
93
|
theme,
|
|
95
|
-
config.components.userMessages.colorSource,
|
|
96
94
|
config.colors.editorBorder,
|
|
97
95
|
EDITOR_BORDER_FALLBACK,
|
|
98
96
|
text,
|
|
@@ -210,28 +208,23 @@ export function userMessageStyleCacheKey(config: ZentuiConfig): string {
|
|
|
210
208
|
case "framed":
|
|
211
209
|
return [
|
|
212
210
|
"framed",
|
|
213
|
-
messages.colorSource,
|
|
214
211
|
config.colors.editorAccent ?? "",
|
|
215
212
|
config.colors.editorBorder ?? "",
|
|
216
213
|
config.icons.rail,
|
|
217
214
|
].join("\0");
|
|
218
215
|
case "framed-copy-friendly":
|
|
219
|
-
return [
|
|
220
|
-
"
|
|
221
|
-
|
|
222
|
-
config.colors.editorBorder ?? "",
|
|
223
|
-
].join("\0");
|
|
216
|
+
return ["framed-copy-friendly", config.colors.editorBorder ?? ""].join(
|
|
217
|
+
"\0",
|
|
218
|
+
);
|
|
224
219
|
case "compact":
|
|
225
220
|
return [
|
|
226
221
|
"compact",
|
|
227
|
-
messages.colorSource,
|
|
228
222
|
config.colors.editorAccent ?? "",
|
|
229
223
|
config.icons.rail,
|
|
230
224
|
].join("\0");
|
|
231
225
|
case "labeled":
|
|
232
226
|
return [
|
|
233
227
|
"labeled",
|
|
234
|
-
messages.colorSource,
|
|
235
228
|
config.colors.editorAccent ?? "",
|
|
236
229
|
config.colors.editorBorder ?? "",
|
|
237
230
|
"User:v1",
|
|
@@ -2,7 +2,7 @@ import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
|
2
2
|
import type { ZentuiConfig } from "../../app/config/shell.ts";
|
|
3
3
|
import {
|
|
4
4
|
EDITOR_ACCENT_FALLBACK,
|
|
5
|
-
|
|
5
|
+
renderThemeStyleOrFallback,
|
|
6
6
|
safeThemeFg,
|
|
7
7
|
} from "../../shared/style.ts";
|
|
8
8
|
import {
|
|
@@ -173,7 +173,6 @@ function renderVariable(
|
|
|
173
173
|
uiTheme: Theme,
|
|
174
174
|
config: ZentuiConfig,
|
|
175
175
|
): { plain: string; styled: string } {
|
|
176
|
-
const colorSource = config.components.editor.colorSource;
|
|
177
176
|
const thinking =
|
|
178
177
|
values.thinking.toLowerCase() === "off" ? "" : values.thinking;
|
|
179
178
|
const raw =
|
|
@@ -196,9 +195,8 @@ function renderVariable(
|
|
|
196
195
|
if (name === "model" || name === "model_id" || name === "model_name") {
|
|
197
196
|
return {
|
|
198
197
|
plain,
|
|
199
|
-
styled:
|
|
198
|
+
styled: renderThemeStyleOrFallback(
|
|
200
199
|
uiTheme,
|
|
201
|
-
colorSource,
|
|
202
200
|
config.colors.editorModel,
|
|
203
201
|
EDITOR_ACCENT_FALLBACK,
|
|
204
202
|
plain,
|
|
@@ -208,9 +206,8 @@ function renderVariable(
|
|
|
208
206
|
if (name === "provider") {
|
|
209
207
|
return {
|
|
210
208
|
plain,
|
|
211
|
-
styled:
|
|
209
|
+
styled: renderThemeStyleOrFallback(
|
|
212
210
|
uiTheme,
|
|
213
|
-
colorSource,
|
|
214
211
|
config.colors.editorProvider,
|
|
215
212
|
"text",
|
|
216
213
|
plain,
|
|
@@ -220,9 +217,8 @@ function renderVariable(
|
|
|
220
217
|
if (name === "thinking") {
|
|
221
218
|
return {
|
|
222
219
|
plain,
|
|
223
|
-
styled:
|
|
220
|
+
styled: renderThemeStyleOrFallback(
|
|
224
221
|
uiTheme,
|
|
225
|
-
colorSource,
|
|
226
222
|
editorThinkingStyle(config, plain),
|
|
227
223
|
"muted",
|
|
228
224
|
plain,
|