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