markov-cli 1.0.17 → 1.0.18
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/ui/logo.js +2 -2
- package/src/ui/spinner.js +37 -7
package/package.json
CHANGED
package/src/ui/logo.js
CHANGED
|
@@ -40,8 +40,8 @@ C8888 888 e Y8b Y8b "8" 888 888 " 888 P d888 888b Y8b Y8P
|
|
|
40
40
|
`;
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
const markovGradient = gradient(['#6ee7b7','#
|
|
44
|
-
|
|
43
|
+
// const markovGradient = gradient(['#6ee7b7','#38bdf8']);
|
|
44
|
+
const markovGradient = gradient(['#38bdf8','#6ee7b7', '#38bdf8']);
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
export function printLogo() {
|
package/src/ui/spinner.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import gradient from 'gradient-string';
|
|
3
3
|
|
|
4
|
-
const agentGradient = gradient(['#
|
|
5
|
-
|
|
6
|
-
const
|
|
4
|
+
const agentGradient = gradient(['#6ee7b7', '#38bdf8']);
|
|
5
|
+
// const chars = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9','!','@','$','%','^','&','*'];
|
|
6
|
+
export const DOTS = ['■','□','▪','▫','□','■','▪','▫'];
|
|
7
|
+
// const randomChar = () => chars[Math.floor(Math.random() * chars.length)];
|
|
8
|
+
// const randomFrame = () => Array.from({ length: 2 }, randomChar).join('');
|
|
9
|
+
// const DOTS = ['. ', '.. ', '...', '.. ', '. '];
|
|
10
|
+
|
|
11
|
+
const SPINNER_INTERVAL_MS = 180;
|
|
12
|
+
const DOTS_INTERVAL_MS = 180;
|
|
13
|
+
const LABEL_INTERVAL_MIN_MS = 3000;
|
|
14
|
+
const LABEL_INTERVAL_MAX_MS = 8000;
|
|
7
15
|
const IDLE_SPINNER_DELAY_MS = 250;
|
|
8
16
|
const SPINNER_LABELS = [
|
|
9
17
|
'Squirming',
|
|
10
18
|
'Shadoodeling',
|
|
11
|
-
'
|
|
19
|
+
'Brainmunching',
|
|
12
20
|
'Brewing',
|
|
13
21
|
'Hacking',
|
|
14
22
|
'Debugging',
|
|
@@ -24,10 +32,32 @@ function pickSpinnerLabel() {
|
|
|
24
32
|
return `${randomLabel} `;
|
|
25
33
|
}
|
|
26
34
|
|
|
35
|
+
/** Deterministic pseudo-random segment duration in [min, max] for label rotation. */
|
|
36
|
+
function labelSegmentMs(segmentIndex) {
|
|
37
|
+
const range = LABEL_INTERVAL_MAX_MS - LABEL_INTERVAL_MIN_MS + 1;
|
|
38
|
+
return LABEL_INTERVAL_MIN_MS + ((segmentIndex * 2654435761) >>> 0) % range;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getLabelSlot(elapsedMs) {
|
|
42
|
+
let total = 0;
|
|
43
|
+
let slot = 0;
|
|
44
|
+
while (total <= elapsedMs && slot < 1000) {
|
|
45
|
+
total += labelSegmentMs(slot);
|
|
46
|
+
slot++;
|
|
47
|
+
}
|
|
48
|
+
return (slot - 1) % SPINNER_LABELS.length;
|
|
49
|
+
}
|
|
50
|
+
|
|
27
51
|
function renderFrame(label, startTime, frameIdx, opts = {}) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
52
|
+
const now = Date.now();
|
|
53
|
+
const elapsedMs = now - startTime;
|
|
54
|
+
const elapsed = (elapsedMs / 1000).toFixed(1);
|
|
55
|
+
const labelSlot = getLabelSlot(elapsedMs);
|
|
56
|
+
const currentLabel = SPINNER_LABELS[labelSlot] + ' ';
|
|
57
|
+
const labelText = opts.gradientLabel ? agentGradient(currentLabel) : chalk.dim(currentLabel);
|
|
58
|
+
const dotIdx = Math.floor(elapsedMs / DOTS_INTERVAL_MS) % DOTS.length;
|
|
59
|
+
const dots = DOTS[dotIdx];
|
|
60
|
+
process.stdout.write('\r' + labelText + agentGradient(dots + ' ') + chalk.dim(elapsed + 's ') + ' ');
|
|
31
61
|
}
|
|
32
62
|
|
|
33
63
|
/**
|