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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { basename, isAbsolute, relative, sep } from "node:path";
|
|
2
2
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
4
|
-
import type { ZentuiConfig } from "../../app/config/shell.ts";
|
|
4
|
+
import type { ColorSpec, ZentuiConfig } from "../../app/config/shell.ts";
|
|
5
5
|
import { formatCwdLabel, formatElapsedDuration } from "../../shared/format.ts";
|
|
6
6
|
import { sanitizeEditorMetadataText } from "./editor-metadata-format.ts";
|
|
7
7
|
|
|
@@ -11,32 +11,14 @@ import {
|
|
|
11
11
|
EDITOR_ACCENT_FALLBACK,
|
|
12
12
|
EDITOR_BORDER_FALLBACK,
|
|
13
13
|
renderSourceColor,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
renderThemeStyle,
|
|
15
|
+
renderThemeStyleOrFallback,
|
|
16
16
|
safeThemeFg,
|
|
17
17
|
} from "../../shared/style.ts";
|
|
18
18
|
|
|
19
|
-
const MINIMALIST_MODEL_FALLBACK =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
const MINIMALIST_THINKING_FALLBACK = {
|
|
24
|
-
theme: "warning",
|
|
25
|
-
terminal: "bold yellow",
|
|
26
|
-
};
|
|
27
|
-
const MINIMALIST_ADAPTIVE_TERMINAL_THINKING_FALLBACKS: Record<string, string> =
|
|
28
|
-
{
|
|
29
|
-
minimal: "bright-black",
|
|
30
|
-
low: "blue",
|
|
31
|
-
medium: "cyan",
|
|
32
|
-
high: "yellow",
|
|
33
|
-
xhigh: "red",
|
|
34
|
-
max: "bright-red",
|
|
35
|
-
};
|
|
36
|
-
const MINIMALIST_BRANCH_FALLBACK = {
|
|
37
|
-
theme: "bold syntaxKeyword",
|
|
38
|
-
terminal: "bold blue",
|
|
39
|
-
};
|
|
19
|
+
const MINIMALIST_MODEL_FALLBACK: ColorSpec = "syntaxKeyword";
|
|
20
|
+
const MINIMALIST_THINKING_FALLBACK: ColorSpec = "warning";
|
|
21
|
+
const MINIMALIST_BRANCH_FALLBACK: ColorSpec = "bold syntaxKeyword";
|
|
40
22
|
|
|
41
23
|
export type MinimalistEditorMetadata = {
|
|
42
24
|
cwd: string;
|
|
@@ -139,7 +121,6 @@ function renderTopLeft(
|
|
|
139
121
|
config: ZentuiConfig,
|
|
140
122
|
includeSessionName = true,
|
|
141
123
|
): string {
|
|
142
|
-
const source = config.components.editor.colorSource;
|
|
143
124
|
const trimmed = inputText.trimStart();
|
|
144
125
|
const bashMode = trimmed.startsWith("!!")
|
|
145
126
|
? "no-context"
|
|
@@ -161,9 +142,8 @@ function renderTopLeft(
|
|
|
161
142
|
const duration = formatElapsedDuration(metadata.agentDurationMs);
|
|
162
143
|
parts.push(
|
|
163
144
|
metadata.agentActive
|
|
164
|
-
?
|
|
145
|
+
? renderThemeStyleOrFallback(
|
|
165
146
|
uiTheme,
|
|
166
|
-
source,
|
|
167
147
|
config.colors.sessionDuration,
|
|
168
148
|
EDITOR_ACCENT_FALLBACK,
|
|
169
149
|
duration,
|
|
@@ -179,12 +159,7 @@ function renderTopLeft(
|
|
|
179
159
|
sessionName
|
|
180
160
|
) {
|
|
181
161
|
parts.push(
|
|
182
|
-
|
|
183
|
-
uiTheme,
|
|
184
|
-
source,
|
|
185
|
-
config.colors.sessionName,
|
|
186
|
-
sessionName,
|
|
187
|
-
),
|
|
162
|
+
renderThemeStyle(uiTheme, config.colors.sessionName, sessionName),
|
|
188
163
|
);
|
|
189
164
|
}
|
|
190
165
|
return joinStyled(parts, safeThemeFg(uiTheme, "muted", " · "));
|
|
@@ -197,7 +172,6 @@ function renderTopRight(
|
|
|
197
172
|
renderBorder: (text: string) => string,
|
|
198
173
|
renderThinking: (text: string) => string,
|
|
199
174
|
): string {
|
|
200
|
-
const source = config.components.editor.colorSource;
|
|
201
175
|
const parts: string[] = [];
|
|
202
176
|
const joinParts = (values: string[]) =>
|
|
203
177
|
values
|
|
@@ -209,17 +183,16 @@ function renderTopRight(
|
|
|
209
183
|
? sanitizeEditorMetadataText(metadata.costLabel ?? "")
|
|
210
184
|
: "";
|
|
211
185
|
if (cost) {
|
|
212
|
-
parts.push(
|
|
186
|
+
parts.push(renderThemeStyle(uiTheme, config.colors.cost, cost));
|
|
213
187
|
}
|
|
214
188
|
const model = sanitizeEditorMetadataText(metadata.modelLabel ?? "");
|
|
215
189
|
if (model) {
|
|
216
190
|
parts.push(
|
|
217
191
|
renderSourceColor(
|
|
218
192
|
uiTheme,
|
|
219
|
-
source,
|
|
220
193
|
config.colors.editorModel,
|
|
221
194
|
"editorModel",
|
|
222
|
-
MINIMALIST_MODEL_FALLBACK
|
|
195
|
+
MINIMALIST_MODEL_FALLBACK,
|
|
223
196
|
model,
|
|
224
197
|
),
|
|
225
198
|
);
|
|
@@ -237,13 +210,11 @@ function renderBottomLeft(
|
|
|
237
210
|
config: ZentuiConfig,
|
|
238
211
|
): string {
|
|
239
212
|
if (!config.components.editor.styles.minimalist.showGit) return "";
|
|
240
|
-
const source = config.components.editor.colorSource;
|
|
241
213
|
const branch = sanitizeEditorMetadataText(metadata.branch ?? "");
|
|
242
214
|
const parts = branch
|
|
243
215
|
? [
|
|
244
|
-
|
|
216
|
+
renderThemeStyleOrFallback(
|
|
245
217
|
uiTheme,
|
|
246
|
-
source,
|
|
247
218
|
config.colors.editorGitBranch,
|
|
248
219
|
MINIMALIST_BRANCH_FALLBACK,
|
|
249
220
|
branch,
|
|
@@ -251,9 +222,7 @@ function renderBottomLeft(
|
|
|
251
222
|
]
|
|
252
223
|
: [];
|
|
253
224
|
if (metadata.dirty) {
|
|
254
|
-
parts.push(
|
|
255
|
-
renderStyleForSource(uiTheme, source, config.colors.gitStatus, "*"),
|
|
256
|
-
);
|
|
225
|
+
parts.push(renderThemeStyle(uiTheme, config.colors.gitStatus, "*"));
|
|
257
226
|
}
|
|
258
227
|
if ((metadata.ahead ?? 0) > 0) {
|
|
259
228
|
parts.push(safeThemeFg(uiTheme, "success", `↑${metadata.ahead}`));
|
|
@@ -295,14 +264,7 @@ function renderBottomRight(
|
|
|
295
264
|
): string {
|
|
296
265
|
const cwd = sanitizeEditorMetadataText(minimalistCwdLabel(metadata, config));
|
|
297
266
|
return cwd
|
|
298
|
-
? renderSourceColor(
|
|
299
|
-
uiTheme,
|
|
300
|
-
config.components.editor.colorSource,
|
|
301
|
-
config.colors.cwd,
|
|
302
|
-
"cwd",
|
|
303
|
-
"bold cyan",
|
|
304
|
-
cwd,
|
|
305
|
-
)
|
|
267
|
+
? renderSourceColor(uiTheme, config.colors.cwd, "cwd", "bold cyan", cwd)
|
|
306
268
|
: "";
|
|
307
269
|
}
|
|
308
270
|
|
|
@@ -384,7 +346,6 @@ export function renderMinimalistFrame({
|
|
|
384
346
|
}: MinimalistFrameOptions): string[] {
|
|
385
347
|
if (width <= 4) return clampLines(editorLines, width);
|
|
386
348
|
const contentWidth = Math.max(0, width - 4);
|
|
387
|
-
const source = config.components.editor.colorSource;
|
|
388
349
|
const adaptive = config.components.editor.borderColorMode === "adaptive";
|
|
389
350
|
const thinking = sanitizeEditorMetadataText(metadata.thinkingLevel ?? "");
|
|
390
351
|
const activeThinking =
|
|
@@ -392,31 +353,18 @@ export function renderMinimalistFrame({
|
|
|
392
353
|
const renderStaticBorder = (text: string) =>
|
|
393
354
|
renderSourceColor(
|
|
394
355
|
uiTheme,
|
|
395
|
-
source,
|
|
396
356
|
config.colors.editorBorder,
|
|
397
357
|
"editorBorder",
|
|
398
|
-
EDITOR_BORDER_FALLBACK
|
|
358
|
+
EDITOR_BORDER_FALLBACK,
|
|
399
359
|
text,
|
|
400
360
|
);
|
|
401
|
-
|
|
402
|
-
? (thinkingStyle(config, activeThinking) ??
|
|
403
|
-
MINIMALIST_ADAPTIVE_TERMINAL_THINKING_FALLBACKS[
|
|
404
|
-
activeThinking.toLowerCase()
|
|
405
|
-
] ??
|
|
406
|
-
MINIMALIST_THINKING_FALLBACK.terminal)
|
|
407
|
-
: undefined;
|
|
361
|
+
// adaptive 边框三级链:用户分档配置(editorThinking*)→ Pi 原生 effort 边框 → 默认。
|
|
408
362
|
const renderBorder = (text: string) => {
|
|
409
363
|
if (!adaptive) return renderStaticBorder(text);
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
source,
|
|
415
|
-
terminalAdaptiveThinkingStyle,
|
|
416
|
-
text,
|
|
417
|
-
)
|
|
418
|
-
: renderStaticBorder(text);
|
|
419
|
-
}
|
|
364
|
+
const configured = activeThinking
|
|
365
|
+
? thinkingStyle(config, activeThinking)
|
|
366
|
+
: undefined;
|
|
367
|
+
if (configured) return renderThemeStyle(uiTheme, configured, text);
|
|
420
368
|
if (!borderColor) return renderStaticBorder(text);
|
|
421
369
|
try {
|
|
422
370
|
const rendered = borderColor(text);
|
|
@@ -426,9 +374,8 @@ export function renderMinimalistFrame({
|
|
|
426
374
|
}
|
|
427
375
|
};
|
|
428
376
|
const renderStaticThinking = (text: string) =>
|
|
429
|
-
|
|
377
|
+
renderThemeStyleOrFallback(
|
|
430
378
|
uiTheme,
|
|
431
|
-
source,
|
|
432
379
|
thinkingStyle(config, text),
|
|
433
380
|
MINIMALIST_THINKING_FALLBACK,
|
|
434
381
|
text,
|
|
@@ -16,7 +16,7 @@ import type { ZentuiConfig } from "../../app/config/shell.ts";
|
|
|
16
16
|
import {
|
|
17
17
|
EDITOR_ACCENT_FALLBACK,
|
|
18
18
|
EDITOR_BORDER_FALLBACK,
|
|
19
|
-
|
|
19
|
+
renderThemeStyleOrFallback,
|
|
20
20
|
safeThemeFg,
|
|
21
21
|
} from "../../shared/style.ts";
|
|
22
22
|
import { renderEditorMetadataFormat } from "./editor-metadata-format.ts";
|
|
@@ -289,7 +289,7 @@ export function renderWithAutocompleteCapture<T>(
|
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* off 模式的原生边框覆盖:仅在 style=off 且用户显式配置了 colors.editorBorder
|
|
292
|
-
* 时返回按
|
|
292
|
+
* 时返回按 theme 语义解释的边框渲染函数;未配置或 on 模式返回 undefined
|
|
293
293
|
* (保持 Pi 原生 effort/主题变色不动)。
|
|
294
294
|
*/
|
|
295
295
|
export function offEditorBorderColor(
|
|
@@ -301,13 +301,7 @@ export function offEditorBorderColor(
|
|
|
301
301
|
const spec = config.colors.editorBorder;
|
|
302
302
|
if (typeof spec !== "string" || spec.trim() === "") return undefined;
|
|
303
303
|
return (text) =>
|
|
304
|
-
|
|
305
|
-
uiTheme,
|
|
306
|
-
editor.colorSource,
|
|
307
|
-
spec,
|
|
308
|
-
EDITOR_BORDER_FALLBACK,
|
|
309
|
-
text,
|
|
310
|
-
);
|
|
304
|
+
renderThemeStyleOrFallback(uiTheme, spec, EDITOR_BORDER_FALLBACK, text);
|
|
311
305
|
}
|
|
312
306
|
|
|
313
307
|
function clampRenderedLines(lines: string[], width: number): string[] {
|
|
@@ -326,9 +320,8 @@ function getEditorChromeWidths(
|
|
|
326
320
|
uiTheme: Theme,
|
|
327
321
|
reset: string,
|
|
328
322
|
) {
|
|
329
|
-
const rail = `${
|
|
323
|
+
const rail = `${renderThemeStyleOrFallback(
|
|
330
324
|
uiTheme,
|
|
331
|
-
config.components.editor.colorSource,
|
|
332
325
|
config.colors.editorAccent,
|
|
333
326
|
EDITOR_ACCENT_FALLBACK,
|
|
334
327
|
config.icons.rail,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
formatUsernameHostLabel,
|
|
23
23
|
} from "../../shared/format.ts";
|
|
24
24
|
import { resolveRuntimeSymbol } from "../../shared/icons.ts";
|
|
25
|
-
import { renderSourceColor,
|
|
25
|
+
import { renderSourceColor, renderThemeStyle } from "../../shared/style.ts";
|
|
26
26
|
import { sanitizeEditorMetadataText } from "../editor/editor-metadata-format.ts";
|
|
27
27
|
import {
|
|
28
28
|
collectExtensionStatusSegments,
|
|
@@ -277,7 +277,6 @@ export function installFooter(
|
|
|
277
277
|
compactFormatTokens,
|
|
278
278
|
FOOTER_FORMAT_ALIASES,
|
|
279
279
|
);
|
|
280
|
-
const colorSource = config.components.footer.colorSource;
|
|
281
280
|
const iconMode = config.icons.mode;
|
|
282
281
|
const formattedCwd = sanitizeEditorMetadataText(
|
|
283
282
|
formatCwdLabel(ctx.cwd, config.icons.cwd, {
|
|
@@ -315,16 +314,14 @@ export function installFooter(
|
|
|
315
314
|
version: sanitizeEditorMetadataText(state.packageVersion.version),
|
|
316
315
|
}
|
|
317
316
|
: undefined;
|
|
318
|
-
const separator =
|
|
317
|
+
const separator = renderThemeStyle(
|
|
319
318
|
theme,
|
|
320
|
-
colorSource,
|
|
321
319
|
config.colors.separator,
|
|
322
320
|
separatorText[config.components.footer.styles.starship.separator],
|
|
323
321
|
);
|
|
324
322
|
const innerWidth = Math.max(1, width - 2);
|
|
325
323
|
const cwdLabel = renderSourceColor(
|
|
326
324
|
theme,
|
|
327
|
-
colorSource,
|
|
328
325
|
config.colors.cwd,
|
|
329
326
|
"cwd",
|
|
330
327
|
"bold cyan",
|
|
@@ -341,12 +338,7 @@ export function installFooter(
|
|
|
341
338
|
)
|
|
342
339
|
: "";
|
|
343
340
|
const sessionNameLabel = sessionName
|
|
344
|
-
?
|
|
345
|
-
theme,
|
|
346
|
-
colorSource,
|
|
347
|
-
config.colors.sessionName,
|
|
348
|
-
sessionName,
|
|
349
|
-
)
|
|
341
|
+
? renderThemeStyle(theme, config.colors.sessionName, sessionName)
|
|
350
342
|
: "";
|
|
351
343
|
const builtInSessionNameLabel = sessionNameLabel
|
|
352
344
|
? `in ${sessionNameLabel}`
|
|
@@ -385,46 +377,21 @@ export function installFooter(
|
|
|
385
377
|
? config.colors.contextWarning
|
|
386
378
|
: config.colors.contextNormal;
|
|
387
379
|
const cacheReadLabel = state.cacheReadLabel
|
|
388
|
-
?
|
|
389
|
-
theme,
|
|
390
|
-
colorSource,
|
|
391
|
-
config.colors.tokens,
|
|
392
|
-
state.cacheReadLabel,
|
|
393
|
-
)
|
|
380
|
+
? renderThemeStyle(theme, config.colors.tokens, state.cacheReadLabel)
|
|
394
381
|
: "";
|
|
395
382
|
const cacheWriteLabel = state.cacheWriteLabel
|
|
396
|
-
?
|
|
397
|
-
theme,
|
|
398
|
-
colorSource,
|
|
399
|
-
config.colors.tokens,
|
|
400
|
-
state.cacheWriteLabel,
|
|
401
|
-
)
|
|
383
|
+
? renderThemeStyle(theme, config.colors.tokens, state.cacheWriteLabel)
|
|
402
384
|
: "";
|
|
403
385
|
const subscriptionLabel = state.subscription
|
|
404
|
-
?
|
|
405
|
-
theme,
|
|
406
|
-
colorSource,
|
|
407
|
-
config.colors.cost,
|
|
408
|
-
"(sub)",
|
|
409
|
-
)
|
|
386
|
+
? renderThemeStyle(theme, config.colors.cost, "(sub)")
|
|
410
387
|
: "";
|
|
411
388
|
const autoCompactionLabel = state.autoCompaction
|
|
412
|
-
?
|
|
389
|
+
? renderThemeStyle(theme, contextColor, "(auto)")
|
|
413
390
|
: "";
|
|
414
391
|
const gitColor = (text: string) =>
|
|
415
|
-
|
|
416
|
-
theme,
|
|
417
|
-
colorSource,
|
|
418
|
-
config.colors.gitBranch,
|
|
419
|
-
text,
|
|
420
|
-
);
|
|
392
|
+
renderThemeStyle(theme, config.colors.gitBranch, text);
|
|
421
393
|
const gitStatusColor = (text: string) =>
|
|
422
|
-
|
|
423
|
-
theme,
|
|
424
|
-
colorSource,
|
|
425
|
-
config.colors.gitStatus,
|
|
426
|
-
text,
|
|
427
|
-
);
|
|
394
|
+
renderThemeStyle(theme, config.colors.gitStatus, text);
|
|
428
395
|
const gitIcon = config.icons.git ? gitColor(config.icons.git) : "";
|
|
429
396
|
const gitCounts =
|
|
430
397
|
config.components.footer.styles.starship.segments.gitCounts;
|
|
@@ -494,12 +461,7 @@ export function installFooter(
|
|
|
494
461
|
const label = runtime.version
|
|
495
462
|
? `${symbol} ${runtime.version}`
|
|
496
463
|
: symbol;
|
|
497
|
-
return
|
|
498
|
-
theme,
|
|
499
|
-
colorSource,
|
|
500
|
-
runtime.style,
|
|
501
|
-
label,
|
|
502
|
-
);
|
|
464
|
+
return renderThemeStyle(theme, runtime.style, label);
|
|
503
465
|
}
|
|
504
466
|
case "model":
|
|
505
467
|
return sanitizeExtensionStatusText(footerModelLabel);
|
|
@@ -507,45 +469,35 @@ export function installFooter(
|
|
|
507
469
|
return sanitizeExtensionStatusText(state.providerLabel);
|
|
508
470
|
case "session_duration":
|
|
509
471
|
return state.sessionStartEpoch
|
|
510
|
-
?
|
|
472
|
+
? renderThemeStyle(
|
|
511
473
|
theme,
|
|
512
|
-
colorSource,
|
|
513
474
|
config.colors.sessionDuration,
|
|
514
475
|
buildSessionDurationLabel(state.sessionStartEpoch),
|
|
515
476
|
)
|
|
516
477
|
: "";
|
|
517
478
|
case "username":
|
|
518
|
-
return
|
|
479
|
+
return renderThemeStyle(
|
|
519
480
|
theme,
|
|
520
|
-
colorSource,
|
|
521
481
|
config.colors.username,
|
|
522
482
|
formatUsernameHostLabel(config.icons.username),
|
|
523
483
|
);
|
|
524
484
|
case "os":
|
|
525
|
-
return
|
|
485
|
+
return renderThemeStyle(
|
|
526
486
|
theme,
|
|
527
|
-
colorSource,
|
|
528
487
|
config.colors.os,
|
|
529
488
|
formatOsLabel(config.icons.os, iconMode),
|
|
530
489
|
);
|
|
531
490
|
case "time":
|
|
532
|
-
return
|
|
491
|
+
return renderThemeStyle(
|
|
533
492
|
theme,
|
|
534
|
-
colorSource,
|
|
535
493
|
config.colors.time,
|
|
536
494
|
formatTimeLabel(config.icons.time),
|
|
537
495
|
);
|
|
538
496
|
case "context":
|
|
539
|
-
return
|
|
540
|
-
theme,
|
|
541
|
-
colorSource,
|
|
542
|
-
contextColor,
|
|
543
|
-
contextLabel,
|
|
544
|
-
);
|
|
497
|
+
return renderThemeStyle(theme, contextColor, contextLabel);
|
|
545
498
|
case "tokens":
|
|
546
|
-
return
|
|
499
|
+
return renderThemeStyle(
|
|
547
500
|
theme,
|
|
548
|
-
colorSource,
|
|
549
501
|
config.colors.tokens,
|
|
550
502
|
state.tokenLabel,
|
|
551
503
|
);
|
|
@@ -554,9 +506,8 @@ export function installFooter(
|
|
|
554
506
|
case "cache_write":
|
|
555
507
|
return cacheWriteLabel;
|
|
556
508
|
case "cost":
|
|
557
|
-
return
|
|
509
|
+
return renderThemeStyle(
|
|
558
510
|
theme,
|
|
559
|
-
colorSource,
|
|
560
511
|
config.colors.cost,
|
|
561
512
|
state.costLabel,
|
|
562
513
|
);
|
|
@@ -568,68 +519,52 @@ export function installFooter(
|
|
|
568
519
|
return formatPackageVersionSegment(
|
|
569
520
|
theme,
|
|
570
521
|
packageVersion,
|
|
571
|
-
colorSource,
|
|
572
522
|
iconMode,
|
|
573
523
|
config.icons.package,
|
|
574
524
|
config.colors.packageVersion,
|
|
575
525
|
);
|
|
576
526
|
case "package_version":
|
|
577
527
|
return packageVersion?.version
|
|
578
|
-
?
|
|
528
|
+
? renderThemeStyle(
|
|
579
529
|
theme,
|
|
580
|
-
colorSource,
|
|
581
530
|
config.colors.packageVersion,
|
|
582
531
|
packageVersion.version,
|
|
583
532
|
)
|
|
584
533
|
: "";
|
|
585
534
|
case "sep":
|
|
586
|
-
return
|
|
587
|
-
theme,
|
|
588
|
-
colorSource,
|
|
589
|
-
config.colors.separator,
|
|
590
|
-
" | ",
|
|
591
|
-
);
|
|
535
|
+
return renderThemeStyle(theme, config.colors.separator, " | ");
|
|
592
536
|
case "git_commit":
|
|
593
537
|
return formatGitCommitSegment(
|
|
594
538
|
theme,
|
|
595
539
|
commit,
|
|
596
540
|
config.components.footer.styles.starship.gitCommit,
|
|
597
|
-
colorSource,
|
|
598
541
|
config.colors.gitCommit,
|
|
599
542
|
);
|
|
600
543
|
case "git_tag":
|
|
601
544
|
return config.components.footer.styles.starship.gitCommit
|
|
602
545
|
.showTag && commit?.tag
|
|
603
|
-
?
|
|
604
|
-
theme,
|
|
605
|
-
colorSource,
|
|
606
|
-
config.colors.gitCommit,
|
|
607
|
-
commit.tag,
|
|
608
|
-
)
|
|
546
|
+
? renderThemeStyle(theme, config.colors.gitCommit, commit.tag)
|
|
609
547
|
: "";
|
|
610
548
|
case "git_metrics":
|
|
611
549
|
return formatGitMetricsSegment(
|
|
612
550
|
theme,
|
|
613
551
|
state.metrics,
|
|
614
552
|
config.components.footer.styles.starship.gitMetrics,
|
|
615
|
-
colorSource,
|
|
616
553
|
config.colors.gitMetricsAdded,
|
|
617
554
|
config.colors.gitMetricsDeleted,
|
|
618
555
|
);
|
|
619
556
|
case "git_added":
|
|
620
557
|
return state.metrics
|
|
621
|
-
?
|
|
558
|
+
? renderThemeStyle(
|
|
622
559
|
theme,
|
|
623
|
-
colorSource,
|
|
624
560
|
config.colors.gitMetricsAdded,
|
|
625
561
|
`+${state.metrics.added}`,
|
|
626
562
|
)
|
|
627
563
|
: "";
|
|
628
564
|
case "git_deleted":
|
|
629
565
|
return state.metrics
|
|
630
|
-
?
|
|
566
|
+
? renderThemeStyle(
|
|
631
567
|
theme,
|
|
632
|
-
colorSource,
|
|
633
568
|
config.colors.gitMetricsDeleted,
|
|
634
569
|
`−${state.metrics.deleted}`,
|
|
635
570
|
)
|
|
@@ -661,12 +596,7 @@ export function installFooter(
|
|
|
661
596
|
: "";
|
|
662
597
|
const inner = [shortHash, tag].filter(Boolean).join(" ");
|
|
663
598
|
branchParts.push(
|
|
664
|
-
|
|
665
|
-
theme,
|
|
666
|
-
colorSource,
|
|
667
|
-
config.colors.gitCommit,
|
|
668
|
-
`(${inner})`,
|
|
669
|
-
),
|
|
599
|
+
renderThemeStyle(theme, config.colors.gitCommit, `(${inner})`),
|
|
670
600
|
);
|
|
671
601
|
}
|
|
672
602
|
}
|
|
@@ -694,7 +624,6 @@ export function installFooter(
|
|
|
694
624
|
theme,
|
|
695
625
|
runtime,
|
|
696
626
|
config.colors.runtimePrefix,
|
|
697
|
-
colorSource,
|
|
698
627
|
iconMode,
|
|
699
628
|
)
|
|
700
629
|
: "";
|
|
@@ -703,7 +632,6 @@ export function installFooter(
|
|
|
703
632
|
? formatPackageVersionSegment(
|
|
704
633
|
theme,
|
|
705
634
|
packageVersion,
|
|
706
|
-
colorSource,
|
|
707
635
|
iconMode,
|
|
708
636
|
config.icons.package,
|
|
709
637
|
config.colors.packageVersion,
|
|
@@ -721,7 +649,6 @@ export function installFooter(
|
|
|
721
649
|
theme,
|
|
722
650
|
commit,
|
|
723
651
|
config.components.footer.styles.starship.gitCommit,
|
|
724
|
-
colorSource,
|
|
725
652
|
config.colors.gitCommit,
|
|
726
653
|
)
|
|
727
654
|
: "";
|
|
@@ -731,7 +658,6 @@ export function installFooter(
|
|
|
731
658
|
theme,
|
|
732
659
|
state.metrics,
|
|
733
660
|
config.components.footer.styles.starship.gitMetrics,
|
|
734
|
-
colorSource,
|
|
735
661
|
config.colors.gitMetricsAdded,
|
|
736
662
|
config.colors.gitMetricsDeleted,
|
|
737
663
|
)
|
|
@@ -745,10 +671,9 @@ export function installFooter(
|
|
|
745
671
|
)
|
|
746
672
|
return "";
|
|
747
673
|
const timeLabel = buildSessionDurationLabel(state.sessionStartEpoch);
|
|
748
|
-
const prefix =
|
|
749
|
-
const time =
|
|
674
|
+
const prefix = renderThemeStyle(theme, "", "up for");
|
|
675
|
+
const time = renderThemeStyle(
|
|
750
676
|
theme,
|
|
751
|
-
colorSource,
|
|
752
677
|
config.colors.sessionDuration,
|
|
753
678
|
timeLabel,
|
|
754
679
|
);
|
|
@@ -756,17 +681,15 @@ export function installFooter(
|
|
|
756
681
|
})();
|
|
757
682
|
const usernameSegment = config.components.footer.styles.starship
|
|
758
683
|
.segments.username
|
|
759
|
-
?
|
|
684
|
+
? renderThemeStyle(
|
|
760
685
|
theme,
|
|
761
|
-
colorSource,
|
|
762
686
|
config.colors.username,
|
|
763
687
|
formatUsernameHostLabel(config.icons.username),
|
|
764
688
|
)
|
|
765
689
|
: "";
|
|
766
690
|
const osSegment = config.components.footer.styles.starship.segments.os
|
|
767
|
-
?
|
|
691
|
+
? renderThemeStyle(
|
|
768
692
|
theme,
|
|
769
|
-
colorSource,
|
|
770
693
|
config.colors.os,
|
|
771
694
|
formatOsLabel(config.icons.os, iconMode),
|
|
772
695
|
)
|
|
@@ -797,38 +720,27 @@ export function installFooter(
|
|
|
797
720
|
: "";
|
|
798
721
|
const timeSegment = config.components.footer.styles.starship.segments
|
|
799
722
|
.time
|
|
800
|
-
?
|
|
723
|
+
? renderThemeStyle(
|
|
801
724
|
theme,
|
|
802
|
-
colorSource,
|
|
803
725
|
config.colors.time,
|
|
804
726
|
formatTimeLabel(config.icons.time),
|
|
805
727
|
)
|
|
806
728
|
: "";
|
|
807
729
|
const builtInContextLabel = [
|
|
808
|
-
|
|
730
|
+
renderThemeStyle(theme, contextColor, contextLabel),
|
|
809
731
|
autoCompactionLabel,
|
|
810
732
|
]
|
|
811
733
|
.filter(Boolean)
|
|
812
734
|
.join(" ");
|
|
813
735
|
const builtInTokenLabel = [
|
|
814
|
-
|
|
815
|
-
theme,
|
|
816
|
-
colorSource,
|
|
817
|
-
config.colors.tokens,
|
|
818
|
-
state.tokenLabel,
|
|
819
|
-
),
|
|
736
|
+
renderThemeStyle(theme, config.colors.tokens, state.tokenLabel),
|
|
820
737
|
cacheReadLabel,
|
|
821
738
|
cacheWriteLabel,
|
|
822
739
|
]
|
|
823
740
|
.filter(Boolean)
|
|
824
741
|
.join(" ");
|
|
825
742
|
const builtInCostLabel = [
|
|
826
|
-
|
|
827
|
-
theme,
|
|
828
|
-
colorSource,
|
|
829
|
-
config.colors.cost,
|
|
830
|
-
state.costLabel,
|
|
831
|
-
),
|
|
743
|
+
renderThemeStyle(theme, config.colors.cost, state.costLabel),
|
|
832
744
|
subscriptionLabel,
|
|
833
745
|
]
|
|
834
746
|
.filter(Boolean)
|
|
@@ -870,9 +782,8 @@ export function installFooter(
|
|
|
870
782
|
const renderExtensionStatus = (segment: ExtensionStatusSegment) =>
|
|
871
783
|
segment.colorMode === "original"
|
|
872
784
|
? segment.text
|
|
873
|
-
:
|
|
785
|
+
: renderThemeStyle(
|
|
874
786
|
theme,
|
|
875
|
-
colorSource,
|
|
876
787
|
config.colors.extensionStatus,
|
|
877
788
|
segment.text,
|
|
878
789
|
);
|
|
@@ -936,7 +847,6 @@ export function installFooter(
|
|
|
936
847
|
const compactCwdLabel = truncateToWidth(
|
|
937
848
|
renderSourceColor(
|
|
938
849
|
theme,
|
|
939
|
-
colorSource,
|
|
940
850
|
config.colors.cwd,
|
|
941
851
|
"cwd",
|
|
942
852
|
"bold cyan",
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
} from "@earendil-works/pi-ai";
|
|
5
5
|
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { Text } from "@earendil-works/pi-tui";
|
|
7
|
-
import type {
|
|
7
|
+
import type { ColorSpec } from "../../app/config/shell.ts";
|
|
8
8
|
import { formatCount, formatElapsedDuration } from "../../shared/format.ts";
|
|
9
9
|
import { isSafeSgrStylePrefix } from "../../shared/style.ts";
|
|
10
10
|
import { renderWorkingLineHigh } from "./working-line.ts";
|
|
@@ -1218,13 +1218,11 @@ export function renderTurnSummaryEntry(
|
|
|
1218
1218
|
return new Text(`${entry.data.stylePrefix}${text}${SGR_RESET}`, 0, 0);
|
|
1219
1219
|
}
|
|
1220
1220
|
const options = (themeOptions ?? {}) as {
|
|
1221
|
-
colorSource?: ColorSource;
|
|
1222
1221
|
workingLineHigh?: ColorSpec;
|
|
1223
1222
|
};
|
|
1224
1223
|
return new Text(
|
|
1225
1224
|
`${renderWorkingLineHigh(
|
|
1226
1225
|
theme,
|
|
1227
|
-
options.colorSource === "terminal" ? "terminal" : "theme",
|
|
1228
1226
|
options.workingLineHigh,
|
|
1229
1227
|
text,
|
|
1230
1228
|
)}${SGR_RESET}`,
|