@agi-fans/dsh-tui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/lib/autocomplete.d.ts +80 -0
- package/lib/autocomplete.js +320 -0
- package/lib/autocomplete.js.map +1 -0
- package/lib/box.d.ts +79 -0
- package/lib/box.js +276 -0
- package/lib/box.js.map +1 -0
- package/lib/clipboard.d.ts +19 -0
- package/lib/clipboard.js +77 -0
- package/lib/clipboard.js.map +1 -0
- package/lib/command-integrations.d.ts +10 -0
- package/lib/command-integrations.js +49 -0
- package/lib/command-integrations.js.map +1 -0
- package/lib/command-mode.d.ts +5 -0
- package/lib/command-mode.js +73 -0
- package/lib/command-mode.js.map +1 -0
- package/lib/command-model.d.ts +5 -0
- package/lib/command-model.js +87 -0
- package/lib/command-model.js.map +1 -0
- package/lib/command-output.d.ts +6 -0
- package/lib/command-output.js +33 -0
- package/lib/command-output.js.map +1 -0
- package/lib/command-queue.d.ts +5 -0
- package/lib/command-queue.js +62 -0
- package/lib/command-queue.js.map +1 -0
- package/lib/command-registration.d.ts +5 -0
- package/lib/command-registration.js +20 -0
- package/lib/command-registration.js.map +1 -0
- package/lib/command-session.d.ts +5 -0
- package/lib/command-session.js +153 -0
- package/lib/command-session.js.map +1 -0
- package/lib/command-transcript.d.ts +5 -0
- package/lib/command-transcript.js +85 -0
- package/lib/command-transcript.js.map +1 -0
- package/lib/copy-selector.d.ts +52 -0
- package/lib/copy-selector.js +136 -0
- package/lib/copy-selector.js.map +1 -0
- package/lib/copy-targets.d.ts +34 -0
- package/lib/copy-targets.js +170 -0
- package/lib/copy-targets.js.map +1 -0
- package/lib/definition.d.ts +171 -0
- package/lib/definition.js +14 -0
- package/lib/definition.js.map +1 -0
- package/lib/editor.d.ts +66 -0
- package/lib/editor.js +365 -0
- package/lib/editor.js.map +1 -0
- package/lib/event-views.d.ts +188 -0
- package/lib/event-views.js +678 -0
- package/lib/event-views.js.map +1 -0
- package/lib/external-editor.d.ts +2 -0
- package/lib/external-editor.js +31 -0
- package/lib/external-editor.js.map +1 -0
- package/lib/history-search.d.ts +61 -0
- package/lib/history-search.js +239 -0
- package/lib/history-search.js.map +1 -0
- package/lib/history-store.d.ts +8 -0
- package/lib/history-store.js +36 -0
- package/lib/history-store.js.map +1 -0
- package/lib/hotkeys.d.ts +14 -0
- package/lib/hotkeys.js +115 -0
- package/lib/hotkeys.js.map +1 -0
- package/lib/human-interaction.d.ts +5 -0
- package/lib/human-interaction.js +8 -0
- package/lib/human-interaction.js.map +1 -0
- package/lib/image-paste.d.ts +21 -0
- package/lib/image-paste.js +277 -0
- package/lib/image-paste.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/interaction-adapter.d.ts +18 -0
- package/lib/interaction-adapter.js +93 -0
- package/lib/interaction-adapter.js.map +1 -0
- package/lib/keybindings-config.d.ts +5 -0
- package/lib/keybindings-config.js +28 -0
- package/lib/keybindings-config.js.map +1 -0
- package/lib/keys.d.ts +59 -0
- package/lib/keys.js +263 -0
- package/lib/keys.js.map +1 -0
- package/lib/markdown.d.ts +13 -0
- package/lib/markdown.js +453 -0
- package/lib/markdown.js.map +1 -0
- package/lib/path-complete.d.ts +85 -0
- package/lib/path-complete.js +231 -0
- package/lib/path-complete.js.map +1 -0
- package/lib/path-mentions.d.ts +4 -0
- package/lib/path-mentions.js +50 -0
- package/lib/path-mentions.js.map +1 -0
- package/lib/project-context.d.ts +13 -0
- package/lib/project-context.js +52 -0
- package/lib/project-context.js.map +1 -0
- package/lib/project-file-search.d.ts +25 -0
- package/lib/project-file-search.js +207 -0
- package/lib/project-file-search.js.map +1 -0
- package/lib/prompt-selector.d.ts +56 -0
- package/lib/prompt-selector.js +297 -0
- package/lib/prompt-selector.js.map +1 -0
- package/lib/provider-local.d.ts +115 -0
- package/lib/provider-local.js +1760 -0
- package/lib/provider-local.js.map +1 -0
- package/lib/pwd.d.ts +13 -0
- package/lib/pwd.js +14 -0
- package/lib/pwd.js.map +1 -0
- package/lib/relative-time.d.ts +2 -0
- package/lib/relative-time.js +11 -0
- package/lib/relative-time.js.map +1 -0
- package/lib/renderer.d.ts +112 -0
- package/lib/renderer.js +181 -0
- package/lib/renderer.js.map +1 -0
- package/lib/runner.d.ts +9 -0
- package/lib/runner.js +94 -0
- package/lib/runner.js.map +1 -0
- package/lib/session-controller.d.ts +92 -0
- package/lib/session-controller.js +571 -0
- package/lib/session-controller.js.map +1 -0
- package/lib/session-runtime.d.ts +16 -0
- package/lib/session-runtime.js +17 -0
- package/lib/session-runtime.js.map +1 -0
- package/lib/settings-list.d.ts +67 -0
- package/lib/settings-list.js +380 -0
- package/lib/settings-list.js.map +1 -0
- package/lib/status-config.d.ts +32 -0
- package/lib/status-config.js +52 -0
- package/lib/status-config.js.map +1 -0
- package/lib/status-line.d.ts +41 -0
- package/lib/status-line.js +351 -0
- package/lib/status-line.js.map +1 -0
- package/lib/style.d.ts +22 -0
- package/lib/style.js +23 -0
- package/lib/style.js.map +1 -0
- package/lib/theme.d.ts +83 -0
- package/lib/theme.js +317 -0
- package/lib/theme.js.map +1 -0
- package/lib/tool-presentation.d.ts +20 -0
- package/lib/tool-presentation.js +79 -0
- package/lib/tool-presentation.js.map +1 -0
- package/lib/tool-renderers.d.ts +21 -0
- package/lib/tool-renderers.js +133 -0
- package/lib/tool-renderers.js.map +1 -0
- package/lib/tools-list.d.ts +14 -0
- package/lib/tools-list.js +61 -0
- package/lib/tools-list.js.map +1 -0
- package/lib/transcript-export.d.ts +4 -0
- package/lib/transcript-export.js +66 -0
- package/lib/transcript-export.js.map +1 -0
- package/lib/tui-settings.d.ts +20 -0
- package/lib/tui-settings.js +23 -0
- package/lib/tui-settings.js.map +1 -0
- package/lib/welcome-tips.d.ts +10 -0
- package/lib/welcome-tips.js +36 -0
- package/lib/welcome-tips.js.map +1 -0
- package/lib/width.d.ts +54 -0
- package/lib/width.js +323 -0
- package/lib/width.js.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status-line customization shared by settings, persistence, and rendering.
|
|
3
|
+
* @module @agi-fans/dsh-tui/status-config
|
|
4
|
+
*/
|
|
5
|
+
/** Stable telemetry groups users can show, hide, and reorder. */
|
|
6
|
+
export const STATUS_GROUP_IDS = ['context', 'cache', 'tokens', 'speed', 'durations', 'counts'];
|
|
7
|
+
export const STATUS_LABEL_STYLES = ['compact', 'full'];
|
|
8
|
+
/** Legacy value accepted while existing settings documents migrate. */
|
|
9
|
+
export const STATUS_PRESETS = ['minimal', 'compact', 'full'];
|
|
10
|
+
export const DEFAULT_STATUS_GROUPS = STATUS_GROUP_IDS;
|
|
11
|
+
/** Return a fresh default so callers can safely replace its group list. */
|
|
12
|
+
export function defaultStatusBarConfig() {
|
|
13
|
+
return {
|
|
14
|
+
enabled: true,
|
|
15
|
+
labels: 'compact',
|
|
16
|
+
groups: [...DEFAULT_STATUS_GROUPS],
|
|
17
|
+
order: [...DEFAULT_STATUS_GROUPS],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function isStatusGroupId(value) {
|
|
21
|
+
return typeof value === 'string' && STATUS_GROUP_IDS.includes(value);
|
|
22
|
+
}
|
|
23
|
+
function isStatusLabelStyle(value) {
|
|
24
|
+
return typeof value === 'string' && STATUS_LABEL_STYLES.includes(value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Normalize persisted input at the single configuration seam. Invalid and
|
|
28
|
+
* duplicate groups disappear; legacy presets retain their previous meaning.
|
|
29
|
+
*/
|
|
30
|
+
export function resolveStatusBarConfig(config, legacyPreset) {
|
|
31
|
+
if (config === undefined) {
|
|
32
|
+
const fallback = defaultStatusBarConfig();
|
|
33
|
+
if (legacyPreset === 'minimal')
|
|
34
|
+
fallback.enabled = false;
|
|
35
|
+
if (legacyPreset === 'full')
|
|
36
|
+
fallback.labels = 'full';
|
|
37
|
+
return fallback;
|
|
38
|
+
}
|
|
39
|
+
const groups = config.groups === undefined
|
|
40
|
+
? [...DEFAULT_STATUS_GROUPS]
|
|
41
|
+
: [...new Set(config.groups.filter(isStatusGroupId))];
|
|
42
|
+
const explicitOrder = config.order?.filter(isStatusGroupId);
|
|
43
|
+
const ordered = [...new Set(explicitOrder === undefined ? groups : explicitOrder)];
|
|
44
|
+
const order = [...ordered, ...STATUS_GROUP_IDS.filter(id => !ordered.includes(id))];
|
|
45
|
+
return {
|
|
46
|
+
enabled: config.enabled ?? true,
|
|
47
|
+
labels: isStatusLabelStyle(config.labels) ? config.labels : 'compact',
|
|
48
|
+
groups,
|
|
49
|
+
order,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=status-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-config.js","sourceRoot":"","sources":["../src/status-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iEAAiE;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAU,CAAA;AAGvG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,MAAM,CAAU,CAAA;AAiB/D,uEAAuE;AACvE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAU,CAAA;AAGrE,MAAM,CAAC,MAAM,qBAAqB,GAA6B,gBAAgB,CAAA;AAE/E,2EAA2E;AAC3E,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,CAAC,GAAG,qBAAqB,CAAC;QAClC,KAAK,EAAE,CAAC,GAAG,qBAAqB,CAAC;KAClC,CAAA;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAA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M,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;QACrE,MAAM;QACN,KAAK;KACN,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed two-line session footer rendered below the composer.
|
|
3
|
+
*
|
|
4
|
+
* The caller supplies one stable projection; this module owns copy,
|
|
5
|
+
* responsive group selection, color hierarchy, and terminal layout. English
|
|
6
|
+
* copy deliberately stays local until a runtime language module provides a
|
|
7
|
+
* second locale — then this is the single seam where a dictionary is chosen.
|
|
8
|
+
* @module @agi-fans/dsh-tui/status-line
|
|
9
|
+
*/
|
|
10
|
+
import type { TuiSessionControls, TuiSessionStats } from './definition.ts';
|
|
11
|
+
import { type StatusBarConfig } from './status-config.ts';
|
|
12
|
+
import type { Theme } from './theme.ts';
|
|
13
|
+
/** Context needed to render the fixed session footer. */
|
|
14
|
+
export interface StatusFooterOptions {
|
|
15
|
+
model: string;
|
|
16
|
+
reasoningEffort?: string;
|
|
17
|
+
controls?: TuiSessionControls;
|
|
18
|
+
pwd?: string;
|
|
19
|
+
branch?: string;
|
|
20
|
+
stats?: TuiSessionStats;
|
|
21
|
+
config: StatusBarConfig;
|
|
22
|
+
width: number;
|
|
23
|
+
}
|
|
24
|
+
/** Compact token count: 517 / 12.2K / 517K / 1.2M. */
|
|
25
|
+
export declare function formatTokens(value: number): string;
|
|
26
|
+
/** Compact duration: 45.2s under a minute, 2m42s from there on. */
|
|
27
|
+
export declare function formatDuration(ms: number): string;
|
|
28
|
+
/** Human-readable model throughput with the same precision as dsh web. */
|
|
29
|
+
export declare function formatTokensPerSecond(value: number): string;
|
|
30
|
+
/** Build the unpainted English groups for diagnostics and tests. */
|
|
31
|
+
export declare function sessionStatusGroups(stats: TuiSessionStats, config?: StatusBarConfig): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Render the fixed footer: model/workspace metadata first, customizable
|
|
34
|
+
* session telemetry second. Both rows use left/right columns and exact width.
|
|
35
|
+
*/
|
|
36
|
+
export declare function renderStatusFooter(options: StatusFooterOptions, theme: Theme): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Render the telemetry row without footer metadata. Used by the settings
|
|
39
|
+
* preview and retained as a compatibility seam for direct render callers.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderSessionStatusLabel(stats: TuiSessionStats | undefined, config: StatusBarConfig, theme: Theme, width: number): string;
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed two-line session footer rendered below the composer.
|
|
3
|
+
*
|
|
4
|
+
* The caller supplies one stable projection; this module owns copy,
|
|
5
|
+
* responsive group selection, color hierarchy, and terminal layout. English
|
|
6
|
+
* copy deliberately stays local until a runtime language module provides a
|
|
7
|
+
* second locale — then this is the single seam where a dictionary is chosen.
|
|
8
|
+
* @module @agi-fans/dsh-tui/status-line
|
|
9
|
+
*/
|
|
10
|
+
import { defaultStatusBarConfig, resolveStatusBarConfig } from "./status-config.js";
|
|
11
|
+
import { padToWidth, truncateToWidth, visibleWidth } from "./width.js";
|
|
12
|
+
const LABEL_PADDING = 2;
|
|
13
|
+
const GROUP_SEPARATOR = ' • ';
|
|
14
|
+
const FOOTER_PADDING = 2;
|
|
15
|
+
const COLUMN_GAP = 3;
|
|
16
|
+
const RIGHT_GROUPS = new Set(['durations', 'counts']);
|
|
17
|
+
/** Compact token count: 517 / 12.2K / 517K / 1.2M. */
|
|
18
|
+
export function formatTokens(value) {
|
|
19
|
+
const scaled = (n) => n >= 100 ? String(Math.round(n)) : String(Math.round(n * 10) / 10);
|
|
20
|
+
if (value < 1_000)
|
|
21
|
+
return String(value);
|
|
22
|
+
if (value < 1_000_000)
|
|
23
|
+
return `${scaled(value / 1_000)}K`;
|
|
24
|
+
return `${scaled(value / 1_000_000)}M`;
|
|
25
|
+
}
|
|
26
|
+
/** Compact duration: 45.2s under a minute, 2m42s from there on. */
|
|
27
|
+
export function formatDuration(ms) {
|
|
28
|
+
const seconds = ms / 1_000;
|
|
29
|
+
if (seconds < 60)
|
|
30
|
+
return `${Math.round(seconds * 10) / 10}s`;
|
|
31
|
+
const whole = Math.round(seconds);
|
|
32
|
+
return `${Math.floor(whole / 60)}m${whole % 60}s`;
|
|
33
|
+
}
|
|
34
|
+
/** Human-readable model throughput with the same precision as dsh web. */
|
|
35
|
+
export function formatTokensPerSecond(value) {
|
|
36
|
+
return value >= 10 ? String(Math.round(value)) : String(Math.round(value * 10) / 10);
|
|
37
|
+
}
|
|
38
|
+
function formatContextPercent(tokens, window) {
|
|
39
|
+
const percent = Math.max(0, tokens) / window * 100;
|
|
40
|
+
const rounded = percent < 10 ? Math.round(percent * 10) / 10 : Math.round(percent);
|
|
41
|
+
return String(rounded);
|
|
42
|
+
}
|
|
43
|
+
function part(text, tone) {
|
|
44
|
+
return { text, tone };
|
|
45
|
+
}
|
|
46
|
+
function metric(label, value, tone = 'value') {
|
|
47
|
+
return [part(label + ' ', 'label'), part(value, tone)];
|
|
48
|
+
}
|
|
49
|
+
/** English semantic groups; language selection will replace copy here. */
|
|
50
|
+
function buildStatusGroups(stats, config) {
|
|
51
|
+
const groups = [];
|
|
52
|
+
if (stats.contextWindow !== undefined && stats.contextWindow > 0) {
|
|
53
|
+
const used = stats.contextTokens ?? 0;
|
|
54
|
+
groups.push({
|
|
55
|
+
id: 'context',
|
|
56
|
+
parts: [
|
|
57
|
+
...metric(config.labels === 'compact' ? 'Ctx' : 'Context', `${formatContextPercent(used, stats.contextWindow)}%`),
|
|
58
|
+
part(' · ', 'separator'),
|
|
59
|
+
part(`${formatTokens(used)}/${formatTokens(stats.contextWindow)}`, 'token'),
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
groups.push({
|
|
64
|
+
id: 'counts',
|
|
65
|
+
parts: [
|
|
66
|
+
part(String(stats.turns), 'value'),
|
|
67
|
+
part(stats.turns === 1 ? ' turn' : ' turns', 'label'),
|
|
68
|
+
part(' · ', 'separator'),
|
|
69
|
+
part(String(stats.steps), 'value'),
|
|
70
|
+
part(stats.steps === 1 ? ' step' : ' steps', 'label'),
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
if (stats.steps > 0) {
|
|
74
|
+
const durations = [];
|
|
75
|
+
if (stats.llmMs > 0)
|
|
76
|
+
durations.push(...metric('LLM', formatDuration(stats.llmMs)));
|
|
77
|
+
if (stats.llmMs > 0 && stats.toolMs > 0)
|
|
78
|
+
durations.push(part(' · ', 'separator'));
|
|
79
|
+
if (stats.toolMs > 0)
|
|
80
|
+
durations.push(...metric('Tools', formatDuration(stats.toolMs)));
|
|
81
|
+
if (durations.length > 0)
|
|
82
|
+
groups.push({ id: 'durations', parts: durations });
|
|
83
|
+
const speed = [];
|
|
84
|
+
if (stats.ttftSteps > 0)
|
|
85
|
+
speed.push(...metric('TTFT', formatDuration(stats.ttftMs / stats.ttftSteps)));
|
|
86
|
+
if (stats.ttftSteps > 0 && stats.decodeMs > 0)
|
|
87
|
+
speed.push(part(' · ', 'separator'));
|
|
88
|
+
if (stats.decodeMs > 0) {
|
|
89
|
+
speed.push(part(`${formatTokensPerSecond(stats.decodeTokens / (stats.decodeMs / 1_000))} tok/s`, 'value'));
|
|
90
|
+
}
|
|
91
|
+
if (speed.length > 0)
|
|
92
|
+
groups.push({ id: 'speed', parts: speed });
|
|
93
|
+
}
|
|
94
|
+
if (stats.inputTokens > 0 || stats.outputTokens > 0) {
|
|
95
|
+
if (stats.inputTokens > 0) {
|
|
96
|
+
groups.push({
|
|
97
|
+
id: 'cache',
|
|
98
|
+
parts: metric('Cache', `${Math.round(stats.cacheReadTokens / stats.inputTokens * 100)}%`, 'positive'),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
groups.push({
|
|
102
|
+
id: 'tokens',
|
|
103
|
+
parts: [
|
|
104
|
+
part(formatTokens(stats.inputTokens), 'token'),
|
|
105
|
+
part(' in', 'label'),
|
|
106
|
+
part(' · ', 'separator'),
|
|
107
|
+
part(formatTokens(stats.outputTokens), 'token'),
|
|
108
|
+
part(' out', 'label'),
|
|
109
|
+
],
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return config.groups.flatMap(id => groups.filter(group => group.id === id));
|
|
113
|
+
}
|
|
114
|
+
function groupText(group) {
|
|
115
|
+
return group.parts.map(item => item.text).join('');
|
|
116
|
+
}
|
|
117
|
+
/** Build the unpainted English groups for diagnostics and tests. */
|
|
118
|
+
export function sessionStatusGroups(stats, config = defaultStatusBarConfig()) {
|
|
119
|
+
const normalized = resolveStatusBarConfig(config);
|
|
120
|
+
if (!normalized.enabled)
|
|
121
|
+
return [];
|
|
122
|
+
return buildStatusGroups(stats, normalized).map(groupText);
|
|
123
|
+
}
|
|
124
|
+
function groupsWidth(groups) {
|
|
125
|
+
if (groups.length === 0)
|
|
126
|
+
return 0;
|
|
127
|
+
return groups.reduce((total, group) => total + visibleWidth(groupText(group)), 0)
|
|
128
|
+
+ GROUP_SEPARATOR.length * (groups.length - 1);
|
|
129
|
+
}
|
|
130
|
+
function layoutWidth(groups) {
|
|
131
|
+
return LABEL_PADDING + groupsWidth(groups);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Keep complete metric groups instead of truncating the sentence. Cache and
|
|
135
|
+
* token usage survive first, followed by latency/rate, timings, then counts.
|
|
136
|
+
*/
|
|
137
|
+
function selectGroups(groups, width) {
|
|
138
|
+
const selected = [];
|
|
139
|
+
for (const group of groups) {
|
|
140
|
+
const candidate = [...selected, group];
|
|
141
|
+
if (layoutWidth(candidate) > width)
|
|
142
|
+
break;
|
|
143
|
+
selected.push(group);
|
|
144
|
+
}
|
|
145
|
+
return selected;
|
|
146
|
+
}
|
|
147
|
+
function toneColor(tone) {
|
|
148
|
+
if (tone === 'value')
|
|
149
|
+
return 'text';
|
|
150
|
+
if (tone === 'positive')
|
|
151
|
+
return 'success';
|
|
152
|
+
if (tone === 'token')
|
|
153
|
+
return 'customMessageLabel';
|
|
154
|
+
return tone === 'separator' ? 'dim' : 'muted';
|
|
155
|
+
}
|
|
156
|
+
function paintGroup(group, theme) {
|
|
157
|
+
return group.parts.map(item => theme.fg(toneColor(item.tone), item.text)).join('');
|
|
158
|
+
}
|
|
159
|
+
function paintColumn(groups, theme) {
|
|
160
|
+
const separator = theme.fg('dim', GROUP_SEPARATOR);
|
|
161
|
+
return groups.map(group => paintGroup(group, theme)).join(separator);
|
|
162
|
+
}
|
|
163
|
+
function splitWidth(left, right) {
|
|
164
|
+
const leftWidth = groupsWidth(left);
|
|
165
|
+
const rightWidth = groupsWidth(right);
|
|
166
|
+
return leftWidth + rightWidth + (leftWidth > 0 && rightWidth > 0 ? COLUMN_GAP : 0);
|
|
167
|
+
}
|
|
168
|
+
/** Select whole groups in user order, then place timing/activity on the right. */
|
|
169
|
+
function selectFooterGroups(groups, width) {
|
|
170
|
+
const left = [];
|
|
171
|
+
const right = [];
|
|
172
|
+
for (const group of groups) {
|
|
173
|
+
const candidateLeft = RIGHT_GROUPS.has(group.id) ? left : [...left, group];
|
|
174
|
+
const candidateRight = RIGHT_GROUPS.has(group.id) ? [...right, group] : right;
|
|
175
|
+
if (splitWidth(candidateLeft, candidateRight) > width)
|
|
176
|
+
break;
|
|
177
|
+
if (RIGHT_GROUPS.has(group.id))
|
|
178
|
+
right.push(group);
|
|
179
|
+
else
|
|
180
|
+
left.push(group);
|
|
181
|
+
}
|
|
182
|
+
return { left, right };
|
|
183
|
+
}
|
|
184
|
+
function renderSplitRow(left, right, width) {
|
|
185
|
+
if (width <= 0)
|
|
186
|
+
return '';
|
|
187
|
+
const padding = width >= FOOTER_PADDING * 2 ? FOOTER_PADDING : 0;
|
|
188
|
+
const innerWidth = Math.max(0, width - padding * 2);
|
|
189
|
+
const leftWidth = visibleWidth(left);
|
|
190
|
+
const rightWidth = visibleWidth(right);
|
|
191
|
+
if (leftWidth === 0 || rightWidth === 0) {
|
|
192
|
+
const content = leftWidth > 0 ? truncateToWidth(left, innerWidth) : truncateToWidth(right, innerWidth);
|
|
193
|
+
return padToWidth(' '.repeat(padding) + content, width);
|
|
194
|
+
}
|
|
195
|
+
const gap = Math.max(1, innerWidth - leftWidth - rightWidth);
|
|
196
|
+
return padToWidth(' '.repeat(padding) + left + ' '.repeat(gap) + right, width);
|
|
197
|
+
}
|
|
198
|
+
function planStatus(plan) {
|
|
199
|
+
if (plan === undefined)
|
|
200
|
+
return undefined;
|
|
201
|
+
if (plan.pending)
|
|
202
|
+
return plan.active
|
|
203
|
+
? { text: 'PLAN→DEFAULT', tone: 'warning' }
|
|
204
|
+
: { text: 'PLAN…', tone: 'accent' };
|
|
205
|
+
return plan.active ? { text: 'PLAN', tone: 'accent' } : undefined;
|
|
206
|
+
}
|
|
207
|
+
function fitModelColumn(model, effort, plan, theme, width) {
|
|
208
|
+
if (width <= 0)
|
|
209
|
+
return '';
|
|
210
|
+
const mode = planStatus(plan);
|
|
211
|
+
if (mode === undefined) {
|
|
212
|
+
if (effort === undefined || effort === '')
|
|
213
|
+
return theme.fg('text', truncateToWidth(model, width));
|
|
214
|
+
const separator = ' · ';
|
|
215
|
+
const effortWidth = visibleWidth(effort);
|
|
216
|
+
if (effortWidth >= width)
|
|
217
|
+
return theme.fg('customMessageLabel', truncateToWidth(effort, width));
|
|
218
|
+
const modelWidth = Math.max(1, width - visibleWidth(separator) - effortWidth);
|
|
219
|
+
return theme.fg('text', truncateToWidth(model, modelWidth))
|
|
220
|
+
+ theme.fg('dim', separator)
|
|
221
|
+
+ theme.fg('customMessageLabel', effort);
|
|
222
|
+
}
|
|
223
|
+
const separator = ' · ';
|
|
224
|
+
const modeWidth = visibleWidth(mode.text);
|
|
225
|
+
if (modeWidth + visibleWidth(separator) >= width)
|
|
226
|
+
return theme.fg(mode.tone, truncateToWidth(mode.text, width));
|
|
227
|
+
const prefixWidth = width - visibleWidth(separator) - modeWidth;
|
|
228
|
+
const prefix = effort === undefined || effort === ''
|
|
229
|
+
? theme.fg('text', truncateToWidth(model, Math.max(1, prefixWidth)))
|
|
230
|
+
: (() => {
|
|
231
|
+
const effortWidth = visibleWidth(effort);
|
|
232
|
+
if (effortWidth + visibleWidth(separator) >= prefixWidth) {
|
|
233
|
+
return theme.fg('customMessageLabel', truncateToWidth(effort, Math.max(1, prefixWidth)));
|
|
234
|
+
}
|
|
235
|
+
const modelWidth = Math.max(1, prefixWidth - visibleWidth(separator) - effortWidth);
|
|
236
|
+
return theme.fg('text', truncateToWidth(model, modelWidth))
|
|
237
|
+
+ theme.fg('dim', separator)
|
|
238
|
+
+ theme.fg('customMessageLabel', effort);
|
|
239
|
+
})();
|
|
240
|
+
return prefix + theme.fg('dim', separator) + theme.fg(mode.tone, mode.text);
|
|
241
|
+
}
|
|
242
|
+
function fitLocationColumn(pwd, branch, theme, width) {
|
|
243
|
+
if (width <= 0)
|
|
244
|
+
return '';
|
|
245
|
+
if (branch === undefined || branch === '')
|
|
246
|
+
return theme.fg('muted', truncateToWidth(pwd ?? '', width));
|
|
247
|
+
const branchTone = /(?:^|\s)[*?]\d+/.test(branch) ? 'warning' : 'muted';
|
|
248
|
+
if (pwd === undefined || pwd === '')
|
|
249
|
+
return theme.fg(branchTone, truncateToWidth(branch, width));
|
|
250
|
+
const separator = ' · ';
|
|
251
|
+
const branchWidth = visibleWidth(branch);
|
|
252
|
+
if (branchWidth >= width)
|
|
253
|
+
return theme.fg(branchTone, truncateToWidth(branch, width));
|
|
254
|
+
const pwdWidth = Math.max(1, width - visibleWidth(separator) - branchWidth);
|
|
255
|
+
return theme.fg('muted', truncateToWidth(pwd, pwdWidth))
|
|
256
|
+
+ theme.fg('dim', separator)
|
|
257
|
+
+ theme.fg(branchTone, branch);
|
|
258
|
+
}
|
|
259
|
+
function permissionTone(permission) {
|
|
260
|
+
if (permission === 'danger-full-access' || permission === 'custom')
|
|
261
|
+
return 'error';
|
|
262
|
+
if (permission === 'read-only')
|
|
263
|
+
return 'accent';
|
|
264
|
+
return 'success';
|
|
265
|
+
}
|
|
266
|
+
function permissionLabel(permission) {
|
|
267
|
+
if (permission === 'danger-full-access')
|
|
268
|
+
return 'FULL ACCESS';
|
|
269
|
+
if (permission === 'workspace-write')
|
|
270
|
+
return 'workspace-write';
|
|
271
|
+
if (permission === 'read-only')
|
|
272
|
+
return 'read-only';
|
|
273
|
+
return permission === 'custom' ? 'CUSTOM ACCESS' : permission;
|
|
274
|
+
}
|
|
275
|
+
function fitWorkspaceColumn(pwd, branch, permission, theme, width) {
|
|
276
|
+
if (permission === undefined || permission === '')
|
|
277
|
+
return fitLocationColumn(pwd, branch, theme, width);
|
|
278
|
+
const label = permissionLabel(permission);
|
|
279
|
+
const separator = ' · ';
|
|
280
|
+
const labelWidth = visibleWidth(label);
|
|
281
|
+
if (labelWidth >= width)
|
|
282
|
+
return theme.fg(permissionTone(permission), truncateToWidth(label, width));
|
|
283
|
+
const locationWidth = width - labelWidth - visibleWidth(separator);
|
|
284
|
+
const location = fitLocationColumn(pwd, branch, theme, locationWidth);
|
|
285
|
+
if (location === '')
|
|
286
|
+
return theme.fg(permissionTone(permission), label);
|
|
287
|
+
return theme.fg(permissionTone(permission), label) + theme.fg('dim', separator) + location;
|
|
288
|
+
}
|
|
289
|
+
function metadataColumns(options, theme, innerWidth) {
|
|
290
|
+
const plan = planStatus(options.controls?.plan);
|
|
291
|
+
const permission = options.controls?.permission;
|
|
292
|
+
const rawLeftWidth = visibleWidth(options.model)
|
|
293
|
+
+ (options.reasoningEffort === undefined || options.reasoningEffort === '' ? 0 : 3 + visibleWidth(options.reasoningEffort))
|
|
294
|
+
+ (plan === undefined ? 0 : 3 + visibleWidth(plan.text));
|
|
295
|
+
const rawLocationWidth = visibleWidth(options.pwd ?? '')
|
|
296
|
+
+ (options.branch === undefined || options.branch === '' ? 0 : 3 + visibleWidth(options.branch));
|
|
297
|
+
const rawRightWidth = rawLocationWidth
|
|
298
|
+
+ (permission === undefined || permission === ''
|
|
299
|
+
? 0
|
|
300
|
+
: visibleWidth(permissionLabel(permission)) + (rawLocationWidth === 0 ? 0 : 3));
|
|
301
|
+
if (rawRightWidth === 0) {
|
|
302
|
+
return { left: fitModelColumn(options.model, options.reasoningEffort, options.controls?.plan, theme, innerWidth), right: '' };
|
|
303
|
+
}
|
|
304
|
+
if (rawLeftWidth + COLUMN_GAP + rawRightWidth <= innerWidth) {
|
|
305
|
+
return {
|
|
306
|
+
left: fitModelColumn(options.model, options.reasoningEffort, options.controls?.plan, theme, rawLeftWidth),
|
|
307
|
+
right: fitWorkspaceColumn(options.pwd, options.branch, permission, theme, rawRightWidth),
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
const available = Math.max(2, innerWidth - COLUMN_GAP);
|
|
311
|
+
const leftWidth = Math.min(rawLeftWidth, Math.max(1, Math.floor(available * 0.45)));
|
|
312
|
+
const rightWidth = Math.max(1, available - leftWidth);
|
|
313
|
+
return {
|
|
314
|
+
left: fitModelColumn(options.model, options.reasoningEffort, options.controls?.plan, theme, leftWidth),
|
|
315
|
+
right: fitWorkspaceColumn(options.pwd, options.branch, permission, theme, rightWidth),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Render the fixed footer: model/workspace metadata first, customizable
|
|
320
|
+
* session telemetry second. Both rows use left/right columns and exact width.
|
|
321
|
+
*/
|
|
322
|
+
export function renderStatusFooter(options, theme) {
|
|
323
|
+
const normalized = resolveStatusBarConfig(options.config);
|
|
324
|
+
const width = Math.max(0, options.width);
|
|
325
|
+
if (width === 0)
|
|
326
|
+
return [];
|
|
327
|
+
const innerWidth = Math.max(0, width - FOOTER_PADDING * 2);
|
|
328
|
+
const metadata = metadataColumns(options, theme, innerWidth);
|
|
329
|
+
const telemetryGroups = options.stats === undefined || !normalized.enabled
|
|
330
|
+
? { left: [], right: [] }
|
|
331
|
+
: selectFooterGroups(buildStatusGroups(options.stats, normalized), innerWidth);
|
|
332
|
+
return [
|
|
333
|
+
renderSplitRow(metadata.left, metadata.right, width),
|
|
334
|
+
renderSplitRow(paintColumn(telemetryGroups.left, theme), paintColumn(telemetryGroups.right, theme), width),
|
|
335
|
+
];
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Render the telemetry row without footer metadata. Used by the settings
|
|
339
|
+
* preview and retained as a compatibility seam for direct render callers.
|
|
340
|
+
*/
|
|
341
|
+
export function renderSessionStatusLabel(stats, config, theme, width) {
|
|
342
|
+
const normalized = resolveStatusBarConfig(config);
|
|
343
|
+
if (stats === undefined || !normalized.enabled || width <= LABEL_PADDING)
|
|
344
|
+
return '';
|
|
345
|
+
const groups = selectGroups(buildStatusGroups(stats, normalized), width);
|
|
346
|
+
if (groups.length === 0)
|
|
347
|
+
return '';
|
|
348
|
+
const line = ' ' + paintColumn(groups, theme) + ' ';
|
|
349
|
+
return truncateToWidth(line, width);
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=status-line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-line.js","sourceRoot":"","sources":["../src/status-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAA4C,MAAM,oBAAoB,CAAA;AAE7H,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AActE,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,MAAM,eAAe,GAAG,KAAK,CAAA;AAC7B,MAAM,cAAc,GAAG,CAAC,CAAA;AACxB,MAAM,UAAU,GAAG,CAAC,CAAA;AACpB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAA;AAcpE,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC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AO,EAAE,CAAA;IACnF,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,KAAK,CAAC,CAAA;IACxE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAClC,MAAM,IAAI,GAAG,GAAG,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,GAAG,CAAA;IACnD,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACrC,CAAC"}
|
package/lib/style.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin adapter over the oh-my-pi theme for callers that still want the
|
|
3
|
+
* original six wrap functions. New view code should use `createTheme`.
|
|
4
|
+
* @module @agi-fans/dsh-tui
|
|
5
|
+
*/
|
|
6
|
+
/** Per-style wrap functions; every member is (text: string) => string. */
|
|
7
|
+
export interface Style {
|
|
8
|
+
/** Dimmed. */
|
|
9
|
+
dim(text: string): string;
|
|
10
|
+
/** Bold. */
|
|
11
|
+
bold(text: string): string;
|
|
12
|
+
cyan(text: string): string;
|
|
13
|
+
green(text: string): string;
|
|
14
|
+
red(text: string): string;
|
|
15
|
+
yellow(text: string): string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build the style set from the OMP theme.
|
|
19
|
+
* @param colors - whether to emit SGR color/dim sequences.
|
|
20
|
+
* @returns the wrapped style functions.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createStyle(colors: boolean): Style;
|
package/lib/style.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thin adapter over the oh-my-pi theme for callers that still want the
|
|
3
|
+
* original six wrap functions. New view code should use `createTheme`.
|
|
4
|
+
* @module @agi-fans/dsh-tui
|
|
5
|
+
*/
|
|
6
|
+
import { createTheme } from "./theme.js";
|
|
7
|
+
/**
|
|
8
|
+
* Build the style set from the OMP theme.
|
|
9
|
+
* @param colors - whether to emit SGR color/dim sequences.
|
|
10
|
+
* @returns the wrapped style functions.
|
|
11
|
+
*/
|
|
12
|
+
export function createStyle(colors) {
|
|
13
|
+
const theme = createTheme(colors, false);
|
|
14
|
+
return {
|
|
15
|
+
dim: (text) => theme.dim(text),
|
|
16
|
+
bold: (text) => theme.bold(text),
|
|
17
|
+
cyan: (text) => theme.fg('border', text),
|
|
18
|
+
green: (text) => theme.fg('success', text),
|
|
19
|
+
red: (text) => theme.fg('error', text),
|
|
20
|
+
yellow: (text) => theme.fg('warning', text),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=style.js.map
|
package/lib/style.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAcxC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxC,OAAO;QACL,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;QAC9B,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAChC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC;QACxC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;QAC1C,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC;QACtC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC;KAC5C,CAAA;AACH,CAAC"}
|
package/lib/theme.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* oh-my-pi dark theme, ported to Node (no Bun.color). Semantic colors, rounded
|
|
3
|
+
* box chrome, and status glyphs — the visual vocabulary the rest of the view
|
|
4
|
+
* paints with.
|
|
5
|
+
* @module @agi-fans/dsh-tui
|
|
6
|
+
*/
|
|
7
|
+
/** Rounded-box drawing characters (OMP unicode preset). */
|
|
8
|
+
export declare const BOX: {
|
|
9
|
+
readonly topLeft: "╭";
|
|
10
|
+
readonly topRight: "╮";
|
|
11
|
+
readonly bottomLeft: "╰";
|
|
12
|
+
readonly bottomRight: "╯";
|
|
13
|
+
readonly horizontal: "─";
|
|
14
|
+
readonly vertical: "│";
|
|
15
|
+
readonly teeUp: "┴";
|
|
16
|
+
readonly teeDown: "┬";
|
|
17
|
+
readonly teeLeft: "┤";
|
|
18
|
+
readonly teeRight: "├";
|
|
19
|
+
readonly cross: "┼";
|
|
20
|
+
};
|
|
21
|
+
/** Status / list glyphs matching OMP's unicode symbol preset. */
|
|
22
|
+
export declare const SYMBOL: {
|
|
23
|
+
readonly success: "✔";
|
|
24
|
+
readonly error: "✘";
|
|
25
|
+
readonly warning: "⚠";
|
|
26
|
+
readonly info: "ⓘ";
|
|
27
|
+
readonly pending: "⏳";
|
|
28
|
+
readonly running: "⟳";
|
|
29
|
+
readonly done: "•";
|
|
30
|
+
readonly bullet: "•";
|
|
31
|
+
readonly cursor: "❯";
|
|
32
|
+
};
|
|
33
|
+
/** Braille activity spinner (OMP unicode activity frames). */
|
|
34
|
+
export declare const SPINNER: readonly ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
35
|
+
/** Semantic colors the view addresses. */
|
|
36
|
+
export type ThemeColor = 'accent' | 'border' | 'success' | 'error' | 'warning' | 'muted' | 'dim' | 'text' | 'userMessageText' | 'userMessageBg' | 'toolPendingBg' | 'toolSuccessBg' | 'toolErrorBg' | 'toolTitle' | 'toolOutput' | 'mdHeading' | 'mdLink' | 'mdLinkUrl' | 'mdCode' | 'mdCodeBlockBorder' | 'mdQuote' | 'mdListBullet' | 'thinkingText' | 'customMessageLabel';
|
|
37
|
+
/** Built-in palettes (OMP `dark.json` / `light.json`). */
|
|
38
|
+
export declare const THEME_NAMES: readonly ["dark", "light", "midnight", "solarized", "mono"];
|
|
39
|
+
/** One shipped palette name. */
|
|
40
|
+
export type ThemeName = (typeof THEME_NAMES)[number];
|
|
41
|
+
/** True when `value` is a shipped palette name. */
|
|
42
|
+
export declare function isThemeName(value: string): value is ThemeName;
|
|
43
|
+
/** Normalize a config/CLI token to a palette name (`dark` when unknown). */
|
|
44
|
+
export declare function parseThemeName(value: string | undefined): ThemeName;
|
|
45
|
+
/** Paint helpers the view uses; identity functions when colors are off. */
|
|
46
|
+
export interface Theme {
|
|
47
|
+
/** Active palette name. */
|
|
48
|
+
readonly name: ThemeName;
|
|
49
|
+
/** Whether SGR is emitted. */
|
|
50
|
+
readonly colors: boolean;
|
|
51
|
+
/** Whether hex colors become 24-bit SGR (else 16-color). */
|
|
52
|
+
readonly trueColor: boolean;
|
|
53
|
+
fg(color: ThemeColor, text: string): string;
|
|
54
|
+
bg(color: ThemeColor, text: string): string;
|
|
55
|
+
getFgAnsi(color: ThemeColor): string;
|
|
56
|
+
getBgAnsi(color: ThemeColor): string;
|
|
57
|
+
bold(text: string): string;
|
|
58
|
+
italic(text: string): string;
|
|
59
|
+
underline(text: string): string;
|
|
60
|
+
strikethrough(text: string): string;
|
|
61
|
+
dim(text: string): string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Detect 24-bit color the way OMP does: COLORTERM, Windows Terminal, else
|
|
65
|
+
* assume truecolor unless TERM is a known 16-color host.
|
|
66
|
+
*/
|
|
67
|
+
export declare function detectTrueColor(env?: NodeJS.ProcessEnv): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Build a theme.
|
|
70
|
+
* @param colors - emit SGR when true.
|
|
71
|
+
* @param trueColor - 24-bit hex; ignored when colors is false.
|
|
72
|
+
* @param name - shipped palette (`dark` default).
|
|
73
|
+
*/
|
|
74
|
+
export declare function createTheme(colors: boolean, trueColor?: boolean, name?: ThemeName): Theme;
|
|
75
|
+
/** DeepSeek mark adapted from the official SVG for a 20×6 terminal cell. */
|
|
76
|
+
export declare const DEEPSEEK_LOGO: readonly [" ⢀⣀ ⢀⡀ ", "⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣧⣄⡀⢻⣿⣷⣶⣶⣶⡿", "⣿⡟⠛⠛⠛⠿⢿⣿⣿⣿⣿⡿⢿⣷⣾⣿⣿⠉⠉ ", "⢻⣿⣄⡀ ⢀⠈⠛⢿⣿⣿⣶⣿⣿⡿⠃ ", " ⠙⠻⢿⣶⣦⣼⣿⣷⣦⣭⣿⠿⣿⣷⠦ ", " ⠉⠉⠉⠉⠉⠁ "];
|
|
77
|
+
/** @deprecated Use {@link DEEPSEEK_LOGO}; retained for API compatibility. */
|
|
78
|
+
export declare const PI_LOGO: readonly ["▀██████████▀", " ╘██ ██ ", " ██ ██ ", " ██ ██ ", " ▄██▄ ▄██▄ "];
|
|
79
|
+
/**
|
|
80
|
+
* Diagonal gradient across the DeepSeek logo.
|
|
81
|
+
* Unstyled when colors are off.
|
|
82
|
+
*/
|
|
83
|
+
export declare function gradientLogo(theme: Theme, lines?: readonly string[]): string[];
|