replit-tools 1.2.25 → 1.2.26
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
CHANGED
|
@@ -357,14 +357,23 @@ get_recent_24h_sessions() {
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
+
const normTs = (t) => typeof t === 'number' ? t : (Date.parse(t) || 0);
|
|
360
361
|
const words = (s) => (s || '').replace(/\s+/g, ' ').trim().split(' ').slice(0, 5).join(' ');
|
|
362
|
+
const ago = (ts) => {
|
|
363
|
+
const mins = Math.round((Date.now() - ts) / 60000);
|
|
364
|
+
if (mins < 1) return 'just now';
|
|
365
|
+
if (mins < 60) return mins + 'm ago';
|
|
366
|
+
const h = Math.round(mins / 60);
|
|
367
|
+
return h + 'h ago';
|
|
368
|
+
};
|
|
361
369
|
const sorted = Array.from(sessions.values())
|
|
370
|
+
.map(s => ({ ...s, lastSeen: normTs(s.lastSeen) }))
|
|
362
371
|
.filter(s => s.lastSeen >= cutoff)
|
|
363
372
|
.sort((a, b) => b.lastSeen - a.lastSeen)
|
|
364
373
|
.slice(0, 9);
|
|
365
374
|
|
|
366
375
|
sorted.forEach((s, i) => {
|
|
367
|
-
console.log((i+1) + '|' + s.tool + '|' + s.id + '|' + words(s.firstPrompt));
|
|
376
|
+
console.log((i+1) + '|' + s.tool + '|' + s.id + '|' + ago(s.lastSeen) + '|' + words(s.firstPrompt));
|
|
368
377
|
});
|
|
369
378
|
" 2>/dev/null
|
|
370
379
|
}
|
|
@@ -497,20 +506,19 @@ claude_prompt() {
|
|
|
497
506
|
local recent_ids=()
|
|
498
507
|
if [ -n "$recent_24h" ]; then
|
|
499
508
|
echo ""
|
|
500
|
-
echo "
|
|
501
|
-
|
|
502
|
-
echo " ├─────────────────────────────┤"
|
|
503
|
-
while IFS='|' read -r num tool id snippet; do
|
|
509
|
+
echo -e " \033[1mRecent (last 24h):\033[0m"
|
|
510
|
+
while IFS='|' read -r num tool id when snippet; do
|
|
504
511
|
[ -z "$num" ] && continue
|
|
505
512
|
recent_tools[$num]="$tool"
|
|
506
513
|
recent_ids[$num]="$id"
|
|
514
|
+
local label_color="\033[1;38;5;33m"
|
|
515
|
+
local label="cld"
|
|
507
516
|
if [ "$tool" = "codex" ]; then
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
echo -e " │ \033[1;97m[$num]\033[0m \033[1;38;5;33mcld\033[0m $(printf '%-22s' "${snippet:0:22}")│"
|
|
517
|
+
label_color="\033[1;38;5;208m"
|
|
518
|
+
label="cdx"
|
|
511
519
|
fi
|
|
520
|
+
printf " \033[1;97m[%s]\033[0m ${label_color}%s\033[0m \033[2m%-8s\033[0m %s\n" "$num" "$label" "$when" "$snippet"
|
|
512
521
|
done <<< "$recent_24h"
|
|
513
|
-
echo " └─────────────────────────────┘"
|
|
514
522
|
fi
|
|
515
523
|
|
|
516
524
|
echo ""
|