pi-open-tui 0.2.15 → 0.3.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/assets/preview_dashboard_1.png +0 -0
- package/extensions/open-tui/footer.ts +329 -328
- package/extensions/open-tui/icons.ts +207 -207
- package/extensions/open-tui/runtime.ts +174 -174
- package/extensions/open-tui/state.ts +3 -1
- package/extensions/open-tui/telemetry.ts +11 -3
- package/extensions/open-tui/utils.ts +7 -0
- package/package.json +1 -1
|
@@ -1,207 +1,207 @@
|
|
|
1
|
-
export type IconMode = "auto" | "nerd" | "ascii";
|
|
2
|
-
|
|
3
|
-
export interface IconGlyphs {
|
|
4
|
-
cwd: string;
|
|
5
|
-
session: string;
|
|
6
|
-
git: string;
|
|
7
|
-
working: string;
|
|
8
|
-
done: string;
|
|
9
|
-
context: string;
|
|
10
|
-
model: string;
|
|
11
|
-
thinking: string;
|
|
12
|
-
input: string;
|
|
13
|
-
output: string;
|
|
14
|
-
cacheHit: string;
|
|
15
|
-
cost: string;
|
|
16
|
-
speed: string;
|
|
17
|
-
latency: string;
|
|
18
|
-
stall: string;
|
|
19
|
-
extensions: string;
|
|
20
|
-
ahead: string;
|
|
21
|
-
behind: string;
|
|
22
|
-
diverged: string;
|
|
23
|
-
conflicted: string;
|
|
24
|
-
stashed: string;
|
|
25
|
-
modified: string;
|
|
26
|
-
staged: string;
|
|
27
|
-
untracked: string;
|
|
28
|
-
renamed: string;
|
|
29
|
-
deleted: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const NERD_GLYPHS: IconGlyphs = {
|
|
33
|
-
cwd: "",
|
|
34
|
-
session: "",
|
|
35
|
-
git: "",
|
|
36
|
-
working: "",
|
|
37
|
-
done: "",
|
|
38
|
-
context: "",
|
|
39
|
-
model: "",
|
|
40
|
-
thinking: "",
|
|
41
|
-
// client network view: input = upload to API, output = download from API
|
|
42
|
-
input: "",
|
|
43
|
-
output: "",
|
|
44
|
-
cacheHit: "",
|
|
45
|
-
cost: "",
|
|
46
|
-
speed: "",
|
|
47
|
-
latency: "",
|
|
48
|
-
stall: "",
|
|
49
|
-
extensions: "",
|
|
50
|
-
ahead: "↑",
|
|
51
|
-
behind: "↓",
|
|
52
|
-
diverged: "⇕",
|
|
53
|
-
conflicted: "=",
|
|
54
|
-
stashed: "$",
|
|
55
|
-
modified: "!",
|
|
56
|
-
staged: "+",
|
|
57
|
-
untracked: "?",
|
|
58
|
-
renamed: "»",
|
|
59
|
-
deleted: "✘",
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// ponytail: ASCII fallback uses compact symbols (not English words) to keep
|
|
63
|
-
// the footer's icon-like feel on non-Nerd-Font terminals. Symbols chosen to
|
|
64
|
-
// avoid collisions with the git-status set {= S ! A ? r x ^ v}.
|
|
65
|
-
const ASCII_GLYPHS: IconGlyphs = {
|
|
66
|
-
cwd: "@",
|
|
67
|
-
session: "s",
|
|
68
|
-
git: "*",
|
|
69
|
-
working: "o",
|
|
70
|
-
done: "+",
|
|
71
|
-
context: "#",
|
|
72
|
-
model: "M",
|
|
73
|
-
thinking: "~",
|
|
74
|
-
input: "↑",
|
|
75
|
-
output: "↓",
|
|
76
|
-
cacheHit: "c",
|
|
77
|
-
cost: "$",
|
|
78
|
-
speed: ">",
|
|
79
|
-
latency: "~",
|
|
80
|
-
stall: "!",
|
|
81
|
-
extensions: "&",
|
|
82
|
-
ahead: "^",
|
|
83
|
-
behind: "v",
|
|
84
|
-
diverged: "^v",
|
|
85
|
-
conflicted: "=",
|
|
86
|
-
stashed: "S",
|
|
87
|
-
modified: "!",
|
|
88
|
-
staged: "A",
|
|
89
|
-
untracked: "?",
|
|
90
|
-
renamed: "r",
|
|
91
|
-
deleted: "x",
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const NERD_FONT_TERMINALS = new Set([
|
|
95
|
-
"iTerm.app",
|
|
96
|
-
"Ghostty",
|
|
97
|
-
"WezTerm",
|
|
98
|
-
"kitty",
|
|
99
|
-
"rio",
|
|
100
|
-
"tabby",
|
|
101
|
-
"WindowsTerminal",
|
|
102
|
-
"vscode",
|
|
103
|
-
]);
|
|
104
|
-
|
|
105
|
-
export function detectNerdFont(): boolean {
|
|
106
|
-
const termProgram = process.env.TERM_PROGRAM;
|
|
107
|
-
if (termProgram && NERD_FONT_TERMINALS.has(termProgram)) return true;
|
|
108
|
-
|
|
109
|
-
const lcTerminal = process.env.LC_TERMINAL;
|
|
110
|
-
if (lcTerminal && NERD_FONT_TERMINALS.has(lcTerminal)) return true;
|
|
111
|
-
|
|
112
|
-
if (process.env.TERM === "xterm-kitty") return true;
|
|
113
|
-
|
|
114
|
-
// Windows Terminal sets WT_SESSION (not TERM_PROGRAM)
|
|
115
|
-
if (process.env.WT_SESSION) return true;
|
|
116
|
-
|
|
117
|
-
// VS Code integrated terminal
|
|
118
|
-
if (process.env.TERM_PROGRAM === "vscode") return true;
|
|
119
|
-
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function resolveIconMode(mode: IconMode): "nerd" | "ascii" {
|
|
124
|
-
if (mode === "nerd") return "nerd";
|
|
125
|
-
if (mode === "ascii") return "ascii";
|
|
126
|
-
return detectNerdFont() ? "nerd" : "ascii";
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function resolveGlyphs(mode: IconMode): IconGlyphs {
|
|
130
|
-
const resolved = resolveIconMode(mode);
|
|
131
|
-
return resolved === "nerd" ? NERD_GLYPHS : ASCII_GLYPHS;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const RUNTIME_SYMBOLS: Record<string, string> = {
|
|
135
|
-
nodejs: "\uE718",
|
|
136
|
-
rust: "\uE7A8",
|
|
137
|
-
go: "\uE626",
|
|
138
|
-
python: "\uE73C",
|
|
139
|
-
ruby: "\uE739",
|
|
140
|
-
java: "\uE256",
|
|
141
|
-
cpp: "\uE61D",
|
|
142
|
-
c: "\uE61E",
|
|
143
|
-
swift: "\uE755",
|
|
144
|
-
kotlin: "\uE634",
|
|
145
|
-
deno: "\uE7FB",
|
|
146
|
-
bun: "\
|
|
147
|
-
php: "\uE73D",
|
|
148
|
-
haskell: "\uE777",
|
|
149
|
-
julia: "\uE624",
|
|
150
|
-
lua: "\uE620",
|
|
151
|
-
elixir: "\uE62B",
|
|
152
|
-
erlang: "\uE7B1",
|
|
153
|
-
gleam: "\uE6B4",
|
|
154
|
-
crystal: "\uE62F",
|
|
155
|
-
dart: "\uE7C0",
|
|
156
|
-
nim: "\uE677",
|
|
157
|
-
zig: "\uE6A9",
|
|
158
|
-
ocaml: "\uE67A",
|
|
159
|
-
clojure: "\uE76A",
|
|
160
|
-
scala: "\uE747",
|
|
161
|
-
perl: "\uE769",
|
|
162
|
-
r: "\uE68A",
|
|
163
|
-
elm: "\uE62C",
|
|
164
|
-
haxe: "\uE7B7",
|
|
165
|
-
vagrant: "\uE21A",
|
|
166
|
-
terraform: "\uE1A5",
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const RUNTIME_ASCII_SYMBOLS: Record<string, string> = {
|
|
170
|
-
nodejs: "node",
|
|
171
|
-
rust: "rs",
|
|
172
|
-
go: "go",
|
|
173
|
-
python: "py",
|
|
174
|
-
ruby: "rb",
|
|
175
|
-
java: "java",
|
|
176
|
-
swift: "swift",
|
|
177
|
-
kotlin: "kt",
|
|
178
|
-
cpp: "c++",
|
|
179
|
-
c: "c",
|
|
180
|
-
deno: "deno",
|
|
181
|
-
bun: "bun",
|
|
182
|
-
php: "php",
|
|
183
|
-
haskell: "hs",
|
|
184
|
-
julia: "jl",
|
|
185
|
-
lua: "lua",
|
|
186
|
-
elixir: "ex",
|
|
187
|
-
erlang: "erl",
|
|
188
|
-
gleam: "gleam",
|
|
189
|
-
crystal: "cr",
|
|
190
|
-
dart: "dart",
|
|
191
|
-
nim: "nim",
|
|
192
|
-
zig: "zig",
|
|
193
|
-
ocaml: "ml",
|
|
194
|
-
clojure: "clj",
|
|
195
|
-
scala: "scala",
|
|
196
|
-
perl: "pl",
|
|
197
|
-
r: "R",
|
|
198
|
-
elm: "elm",
|
|
199
|
-
haxe: "hx",
|
|
200
|
-
vagrant: "vag",
|
|
201
|
-
terraform: "tf",
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export function runtimeSymbol(name: string, mode: IconMode): string {
|
|
205
|
-
if (resolveIconMode(mode) === "ascii") return RUNTIME_ASCII_SYMBOLS[name] ?? name;
|
|
206
|
-
return RUNTIME_SYMBOLS[name] ?? "";
|
|
207
|
-
}
|
|
1
|
+
export type IconMode = "auto" | "nerd" | "ascii";
|
|
2
|
+
|
|
3
|
+
export interface IconGlyphs {
|
|
4
|
+
cwd: string;
|
|
5
|
+
session: string;
|
|
6
|
+
git: string;
|
|
7
|
+
working: string;
|
|
8
|
+
done: string;
|
|
9
|
+
context: string;
|
|
10
|
+
model: string;
|
|
11
|
+
thinking: string;
|
|
12
|
+
input: string;
|
|
13
|
+
output: string;
|
|
14
|
+
cacheHit: string;
|
|
15
|
+
cost: string;
|
|
16
|
+
speed: string;
|
|
17
|
+
latency: string;
|
|
18
|
+
stall: string;
|
|
19
|
+
extensions: string;
|
|
20
|
+
ahead: string;
|
|
21
|
+
behind: string;
|
|
22
|
+
diverged: string;
|
|
23
|
+
conflicted: string;
|
|
24
|
+
stashed: string;
|
|
25
|
+
modified: string;
|
|
26
|
+
staged: string;
|
|
27
|
+
untracked: string;
|
|
28
|
+
renamed: string;
|
|
29
|
+
deleted: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const NERD_GLYPHS: IconGlyphs = {
|
|
33
|
+
cwd: "",
|
|
34
|
+
session: "",
|
|
35
|
+
git: "",
|
|
36
|
+
working: "",
|
|
37
|
+
done: "",
|
|
38
|
+
context: "",
|
|
39
|
+
model: "",
|
|
40
|
+
thinking: "",
|
|
41
|
+
// client network view: input = upload to API, output = download from API
|
|
42
|
+
input: "",
|
|
43
|
+
output: "",
|
|
44
|
+
cacheHit: "",
|
|
45
|
+
cost: "",
|
|
46
|
+
speed: "",
|
|
47
|
+
latency: "",
|
|
48
|
+
stall: "",
|
|
49
|
+
extensions: "",
|
|
50
|
+
ahead: "↑",
|
|
51
|
+
behind: "↓",
|
|
52
|
+
diverged: "⇕",
|
|
53
|
+
conflicted: "=",
|
|
54
|
+
stashed: "$",
|
|
55
|
+
modified: "!",
|
|
56
|
+
staged: "+",
|
|
57
|
+
untracked: "?",
|
|
58
|
+
renamed: "»",
|
|
59
|
+
deleted: "✘",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// ponytail: ASCII fallback uses compact symbols (not English words) to keep
|
|
63
|
+
// the footer's icon-like feel on non-Nerd-Font terminals. Symbols chosen to
|
|
64
|
+
// avoid collisions with the git-status set {= S ! A ? r x ^ v}.
|
|
65
|
+
const ASCII_GLYPHS: IconGlyphs = {
|
|
66
|
+
cwd: "@",
|
|
67
|
+
session: "s",
|
|
68
|
+
git: "*",
|
|
69
|
+
working: "o",
|
|
70
|
+
done: "+",
|
|
71
|
+
context: "#",
|
|
72
|
+
model: "M",
|
|
73
|
+
thinking: "~",
|
|
74
|
+
input: "↑",
|
|
75
|
+
output: "↓",
|
|
76
|
+
cacheHit: "c",
|
|
77
|
+
cost: "$",
|
|
78
|
+
speed: ">",
|
|
79
|
+
latency: "~",
|
|
80
|
+
stall: "!",
|
|
81
|
+
extensions: "&",
|
|
82
|
+
ahead: "^",
|
|
83
|
+
behind: "v",
|
|
84
|
+
diverged: "^v",
|
|
85
|
+
conflicted: "=",
|
|
86
|
+
stashed: "S",
|
|
87
|
+
modified: "!",
|
|
88
|
+
staged: "A",
|
|
89
|
+
untracked: "?",
|
|
90
|
+
renamed: "r",
|
|
91
|
+
deleted: "x",
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const NERD_FONT_TERMINALS = new Set([
|
|
95
|
+
"iTerm.app",
|
|
96
|
+
"Ghostty",
|
|
97
|
+
"WezTerm",
|
|
98
|
+
"kitty",
|
|
99
|
+
"rio",
|
|
100
|
+
"tabby",
|
|
101
|
+
"WindowsTerminal",
|
|
102
|
+
"vscode",
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
export function detectNerdFont(): boolean {
|
|
106
|
+
const termProgram = process.env.TERM_PROGRAM;
|
|
107
|
+
if (termProgram && NERD_FONT_TERMINALS.has(termProgram)) return true;
|
|
108
|
+
|
|
109
|
+
const lcTerminal = process.env.LC_TERMINAL;
|
|
110
|
+
if (lcTerminal && NERD_FONT_TERMINALS.has(lcTerminal)) return true;
|
|
111
|
+
|
|
112
|
+
if (process.env.TERM === "xterm-kitty") return true;
|
|
113
|
+
|
|
114
|
+
// Windows Terminal sets WT_SESSION (not TERM_PROGRAM)
|
|
115
|
+
if (process.env.WT_SESSION) return true;
|
|
116
|
+
|
|
117
|
+
// VS Code integrated terminal
|
|
118
|
+
if (process.env.TERM_PROGRAM === "vscode") return true;
|
|
119
|
+
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function resolveIconMode(mode: IconMode): "nerd" | "ascii" {
|
|
124
|
+
if (mode === "nerd") return "nerd";
|
|
125
|
+
if (mode === "ascii") return "ascii";
|
|
126
|
+
return detectNerdFont() ? "nerd" : "ascii";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function resolveGlyphs(mode: IconMode): IconGlyphs {
|
|
130
|
+
const resolved = resolveIconMode(mode);
|
|
131
|
+
return resolved === "nerd" ? NERD_GLYPHS : ASCII_GLYPHS;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const RUNTIME_SYMBOLS: Record<string, string> = {
|
|
135
|
+
nodejs: "\uE718",
|
|
136
|
+
rust: "\uE7A8",
|
|
137
|
+
go: "\uE626",
|
|
138
|
+
python: "\uE73C",
|
|
139
|
+
ruby: "\uE739",
|
|
140
|
+
java: "\uE256",
|
|
141
|
+
cpp: "\uE61D",
|
|
142
|
+
c: "\uE61E",
|
|
143
|
+
swift: "\uE755",
|
|
144
|
+
kotlin: "\uE634",
|
|
145
|
+
deno: "\uE7FB",
|
|
146
|
+
bun: "\uE76F",
|
|
147
|
+
php: "\uE73D",
|
|
148
|
+
haskell: "\uE777",
|
|
149
|
+
julia: "\uE624",
|
|
150
|
+
lua: "\uE620",
|
|
151
|
+
elixir: "\uE62B",
|
|
152
|
+
erlang: "\uE7B1",
|
|
153
|
+
gleam: "\uE6B4",
|
|
154
|
+
crystal: "\uE62F",
|
|
155
|
+
dart: "\uE7C0",
|
|
156
|
+
nim: "\uE677",
|
|
157
|
+
zig: "\uE6A9",
|
|
158
|
+
ocaml: "\uE67A",
|
|
159
|
+
clojure: "\uE76A",
|
|
160
|
+
scala: "\uE747",
|
|
161
|
+
perl: "\uE769",
|
|
162
|
+
r: "\uE68A",
|
|
163
|
+
elm: "\uE62C",
|
|
164
|
+
haxe: "\uE7B7",
|
|
165
|
+
vagrant: "\uE21A",
|
|
166
|
+
terraform: "\uE1A5",
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const RUNTIME_ASCII_SYMBOLS: Record<string, string> = {
|
|
170
|
+
nodejs: "node",
|
|
171
|
+
rust: "rs",
|
|
172
|
+
go: "go",
|
|
173
|
+
python: "py",
|
|
174
|
+
ruby: "rb",
|
|
175
|
+
java: "java",
|
|
176
|
+
swift: "swift",
|
|
177
|
+
kotlin: "kt",
|
|
178
|
+
cpp: "c++",
|
|
179
|
+
c: "c",
|
|
180
|
+
deno: "deno",
|
|
181
|
+
bun: "bun",
|
|
182
|
+
php: "php",
|
|
183
|
+
haskell: "hs",
|
|
184
|
+
julia: "jl",
|
|
185
|
+
lua: "lua",
|
|
186
|
+
elixir: "ex",
|
|
187
|
+
erlang: "erl",
|
|
188
|
+
gleam: "gleam",
|
|
189
|
+
crystal: "cr",
|
|
190
|
+
dart: "dart",
|
|
191
|
+
nim: "nim",
|
|
192
|
+
zig: "zig",
|
|
193
|
+
ocaml: "ml",
|
|
194
|
+
clojure: "clj",
|
|
195
|
+
scala: "scala",
|
|
196
|
+
perl: "pl",
|
|
197
|
+
r: "R",
|
|
198
|
+
elm: "elm",
|
|
199
|
+
haxe: "hx",
|
|
200
|
+
vagrant: "vag",
|
|
201
|
+
terraform: "tf",
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export function runtimeSymbol(name: string, mode: IconMode): string {
|
|
205
|
+
if (resolveIconMode(mode) === "ascii") return RUNTIME_ASCII_SYMBOLS[name] ?? name;
|
|
206
|
+
return RUNTIME_SYMBOLS[name] ?? "";
|
|
207
|
+
}
|