ispbills-icli 8.6.1 → 8.6.3
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/package.json +1 -1
- package/src/tui/components.js +27 -8
package/package.json
CHANGED
package/src/tui/components.js
CHANGED
|
@@ -87,11 +87,17 @@ function formatTs(ts) {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
// glyphColor: when set, the first 2 chars (glyph + space) render in glyphColor,
|
|
91
|
+
// and the rest of the label renders in color (bold white). Matches spec §6.
|
|
92
|
+
function SpeakerLine({ label, color, glyphColor, cols = 80, ts, rightLabel = '' }) {
|
|
91
93
|
const stamp = ts ? `[${formatTs(ts)}]` : '';
|
|
94
|
+
const parts = glyphColor ? [String(label).slice(0, 2), String(label).slice(2)] : null;
|
|
92
95
|
return html`
|
|
93
96
|
<${Box} paddingX=${1} marginTop=${1} width=${cols}>
|
|
94
|
-
|
|
97
|
+
${parts
|
|
98
|
+
? html`<${Text} color=${glyphColor} bold>${parts[0]}<//><${Text} color=${color} bold>${parts[1]}<//>`
|
|
99
|
+
: html`<${Text} color=${color} bold>${label}<//>`
|
|
100
|
+
}
|
|
95
101
|
<${Box} flexGrow=${1} />
|
|
96
102
|
${rightLabel ? html`<${Text} color=${C.muted}>${rightLabel}<//>` : null}
|
|
97
103
|
${rightLabel && stamp ? html`<${Text} color=${C.muted}> <//>` : null}
|
|
@@ -111,17 +117,30 @@ export function TabBar({ active = 'session', cols = 80, mode = 'ask' }) {
|
|
|
111
117
|
const modeBadge = mode !== 'ask'
|
|
112
118
|
? ` ${mode === 'autopilot' ? '⚡ AUTO' : mode === 'shell' ? '⌘ SHELL' : '📋 PLAN'}`
|
|
113
119
|
: '';
|
|
120
|
+
const badgeLen = modeBadge ? modeBadge.length + 2 : 0;
|
|
121
|
+
const available = cols - 2 - badgeLen; // -2 for paddingX={1}
|
|
122
|
+
|
|
123
|
+
// §11: clip tab labels when terminal is narrow (~50 cols)
|
|
124
|
+
// Full: [Session] Devices Customers Alarms = ~42 chars
|
|
125
|
+
// Short: [Ses] Dev Cus Alm = ~26 chars
|
|
126
|
+
const fullWidth = TABS.reduce((sum, t, i) => {
|
|
127
|
+
const w = t.id === active ? t.label.length + 2 : t.label.length;
|
|
128
|
+
return sum + (i > 0 ? 3 : 0) + w;
|
|
129
|
+
}, 0);
|
|
130
|
+
const abbreviated = fullWidth > available;
|
|
131
|
+
|
|
114
132
|
return html`
|
|
115
133
|
<${Box} width=${cols} backgroundColor="blue">
|
|
116
134
|
<${Box} paddingX=${1} flexGrow=${1}>
|
|
117
135
|
${TABS.map((t, i) => {
|
|
118
136
|
const on = t.id === active;
|
|
137
|
+
const lbl = abbreviated ? t.label.slice(0, 3) : t.label;
|
|
119
138
|
return html`
|
|
120
139
|
<${Box} key=${t.id}>
|
|
121
140
|
${i > 0 ? html`<${Text} backgroundColor="blue"> <//>` : null}
|
|
122
141
|
${on
|
|
123
|
-
? html`<${Text} color="white" bold backgroundColor="blue">[${
|
|
124
|
-
: html`<${Text} color="white" dimColor backgroundColor="blue">${
|
|
142
|
+
? html`<${Text} color="white" bold backgroundColor="blue">[${lbl}]<//>`
|
|
143
|
+
: html`<${Text} color="white" dimColor backgroundColor="blue">${lbl}<//>`}
|
|
125
144
|
<//>`;
|
|
126
145
|
})}
|
|
127
146
|
<//>
|
|
@@ -256,7 +275,7 @@ export function AssistantMessage({ text, cols = 80, ts, label = `${glyphs.copilo
|
|
|
256
275
|
return html`
|
|
257
276
|
<${Box} flexDirection="column" marginTop=${1}>
|
|
258
277
|
<${Sep} cols=${cols} />
|
|
259
|
-
<${SpeakerLine} label=${label} color=${C.accent} cols=${cols} ts=${ts} />
|
|
278
|
+
<${SpeakerLine} label=${label} color="white" glyphColor=${C.accent} cols=${cols} ts=${ts} />
|
|
260
279
|
<${Box} paddingX=${1} flexDirection="column" width=${bodyWidth}>
|
|
261
280
|
${streaming ? html`<${StreamingText} text=${text} />` : html`<${Markdown} content=${text} />`}
|
|
262
281
|
<//>
|
|
@@ -274,7 +293,7 @@ export function ShellOutput({ command, output, cols = 80, ts, code = 0 }) {
|
|
|
274
293
|
ts=${ts}
|
|
275
294
|
rightLabel=${code === 0 ? '' : `exit ${code}`}
|
|
276
295
|
/>
|
|
277
|
-
<${Box} paddingX=${
|
|
296
|
+
<${Box} paddingX=${1} flexDirection="column">
|
|
278
297
|
<${Text} color=${C.warning}>$ ${command}<//>
|
|
279
298
|
<${Text}>${output || '(no output)'}<//>
|
|
280
299
|
<//>
|
|
@@ -403,7 +422,7 @@ export function LabeledNotice({ label, text, color = C.gray, cols = 80, ts, body
|
|
|
403
422
|
<${Box} flexDirection="column" marginTop=${1}>
|
|
404
423
|
<${Sep} cols=${cols} />
|
|
405
424
|
<${SpeakerLine} label=${label} color=${color} cols=${cols} ts=${ts} />
|
|
406
|
-
<${Box} paddingX=${
|
|
425
|
+
<${Box} paddingX=${1}>
|
|
407
426
|
<${Text} color=${bodyColor}>${text}<//>
|
|
408
427
|
<//>
|
|
409
428
|
<//>`;
|
|
@@ -503,7 +522,7 @@ export function Thinking({ label = 'Working', startedAt }) {
|
|
|
503
522
|
}, []);
|
|
504
523
|
const secs = startedAt ? Math.max(0, Math.round((Date.now() - startedAt) / 1000)) : 0;
|
|
505
524
|
return html`
|
|
506
|
-
<${Box} marginTop=${1} paddingX=${
|
|
525
|
+
<${Box} marginTop=${1} paddingX=${1}>
|
|
507
526
|
<${Text} color=${C.warning}><${Spinner} type=${spinnerType()} /><//>
|
|
508
527
|
<${Text} color=${C.warning} bold> ${label}<//>
|
|
509
528
|
<${Text} color=${C.muted}>… (${secs}s ${midDot()}esc to interrupt)<//>
|