squads-cli 0.4.8 → 0.4.10
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/README.md +38 -0
- package/dist/{chunk-IDZYXBZY.js → chunk-HIQ2APYR.js} +13 -269
- package/dist/chunk-HIQ2APYR.js.map +1 -0
- package/dist/chunk-HKWCBCEK.js +225 -0
- package/dist/chunk-HKWCBCEK.js.map +1 -0
- package/dist/chunk-NA3IECJA.js +288 -0
- package/dist/chunk-NA3IECJA.js.map +1 -0
- package/dist/cli.js +590 -620
- package/dist/cli.js.map +1 -1
- package/dist/{sessions-B6GVXJ2H.js → sessions-R4VWIGFR.js} +3 -2
- package/dist/terminal-JZSAQSN7.js +53 -0
- package/dist/terminal-JZSAQSN7.js.map +1 -0
- package/dist/update-MAY6EXFQ.js +17 -0
- package/dist/update-MAY6EXFQ.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-IDZYXBZY.js.map +0 -1
- /package/dist/{sessions-B6GVXJ2H.js.map → sessions-R4VWIGFR.js.map} +0 -0
package/README.md
CHANGED
|
@@ -765,6 +765,44 @@ squads workers Show active workers
|
|
|
765
765
|
-v, --verbose More details
|
|
766
766
|
-k, --kill <pid> Kill process
|
|
767
767
|
|
|
768
|
+
squads context Business context for alignment
|
|
769
|
+
-s, --squad <squad> Focus on specific squad
|
|
770
|
+
-t, --topic <topic> Search memory for relevant context
|
|
771
|
+
-v, --verbose Show additional details
|
|
772
|
+
--json JSON output
|
|
773
|
+
|
|
774
|
+
squads history Recent agent execution history
|
|
775
|
+
-d, --days <n> Days to look back (default: 7)
|
|
776
|
+
-s, --squad <squad> Filter by squad
|
|
777
|
+
-v, --verbose Show cost and token details
|
|
778
|
+
-j, --json JSON output
|
|
779
|
+
|
|
780
|
+
squads health Quick infrastructure health check
|
|
781
|
+
-v, --verbose Show logs for failures
|
|
782
|
+
--json JSON output
|
|
783
|
+
|
|
784
|
+
squads watch <command> [args] Live refresh any command (like Unix watch)
|
|
785
|
+
-n, --interval <seconds> Refresh interval (default: 2)
|
|
786
|
+
|
|
787
|
+
squads live Live TUI dashboard (like htop)
|
|
788
|
+
-r, --refresh <ms> Refresh rate (default: 1000)
|
|
789
|
+
|
|
790
|
+
squads top Live process table (like Unix top)
|
|
791
|
+
|
|
792
|
+
squads version Show version information
|
|
793
|
+
|
|
794
|
+
squads env show <squad> Squad execution environment (MCP, model, budget)
|
|
795
|
+
--json JSON output
|
|
796
|
+
squads env list List all squad environments
|
|
797
|
+
--json JSON output
|
|
798
|
+
|
|
799
|
+
squads cost Cost summary (today, week, by squad)
|
|
800
|
+
-s, --squad <squad> Filter to specific squad
|
|
801
|
+
--json JSON output
|
|
802
|
+
|
|
803
|
+
squads budget <squad> Check budget status for a squad
|
|
804
|
+
--json JSON output
|
|
805
|
+
|
|
768
806
|
squads issues GitHub issues
|
|
769
807
|
-o, --org <org> Organization (default: agents-squads)
|
|
770
808
|
-r, --repos <repos> Comma-separated repos
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
RESET,
|
|
4
|
+
bold,
|
|
5
|
+
box,
|
|
6
|
+
colors,
|
|
7
|
+
gradient,
|
|
8
|
+
icons,
|
|
9
|
+
padEnd,
|
|
10
|
+
writeLine
|
|
11
|
+
} from "./chunk-NA3IECJA.js";
|
|
2
12
|
import {
|
|
3
13
|
__require
|
|
4
14
|
} from "./chunk-7OCVIDC7.js";
|
|
@@ -435,260 +445,6 @@ async function getRecentSessions(limit = 20) {
|
|
|
435
445
|
return startEvents.reverse();
|
|
436
446
|
}
|
|
437
447
|
|
|
438
|
-
// src/lib/terminal.ts
|
|
439
|
-
var ESC = "\x1B[";
|
|
440
|
-
var RESET = `${ESC}0m`;
|
|
441
|
-
function supportsTrueColor() {
|
|
442
|
-
const colorterm = process.env.COLORTERM;
|
|
443
|
-
if (colorterm === "truecolor" || colorterm === "24bit") return true;
|
|
444
|
-
const term = process.env.TERM || "";
|
|
445
|
-
if (term.includes("256color") || term.includes("truecolor")) return true;
|
|
446
|
-
if (process.env.TERM_PROGRAM === "iTerm.app") return true;
|
|
447
|
-
if (process.env.TERM_PROGRAM === "vscode") return true;
|
|
448
|
-
if (process.env.WT_SESSION) return true;
|
|
449
|
-
return false;
|
|
450
|
-
}
|
|
451
|
-
var USE_TRUE_COLOR = supportsTrueColor();
|
|
452
|
-
var rgb = (r, g, b) => `${ESC}38;2;${r};${g};${b}m`;
|
|
453
|
-
var ansi = {
|
|
454
|
-
purple: `${ESC}35m`,
|
|
455
|
-
// magenta
|
|
456
|
-
pink: `${ESC}95m`,
|
|
457
|
-
// bright magenta
|
|
458
|
-
cyan: `${ESC}36m`,
|
|
459
|
-
// cyan
|
|
460
|
-
green: `${ESC}32m`,
|
|
461
|
-
// green
|
|
462
|
-
yellow: `${ESC}33m`,
|
|
463
|
-
// yellow
|
|
464
|
-
red: `${ESC}31m`,
|
|
465
|
-
// red
|
|
466
|
-
gray: `${ESC}90m`,
|
|
467
|
-
// bright black (gray)
|
|
468
|
-
dim: `${ESC}90m`,
|
|
469
|
-
// bright black (gray)
|
|
470
|
-
white: `${ESC}97m`
|
|
471
|
-
// bright white
|
|
472
|
-
};
|
|
473
|
-
var colors = USE_TRUE_COLOR ? {
|
|
474
|
-
purple: rgb(168, 85, 247),
|
|
475
|
-
// #a855f7
|
|
476
|
-
pink: rgb(236, 72, 153),
|
|
477
|
-
// #ec4899
|
|
478
|
-
cyan: rgb(6, 182, 212),
|
|
479
|
-
// #06b6d4
|
|
480
|
-
green: rgb(16, 185, 129),
|
|
481
|
-
// #10b981
|
|
482
|
-
yellow: rgb(234, 179, 8),
|
|
483
|
-
// #eab308
|
|
484
|
-
red: rgb(239, 68, 68),
|
|
485
|
-
// #ef4444
|
|
486
|
-
gray: rgb(107, 114, 128),
|
|
487
|
-
// #6b7280
|
|
488
|
-
dim: rgb(75, 85, 99),
|
|
489
|
-
// #4b5563
|
|
490
|
-
white: rgb(255, 255, 255)
|
|
491
|
-
} : ansi;
|
|
492
|
-
var bold = `${ESC}1m`;
|
|
493
|
-
var dim = `${ESC}2m`;
|
|
494
|
-
var cursor = {
|
|
495
|
-
hide: `${ESC}?25l`,
|
|
496
|
-
show: `${ESC}?25h`,
|
|
497
|
-
up: (n = 1) => `${ESC}${n}A`,
|
|
498
|
-
down: (n = 1) => `${ESC}${n}B`,
|
|
499
|
-
left: (n = 1) => `${ESC}${n}D`,
|
|
500
|
-
right: (n = 1) => `${ESC}${n}C`,
|
|
501
|
-
to: (x, y) => `${ESC}${y};${x}H`,
|
|
502
|
-
save: `${ESC}s`,
|
|
503
|
-
restore: `${ESC}u`
|
|
504
|
-
};
|
|
505
|
-
var clear = {
|
|
506
|
-
line: `${ESC}2K`,
|
|
507
|
-
toEnd: `${ESC}0K`,
|
|
508
|
-
screen: `${ESC}2J${ESC}0;0H`
|
|
509
|
-
};
|
|
510
|
-
function supportsUnicode() {
|
|
511
|
-
if (process.platform === "win32") {
|
|
512
|
-
if (process.env.WT_SESSION) return true;
|
|
513
|
-
if (process.env.ConEmuTask) return true;
|
|
514
|
-
if (process.env.LANG?.includes("UTF") || process.env.LC_ALL?.includes("UTF")) return true;
|
|
515
|
-
return false;
|
|
516
|
-
}
|
|
517
|
-
if (process.env.SQUADS_ASCII !== void 0) return false;
|
|
518
|
-
return true;
|
|
519
|
-
}
|
|
520
|
-
var USE_UNICODE = supportsUnicode();
|
|
521
|
-
function gradient(text) {
|
|
522
|
-
const stops = [
|
|
523
|
-
[168, 85, 247],
|
|
524
|
-
// purple
|
|
525
|
-
[192, 132, 252],
|
|
526
|
-
// purple-light
|
|
527
|
-
[232, 121, 249],
|
|
528
|
-
// pink
|
|
529
|
-
[244, 114, 182],
|
|
530
|
-
// pink-light
|
|
531
|
-
[251, 113, 133]
|
|
532
|
-
// rose
|
|
533
|
-
];
|
|
534
|
-
let result = "";
|
|
535
|
-
for (let i = 0; i < text.length; i++) {
|
|
536
|
-
const t = i / Math.max(text.length - 1, 1);
|
|
537
|
-
const stopIndex = t * (stops.length - 1);
|
|
538
|
-
const lower = Math.floor(stopIndex);
|
|
539
|
-
const upper = Math.min(lower + 1, stops.length - 1);
|
|
540
|
-
const blend = stopIndex - lower;
|
|
541
|
-
const r = Math.round(stops[lower][0] + (stops[upper][0] - stops[lower][0]) * blend);
|
|
542
|
-
const g = Math.round(stops[lower][1] + (stops[upper][1] - stops[lower][1]) * blend);
|
|
543
|
-
const b = Math.round(stops[lower][2] + (stops[upper][2] - stops[lower][2]) * blend);
|
|
544
|
-
result += rgb(r, g, b) + text[i];
|
|
545
|
-
}
|
|
546
|
-
return result + RESET;
|
|
547
|
-
}
|
|
548
|
-
var BAR_FILLED = USE_UNICODE ? "\u2501" : "=";
|
|
549
|
-
var BAR_EMPTY = USE_UNICODE ? "\u2501" : "-";
|
|
550
|
-
function progressBar(percent, width = 20) {
|
|
551
|
-
const clampedPercent = Math.max(0, Math.min(100, percent || 0));
|
|
552
|
-
const filled = Math.round(clampedPercent / 100 * width);
|
|
553
|
-
const empty = Math.max(0, width - filled);
|
|
554
|
-
let bar = "";
|
|
555
|
-
for (let i = 0; i < filled; i++) {
|
|
556
|
-
const t = i / Math.max(filled - 1, 1);
|
|
557
|
-
const r = Math.round(16 + (168 - 16) * t);
|
|
558
|
-
const g = Math.round(185 + (85 - 185) * t);
|
|
559
|
-
const b = Math.round(129 + (247 - 129) * t);
|
|
560
|
-
bar += rgb(r, g, b) + BAR_FILLED;
|
|
561
|
-
}
|
|
562
|
-
bar += colors.dim + BAR_EMPTY.repeat(empty) + RESET;
|
|
563
|
-
return bar;
|
|
564
|
-
}
|
|
565
|
-
var box = USE_UNICODE ? {
|
|
566
|
-
topLeft: "\u250C",
|
|
567
|
-
topRight: "\u2510",
|
|
568
|
-
bottomLeft: "\u2514",
|
|
569
|
-
bottomRight: "\u2518",
|
|
570
|
-
horizontal: "\u2500",
|
|
571
|
-
vertical: "\u2502",
|
|
572
|
-
teeRight: "\u251C",
|
|
573
|
-
teeLeft: "\u2524"
|
|
574
|
-
} : {
|
|
575
|
-
topLeft: "+",
|
|
576
|
-
topRight: "+",
|
|
577
|
-
bottomLeft: "+",
|
|
578
|
-
bottomRight: "+",
|
|
579
|
-
horizontal: "-",
|
|
580
|
-
vertical: "|",
|
|
581
|
-
teeRight: "+",
|
|
582
|
-
teeLeft: "+"
|
|
583
|
-
};
|
|
584
|
-
function padEnd(str, len) {
|
|
585
|
-
const visible = str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
586
|
-
const pad = Math.max(0, len - visible.length);
|
|
587
|
-
return str + " ".repeat(pad);
|
|
588
|
-
}
|
|
589
|
-
function truncate(str, len) {
|
|
590
|
-
const visible = str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
591
|
-
if (visible.length <= len) return str;
|
|
592
|
-
let result = "";
|
|
593
|
-
let count = 0;
|
|
594
|
-
let i = 0;
|
|
595
|
-
while (i < str.length && count < len - 1) {
|
|
596
|
-
if (str[i] === "\x1B") {
|
|
597
|
-
const end = str.indexOf("m", i);
|
|
598
|
-
if (end !== -1) {
|
|
599
|
-
result += str.slice(i, end + 1);
|
|
600
|
-
i = end + 1;
|
|
601
|
-
continue;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
result += str[i];
|
|
605
|
-
count++;
|
|
606
|
-
i++;
|
|
607
|
-
}
|
|
608
|
-
return result + colors.dim + "\u2026" + RESET;
|
|
609
|
-
}
|
|
610
|
-
var icons = USE_UNICODE ? {
|
|
611
|
-
success: `${colors.green}\u25CF${RESET}`,
|
|
612
|
-
warning: `${colors.yellow}\u25CB${RESET}`,
|
|
613
|
-
error: `${colors.red}\u25CF${RESET}`,
|
|
614
|
-
pending: `${colors.dim}\u25CB${RESET}`,
|
|
615
|
-
active: `${colors.green}\u25CF${RESET}`,
|
|
616
|
-
running: `${colors.yellow}\u25C6${RESET}`,
|
|
617
|
-
progress: `${colors.cyan}\u25C6${RESET}`,
|
|
618
|
-
empty: `${colors.dim}\u25C7${RESET}`
|
|
619
|
-
} : {
|
|
620
|
-
success: `${colors.green}*${RESET}`,
|
|
621
|
-
warning: `${colors.yellow}!${RESET}`,
|
|
622
|
-
error: `${colors.red}x${RESET}`,
|
|
623
|
-
pending: `${colors.dim}o${RESET}`,
|
|
624
|
-
active: `${colors.green}*${RESET}`,
|
|
625
|
-
running: `${colors.yellow}>${RESET}`,
|
|
626
|
-
progress: `${colors.cyan}>${RESET}`,
|
|
627
|
-
empty: `${colors.dim}.${RESET}`
|
|
628
|
-
};
|
|
629
|
-
function stripAnsi(str) {
|
|
630
|
-
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
631
|
-
}
|
|
632
|
-
function isAiCli() {
|
|
633
|
-
if (process.env.CLAUDECODE !== void 0) return true;
|
|
634
|
-
if (process.env.GEMINI_API_KEY !== void 0) return true;
|
|
635
|
-
if (process.env.CURSOR_CHANNEL !== void 0) return true;
|
|
636
|
-
if (process.env.CODY_AUTH !== void 0) return true;
|
|
637
|
-
if (process.env.CODEIUM_API_KEY !== void 0) return true;
|
|
638
|
-
if (process.env.GITHUB_COPILOT_CLI !== void 0) return true;
|
|
639
|
-
if (process.env.AIDER_MODEL !== void 0) return true;
|
|
640
|
-
if (process.env.CONTINUE_GLOBAL_DIR !== void 0) return true;
|
|
641
|
-
return false;
|
|
642
|
-
}
|
|
643
|
-
function isColorEnabled() {
|
|
644
|
-
if (process.env.NO_COLOR !== void 0) return false;
|
|
645
|
-
if (process.env.FORCE_COLOR !== void 0) return true;
|
|
646
|
-
if (isAiCli()) return true;
|
|
647
|
-
return process.stdout.isTTY ?? false;
|
|
648
|
-
}
|
|
649
|
-
function writeLine(str = "") {
|
|
650
|
-
const output = isColorEnabled() ? str : stripAnsi(str);
|
|
651
|
-
process.stdout.write(output + "\n");
|
|
652
|
-
}
|
|
653
|
-
var SPARKLINE_BLOCKS = USE_UNICODE ? ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"] : ["_", ".", "-", "=", "+", "#", "#", "#"];
|
|
654
|
-
function sparkline(values, _width) {
|
|
655
|
-
if (values.length === 0) return "";
|
|
656
|
-
const max = Math.max(...values, 1);
|
|
657
|
-
let result = "";
|
|
658
|
-
for (const val of values) {
|
|
659
|
-
const normalized = val / max;
|
|
660
|
-
const blockIndex = Math.min(Math.floor(normalized * SPARKLINE_BLOCKS.length), SPARKLINE_BLOCKS.length - 1);
|
|
661
|
-
if (normalized === 0) {
|
|
662
|
-
result += colors.dim + SPARKLINE_BLOCKS[0];
|
|
663
|
-
} else if (normalized < 0.5) {
|
|
664
|
-
result += colors.cyan + SPARKLINE_BLOCKS[blockIndex];
|
|
665
|
-
} else {
|
|
666
|
-
result += colors.green + SPARKLINE_BLOCKS[blockIndex];
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
return result + RESET;
|
|
670
|
-
}
|
|
671
|
-
function barChart(value, max, width = 20, label) {
|
|
672
|
-
const safeValue = Math.max(0, value || 0);
|
|
673
|
-
const safeMax = Math.max(1, max || 1);
|
|
674
|
-
const ratio = Math.min(1, safeValue / safeMax);
|
|
675
|
-
const filled = Math.round(ratio * width);
|
|
676
|
-
const empty = width - filled;
|
|
677
|
-
let bar = "";
|
|
678
|
-
for (let i = 0; i < filled; i++) {
|
|
679
|
-
const t = i / Math.max(filled - 1, 1);
|
|
680
|
-
const r = Math.round(16 + (6 - 16) * t);
|
|
681
|
-
const g = Math.round(185 + (182 - 185) * t);
|
|
682
|
-
const b = Math.round(129 + (212 - 129) * t);
|
|
683
|
-
bar += rgb(r, g, b) + BAR_FILLED;
|
|
684
|
-
}
|
|
685
|
-
bar += colors.dim + BAR_EMPTY.repeat(empty) + RESET;
|
|
686
|
-
if (label) {
|
|
687
|
-
return `${bar} ${label}`;
|
|
688
|
-
}
|
|
689
|
-
return bar;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
448
|
// src/commands/sessions.ts
|
|
693
449
|
async function sessionsCommand(options = {}) {
|
|
694
450
|
cleanupStaleSessions();
|
|
@@ -782,7 +538,7 @@ async function sessionsSummaryCommand(data, options = {}) {
|
|
|
782
538
|
if (data.squads.length > 0) {
|
|
783
539
|
const w = { squad: 14, actions: 26, outputs: 36 };
|
|
784
540
|
const tableWidth = w.squad + w.actions + w.outputs + 6;
|
|
785
|
-
const
|
|
541
|
+
const truncate = (text, max) => text.length > max ? text.substring(0, max - 1) + "\u2026" : text;
|
|
786
542
|
writeLine(` ${colors.green}${icons.active}${RESET} ${bold}${data.squads.length} Squads Active${RESET}`);
|
|
787
543
|
writeLine();
|
|
788
544
|
writeLine(` ${colors.purple}${box.topLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.topRight}${RESET}`);
|
|
@@ -790,7 +546,7 @@ async function sessionsSummaryCommand(data, options = {}) {
|
|
|
790
546
|
writeLine(header);
|
|
791
547
|
writeLine(` ${colors.purple}${box.teeRight}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.teeLeft}${RESET}`);
|
|
792
548
|
for (const squad of data.squads) {
|
|
793
|
-
const row = ` ${colors.purple}${box.vertical}${RESET} ${colors.cyan}${padEnd(
|
|
549
|
+
const row = ` ${colors.purple}${box.vertical}${RESET} ${colors.cyan}${padEnd(truncate(squad.name, w.squad - 1), w.squad)}${RESET}${padEnd(truncate(squad.actions, w.actions - 1), w.actions)}${padEnd(truncate(squad.outputs, w.outputs - 1), w.outputs)}${colors.purple}${box.vertical}${RESET}`;
|
|
794
550
|
writeLine(row);
|
|
795
551
|
}
|
|
796
552
|
writeLine(` ${colors.purple}${box.bottomLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.bottomRight}${RESET}`);
|
|
@@ -997,18 +753,6 @@ async function sessionsHistoryCommand(options = {}) {
|
|
|
997
753
|
}
|
|
998
754
|
|
|
999
755
|
export {
|
|
1000
|
-
RESET,
|
|
1001
|
-
colors,
|
|
1002
|
-
bold,
|
|
1003
|
-
gradient,
|
|
1004
|
-
progressBar,
|
|
1005
|
-
box,
|
|
1006
|
-
padEnd,
|
|
1007
|
-
truncate,
|
|
1008
|
-
icons,
|
|
1009
|
-
writeLine,
|
|
1010
|
-
sparkline,
|
|
1011
|
-
barChart,
|
|
1012
756
|
detectSquad,
|
|
1013
757
|
getLiveSessionSummaryAsync,
|
|
1014
758
|
startSession,
|
|
@@ -1020,4 +764,4 @@ export {
|
|
|
1020
764
|
buildCurrentSessionSummary,
|
|
1021
765
|
sessionsHistoryCommand
|
|
1022
766
|
};
|
|
1023
|
-
//# sourceMappingURL=chunk-
|
|
767
|
+
//# sourceMappingURL=chunk-HIQ2APYR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/sessions.ts","../src/commands/sessions.ts"],"sourcesContent":["/**\n * Session tracking for active Claude Code sessions\n * Provides heartbeat-based session state management\n *\n * Storage:\n * - Active sessions: .agents/sessions/active/{id}.json (quick lookup)\n * - Event history: .agents/sessions/history.jsonl (analytics)\n */\n\nimport { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync, unlinkSync, appendFileSync, createReadStream } from 'fs';\nimport { join, dirname } from 'path';\nimport { randomBytes } from 'crypto';\nimport { createInterface } from 'readline';\nimport { execSync } from 'child_process';\n\nexport interface SessionState {\n sessionId: string;\n squad: string | null;\n startedAt: string;\n lastHeartbeat: string;\n cwd: string;\n pid: number;\n}\n\nexport interface SessionSummary {\n totalSessions: number;\n bySquad: Record<string, number>;\n squadCount: number;\n byTool?: Record<string, number>; // Optional: breakdown by AI tool\n}\n\n// Event types for JSONL history\nexport type SessionEventType = 'start' | 'heartbeat' | 'stop' | 'stale_cleanup';\n\nexport interface SessionEvent {\n type: SessionEventType;\n sessionId: string;\n squad: string | null;\n ts: string;\n cwd?: string;\n pid?: number;\n durationMs?: number; // For stop events\n}\n\nexport interface SessionHistoryStats {\n totalSessions: number;\n totalDurationMs: number;\n avgDurationMs: number;\n bySquad: Record<string, { count: number; durationMs: number }>;\n byDate: Record<string, number>; // YYYY-MM-DD -> count\n peakConcurrent: number;\n}\n\n// Live AI coding assistant process info\nexport interface AIProcess {\n pid: number;\n tty: string;\n cwd: string;\n squad: string | null;\n tool: string; // 'claude', 'cursor', 'aider', 'gemini', etc.\n}\n\n// Supported AI coding tools (process names to detect)\nconst AI_TOOL_PATTERNS: { pattern: RegExp; name: string }[] = [\n { pattern: /^claude$/, name: 'claude' },\n { pattern: /^cursor$/i, name: 'cursor' },\n { pattern: /^aider$/, name: 'aider' },\n { pattern: /^gemini$/i, name: 'gemini' },\n { pattern: /^copilot$/i, name: 'copilot' },\n { pattern: /^cody$/i, name: 'cody' },\n { pattern: /^continue$/i, name: 'continue' },\n];\n\n// Session is stale after 5 minutes without heartbeat\nconst STALE_THRESHOLD_MS = 5 * 60 * 1000;\n\n// History file name\nconst HISTORY_FILE = 'history.jsonl';\n\n// Active sessions subdirectory\nconst ACTIVE_DIR = 'active';\n\n// Directory mapping for squad detection\nconst SQUAD_DIR_MAP: Record<string, string> = {\n 'hq': 'company',\n 'agents-squads-web': 'website',\n 'company': 'company',\n 'product': 'product',\n 'engineering': 'engineering',\n 'research': 'research',\n 'intelligence': 'intelligence',\n 'customer': 'customer',\n 'finance': 'finance',\n 'marketing': 'marketing',\n};\n\n/**\n * Find the .agents directory (sessions live at .agents/sessions/)\n */\nexport function findAgentsDir(): string | null {\n let dir = process.cwd();\n\n for (let i = 0; i < 5; i++) {\n const agentsPath = join(dir, '.agents');\n if (existsSync(agentsPath)) {\n return agentsPath;\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n\n return null;\n}\n\n/**\n * Get the sessions base directory\n */\nexport function getSessionsBaseDir(): string | null {\n const agentsDir = findAgentsDir();\n if (!agentsDir) return null;\n\n const sessionsDir = join(agentsDir, 'sessions');\n if (!existsSync(sessionsDir)) {\n mkdirSync(sessionsDir, { recursive: true });\n }\n return sessionsDir;\n}\n\n/**\n * Get the active sessions directory, creating it if needed\n */\nexport function getSessionsDir(): string | null {\n const baseDir = getSessionsBaseDir();\n if (!baseDir) return null;\n\n const activeDir = join(baseDir, ACTIVE_DIR);\n if (!existsSync(activeDir)) {\n mkdirSync(activeDir, { recursive: true });\n }\n return activeDir;\n}\n\n/**\n * Get the history file path\n */\nexport function getHistoryFilePath(): string | null {\n const baseDir = getSessionsBaseDir();\n if (!baseDir) return null;\n return join(baseDir, HISTORY_FILE);\n}\n\n/**\n * Append an event to the history JSONL file\n */\nfunction appendEvent(event: SessionEvent): void {\n const historyPath = getHistoryFilePath();\n if (!historyPath) return;\n\n try {\n const line = JSON.stringify(event) + '\\n';\n appendFileSync(historyPath, line);\n } catch {\n // Silently fail - history is optional\n }\n}\n\n/**\n * Detect which squad based on current working directory\n */\nexport function detectSquad(cwd: string = process.cwd()): string | null {\n // Pattern: .../agents-squads/{domain}/...\n const match = cwd.match(/agents-squads\\/([^/]+)/);\n if (match) {\n const dir = match[1];\n return SQUAD_DIR_MAP[dir] || dir;\n }\n return null;\n}\n\n/**\n * Detect running AI coding assistant processes (fast version - no lsof)\n * Returns processes immediately without cwd/squad info\n * Supports: Claude, Cursor, Aider, Gemini, Copilot, Cody, Continue\n */\nexport function detectAIProcessesFast(): AIProcess[] {\n const processes: AIProcess[] = [];\n\n try {\n // Get all processes - we'll filter for AI tools\n // Short timeout for responsiveness - this is called during dashboard render\n const psOutput = execSync('ps -eo pid,tty,comm 2>/dev/null', {\n encoding: 'utf-8',\n timeout: 2000, // Reduced from 5s for faster CLI response\n }).trim();\n\n if (!psOutput) return [];\n\n const lines = psOutput.split('\\n').filter(line => line.trim());\n\n for (const line of lines) {\n const parts = line.trim().split(/\\s+/);\n if (parts.length < 3) continue;\n\n const pid = parseInt(parts[0], 10);\n const tty = parts[1];\n const comm = parts.slice(2).join(' '); // Process name (may have spaces)\n\n if (isNaN(pid)) continue;\n\n // Check if this is an AI coding tool\n let toolName: string | null = null;\n for (const { pattern, name } of AI_TOOL_PATTERNS) {\n if (pattern.test(comm)) {\n toolName = name;\n break;\n }\n }\n\n if (!toolName) continue;\n\n processes.push({\n pid,\n tty,\n cwd: '', // No cwd in fast mode\n squad: null, // No squad detection in fast mode\n tool: toolName,\n });\n }\n } catch {\n // Process detection failed (command not found, timeout, etc.)\n // Return empty array - graceful degradation\n }\n\n return processes;\n}\n\n/**\n * Get cwd for a single process using lsof (async)\n */\nasync function getProcessCwd(pid: number): Promise<string> {\n return new Promise((resolve) => {\n try {\n const { exec } = require('child_process');\n exec(`lsof -p ${pid} 2>/dev/null | grep cwd | awk '{print $NF}'`, {\n encoding: 'utf-8',\n timeout: 3000,\n }, (error: Error | null, stdout: string) => {\n resolve(error ? '' : stdout.trim());\n });\n } catch {\n resolve('');\n }\n });\n}\n\n/**\n * Enrich processes with cwd and squad info (async, parallel lsof)\n * Call this after detectAIProcessesFast() when you need squad info\n */\nexport async function enrichProcessesWithSquad(processes: AIProcess[]): Promise<AIProcess[]> {\n if (processes.length === 0) return processes;\n\n // Run lsof for all processes in parallel\n const cwdPromises = processes.map(p => getProcessCwd(p.pid));\n const cwds = await Promise.all(cwdPromises);\n\n // Enrich each process with cwd and squad\n return processes.map((proc, i) => ({\n ...proc,\n cwd: cwds[i],\n squad: detectSquad(cwds[i]),\n }));\n}\n\n/**\n * Detect running AI coding assistant processes (full version with squad info)\n * Synchronous wrapper for backwards compatibility - calls lsof sequentially\n * For better performance, use detectAIProcessesFast() + enrichProcessesWithSquad()\n */\nexport function detectAIProcesses(): AIProcess[] {\n const processes = detectAIProcessesFast();\n\n // Synchronously enrich with cwd/squad (backwards compatible behavior)\n for (const proc of processes) {\n try {\n const lsofOutput = execSync(`lsof -p ${proc.pid} 2>/dev/null | grep cwd | awk '{print $NF}'`, {\n encoding: 'utf-8',\n timeout: 3000,\n }).trim();\n proc.cwd = lsofOutput || '';\n proc.squad = detectSquad(proc.cwd);\n } catch {\n // Keep empty cwd and null squad\n }\n }\n\n return processes;\n}\n\n// Backwards compatibility alias\nexport const detectClaudeProcesses = detectAIProcesses;\n\n/**\n * Get live session summary using real process detection (fast version)\n * Returns count immediately, squad breakdown shows 'unknown' until enriched\n */\nexport function getLiveSessionSummaryFast(): SessionSummary {\n const processes = detectAIProcessesFast();\n const bySquad: Record<string, number> = {};\n const byTool: Record<string, number> = {};\n\n for (const proc of processes) {\n const squad = proc.squad || 'unknown';\n bySquad[squad] = (bySquad[squad] || 0) + 1;\n byTool[proc.tool] = (byTool[proc.tool] || 0) + 1;\n }\n\n return {\n totalSessions: processes.length,\n bySquad,\n squadCount: Object.keys(bySquad).length,\n byTool,\n };\n}\n\n/**\n * Get live session summary with full squad detection (async, parallel lsof)\n * Use this when you need accurate squad breakdown\n */\nexport async function getLiveSessionSummaryAsync(): Promise<SessionSummary> {\n const processes = detectAIProcessesFast();\n const enrichedProcesses = await enrichProcessesWithSquad(processes);\n\n const bySquad: Record<string, number> = {};\n const byTool: Record<string, number> = {};\n\n for (const proc of enrichedProcesses) {\n const squad = proc.squad || 'unknown';\n bySquad[squad] = (bySquad[squad] || 0) + 1;\n byTool[proc.tool] = (byTool[proc.tool] || 0) + 1;\n }\n\n return {\n totalSessions: enrichedProcesses.length,\n bySquad,\n squadCount: Object.keys(bySquad).length,\n byTool,\n };\n}\n\n/**\n * Get live session summary using real process detection (synchronous, backwards compatible)\n * For better performance, use getLiveSessionSummaryFast() or getLiveSessionSummaryAsync()\n */\nexport function getLiveSessionSummary(): SessionSummary {\n const processes = detectAIProcesses();\n const bySquad: Record<string, number> = {};\n const byTool: Record<string, number> = {};\n\n for (const proc of processes) {\n const squad = proc.squad || 'unknown';\n bySquad[squad] = (bySquad[squad] || 0) + 1;\n byTool[proc.tool] = (byTool[proc.tool] || 0) + 1;\n }\n\n return {\n totalSessions: processes.length,\n bySquad,\n squadCount: Object.keys(bySquad).length,\n byTool,\n };\n}\n\n/**\n * Generate a unique session ID\n */\nfunction generateSessionId(): string {\n return randomBytes(8).toString('hex');\n}\n\n/**\n * Get current session ID from environment or generate new one\n */\nlet currentSessionId: string | null = null;\n\nexport function getSessionId(): string {\n if (currentSessionId) return currentSessionId;\n\n // Check if we have a session file for this PID\n const sessionsDir = getSessionsDir();\n if (sessionsDir) {\n const pid = process.pid;\n const files = readdirSync(sessionsDir).filter(f => f.endsWith('.json'));\n\n for (const file of files) {\n try {\n const content = readFileSync(join(sessionsDir, file), 'utf-8');\n const session = JSON.parse(content) as SessionState;\n if (session.pid === pid) {\n currentSessionId = session.sessionId;\n return currentSessionId;\n }\n } catch {\n // Ignore parse errors\n }\n }\n }\n\n // Generate new session ID\n currentSessionId = generateSessionId();\n return currentSessionId;\n}\n\n/**\n * Start a new session (write initial state file and log event)\n */\nexport function startSession(squad?: string): SessionState | null {\n const sessionsDir = getSessionsDir();\n if (!sessionsDir) return null;\n\n const sessionId = getSessionId();\n const now = new Date().toISOString();\n const cwd = process.cwd();\n const detectedSquad = squad || detectSquad(cwd);\n\n const session: SessionState = {\n sessionId,\n squad: detectedSquad,\n startedAt: now,\n lastHeartbeat: now,\n cwd,\n pid: process.pid,\n };\n\n const sessionPath = join(sessionsDir, `${sessionId}.json`);\n writeFileSync(sessionPath, JSON.stringify(session, null, 2));\n\n // Log start event to history\n appendEvent({\n type: 'start',\n sessionId,\n squad: detectedSquad,\n ts: now,\n cwd,\n pid: process.pid,\n });\n\n return session;\n}\n\n/**\n * Update heartbeat for current session\n */\nexport function updateHeartbeat(): boolean {\n const sessionsDir = getSessionsDir();\n if (!sessionsDir) return false;\n\n const sessionId = getSessionId();\n const sessionPath = join(sessionsDir, `${sessionId}.json`);\n\n if (!existsSync(sessionPath)) {\n // Session doesn't exist, start a new one\n startSession();\n return true;\n }\n\n try {\n const content = readFileSync(sessionPath, 'utf-8');\n const session = JSON.parse(content) as SessionState;\n session.lastHeartbeat = new Date().toISOString();\n writeFileSync(sessionPath, JSON.stringify(session, null, 2));\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Stop current session (remove state file and log event)\n */\nexport function stopSession(): boolean {\n const sessionsDir = getSessionsDir();\n if (!sessionsDir) return false;\n\n const sessionId = getSessionId();\n const sessionPath = join(sessionsDir, `${sessionId}.json`);\n\n if (existsSync(sessionPath)) {\n // Read session to get start time and squad for duration calculation\n let squad: string | null = null;\n let durationMs: number | undefined;\n\n try {\n const content = readFileSync(sessionPath, 'utf-8');\n const session = JSON.parse(content) as SessionState;\n squad = session.squad;\n durationMs = Date.now() - new Date(session.startedAt).getTime();\n } catch {\n // Ignore parse errors\n }\n\n unlinkSync(sessionPath);\n currentSessionId = null;\n\n // Log stop event to history\n appendEvent({\n type: 'stop',\n sessionId,\n squad,\n ts: new Date().toISOString(),\n durationMs,\n });\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Get all active sessions (non-stale)\n */\nexport function getActiveSessions(): SessionState[] {\n const sessionsDir = getSessionsDir();\n if (!sessionsDir) return [];\n\n const now = Date.now();\n const sessions: SessionState[] = [];\n\n try {\n const files = readdirSync(sessionsDir).filter(f => f.endsWith('.json'));\n\n for (const file of files) {\n try {\n const filePath = join(sessionsDir, file);\n const content = readFileSync(filePath, 'utf-8');\n const session = JSON.parse(content) as SessionState;\n\n // Check if session is stale\n const lastHeartbeat = new Date(session.lastHeartbeat).getTime();\n if (now - lastHeartbeat < STALE_THRESHOLD_MS) {\n sessions.push(session);\n }\n } catch {\n // Ignore parse errors\n }\n }\n } catch {\n // Directory read error\n }\n\n return sessions;\n}\n\n/**\n * Get session summary for dashboard\n */\nexport function getSessionSummary(): SessionSummary {\n const sessions = getActiveSessions();\n const bySquad: Record<string, number> = {};\n\n for (const session of sessions) {\n const squad = session.squad || 'unknown';\n bySquad[squad] = (bySquad[squad] || 0) + 1;\n }\n\n return {\n totalSessions: sessions.length,\n bySquad,\n squadCount: Object.keys(bySquad).length,\n };\n}\n\n/**\n * Clean up stale sessions (older than threshold) and log events\n */\nexport function cleanupStaleSessions(): number {\n const sessionsDir = getSessionsDir();\n if (!sessionsDir) return 0;\n\n const now = Date.now();\n const nowIso = new Date().toISOString();\n let cleaned = 0;\n\n try {\n const files = readdirSync(sessionsDir).filter(f => f.endsWith('.json'));\n\n for (const file of files) {\n try {\n const filePath = join(sessionsDir, file);\n const content = readFileSync(filePath, 'utf-8');\n const session = JSON.parse(content) as SessionState;\n\n const lastHeartbeat = new Date(session.lastHeartbeat).getTime();\n if (now - lastHeartbeat >= STALE_THRESHOLD_MS) {\n const durationMs = now - new Date(session.startedAt).getTime();\n\n unlinkSync(filePath);\n cleaned++;\n\n // Log stale cleanup event\n appendEvent({\n type: 'stale_cleanup',\n sessionId: session.sessionId,\n squad: session.squad,\n ts: nowIso,\n durationMs,\n });\n }\n } catch {\n // If we can't parse, remove the file\n try {\n unlinkSync(join(sessionsDir, file));\n cleaned++;\n } catch {\n // Ignore\n }\n }\n }\n } catch {\n // Directory read error\n }\n\n return cleaned;\n}\n\n/**\n * Read all events from history file\n */\nexport async function readSessionHistory(options: {\n since?: Date;\n until?: Date;\n squad?: string;\n type?: SessionEventType;\n limit?: number;\n} = {}): Promise<SessionEvent[]> {\n const historyPath = getHistoryFilePath();\n if (!historyPath || !existsSync(historyPath)) return [];\n\n const events: SessionEvent[] = [];\n const sinceMs = options.since?.getTime() || 0;\n const untilMs = options.until?.getTime() || Date.now();\n\n return new Promise((resolve) => {\n const rl = createInterface({\n input: createReadStream(historyPath),\n crlfDelay: Infinity,\n });\n\n rl.on('line', (line) => {\n if (!line.trim()) return;\n\n try {\n const event = JSON.parse(line) as SessionEvent;\n const eventMs = new Date(event.ts).getTime();\n\n // Apply filters\n if (eventMs < sinceMs || eventMs > untilMs) return;\n if (options.squad && event.squad !== options.squad) return;\n if (options.type && event.type !== options.type) return;\n\n events.push(event);\n } catch {\n // Ignore parse errors\n }\n });\n\n rl.on('close', () => {\n // Apply limit (from end, most recent first)\n if (options.limit && events.length > options.limit) {\n resolve(events.slice(-options.limit));\n } else {\n resolve(events);\n }\n });\n\n rl.on('error', () => {\n resolve([]);\n });\n });\n}\n\n/**\n * Get session history statistics\n */\nexport async function getSessionHistoryStats(options: {\n since?: Date;\n until?: Date;\n squad?: string;\n} = {}): Promise<SessionHistoryStats> {\n const events = await readSessionHistory(options);\n\n const stats: SessionHistoryStats = {\n totalSessions: 0,\n totalDurationMs: 0,\n avgDurationMs: 0,\n bySquad: {},\n byDate: {},\n peakConcurrent: 0,\n };\n\n // Track active sessions for peak concurrent calculation\n const activeSessions = new Map<string, { squad: string | null; startTs: number }>();\n let currentConcurrent = 0;\n\n for (const event of events) {\n const squad = event.squad || 'unknown';\n const date = event.ts.split('T')[0]; // YYYY-MM-DD\n\n if (event.type === 'start') {\n stats.totalSessions++;\n stats.byDate[date] = (stats.byDate[date] || 0) + 1;\n\n if (!stats.bySquad[squad]) {\n stats.bySquad[squad] = { count: 0, durationMs: 0 };\n }\n stats.bySquad[squad].count++;\n\n // Track for concurrent calculation\n activeSessions.set(event.sessionId, {\n squad: event.squad,\n startTs: new Date(event.ts).getTime(),\n });\n currentConcurrent++;\n stats.peakConcurrent = Math.max(stats.peakConcurrent, currentConcurrent);\n }\n\n if (event.type === 'stop' || event.type === 'stale_cleanup') {\n const duration = event.durationMs || 0;\n stats.totalDurationMs += duration;\n\n if (stats.bySquad[squad]) {\n stats.bySquad[squad].durationMs += duration;\n }\n\n // Remove from concurrent tracking\n if (activeSessions.has(event.sessionId)) {\n activeSessions.delete(event.sessionId);\n currentConcurrent = Math.max(0, currentConcurrent - 1);\n }\n }\n }\n\n // Calculate average duration\n const completedSessions = events.filter(e => e.type === 'stop' || e.type === 'stale_cleanup').length;\n if (completedSessions > 0) {\n stats.avgDurationMs = Math.round(stats.totalDurationMs / completedSessions);\n }\n\n return stats;\n}\n\n/**\n * Get recent session events (for display)\n */\nexport async function getRecentSessions(limit: number = 20): Promise<SessionEvent[]> {\n const events = await readSessionHistory({ limit: limit * 3 }); // Get more to filter\n\n // Group by session and get start/stop pairs\n const sessionEvents = new Map<string, SessionEvent[]>();\n for (const event of events) {\n if (!sessionEvents.has(event.sessionId)) {\n sessionEvents.set(event.sessionId, []);\n }\n sessionEvents.get(event.sessionId)!.push(event);\n }\n\n // Get the most recent start events\n const startEvents = events\n .filter(e => e.type === 'start')\n .slice(-limit);\n\n return startEvents.reverse(); // Most recent first\n}\n","/**\n * List active Claude Code sessions across squads\n */\n\nimport {\n getActiveSessions,\n getSessionSummary,\n cleanupStaleSessions,\n getSessionHistoryStats,\n getRecentSessions,\n SessionState,\n} from '../lib/sessions.js';\nimport {\n colors,\n bold,\n RESET,\n gradient,\n box,\n padEnd,\n icons,\n writeLine,\n} from '../lib/terminal.js';\n\ninterface SessionsOptions {\n verbose?: boolean;\n json?: boolean;\n}\n\nexport async function sessionsCommand(\n options: SessionsOptions = {}\n): Promise<void> {\n // Clean up stale sessions first\n cleanupStaleSessions();\n\n const sessions = getActiveSessions();\n const summary = getSessionSummary();\n\n // JSON output for scripts\n if (options.json) {\n console.log(JSON.stringify({ sessions, summary }, null, 2));\n return;\n }\n\n writeLine();\n writeLine(` ${gradient('squads')} ${colors.dim}sessions${RESET}`);\n writeLine();\n\n if (sessions.length === 0) {\n writeLine(` ${colors.dim}No active sessions${RESET}`);\n writeLine();\n writeLine(` ${colors.dim}Sessions are tracked automatically when Claude Code runs.${RESET}`);\n writeLine(` ${colors.dim}Each session updates its heartbeat via squads CLI commands.${RESET}`);\n writeLine();\n return;\n }\n\n // Summary line\n const squadText = summary.squadCount === 1 ? 'squad' : 'squads';\n const sessionText = summary.totalSessions === 1 ? 'session' : 'sessions';\n writeLine(` ${colors.green}${summary.totalSessions}${RESET} active ${sessionText} ${colors.dim}across${RESET} ${colors.cyan}${summary.squadCount}${RESET} ${squadText}`);\n writeLine();\n\n // Group by squad\n const bySquad: Record<string, SessionState[]> = {};\n for (const session of sessions) {\n const squad = session.squad || 'unknown';\n if (!bySquad[squad]) bySquad[squad] = [];\n bySquad[squad].push(session);\n }\n\n // Table\n const w = { squad: 16, sessions: 10, activity: 14 };\n const tableWidth = w.squad + w.sessions + w.activity + 4;\n\n writeLine(` ${colors.purple}${box.topLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.topRight}${RESET}`);\n\n const header = ` ${colors.purple}${box.vertical}${RESET} ` +\n `${bold}${padEnd('SQUAD', w.squad)}${RESET}` +\n `${bold}${padEnd('SESSIONS', w.sessions)}${RESET}` +\n `${bold}LAST ACTIVITY${RESET}` +\n ` ${colors.purple}${box.vertical}${RESET}`;\n writeLine(header);\n\n writeLine(` ${colors.purple}${box.teeRight}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.teeLeft}${RESET}`);\n\n for (const [squad, squadSessions] of Object.entries(bySquad).sort()) {\n // Find most recent activity\n let mostRecent = 0;\n for (const session of squadSessions) {\n const ts = new Date(session.lastHeartbeat).getTime();\n if (ts > mostRecent) mostRecent = ts;\n }\n\n const lastActivity = formatTimeAgo(mostRecent);\n const activityColor = getActivityColor(mostRecent);\n\n const row = ` ${colors.purple}${box.vertical}${RESET} ` +\n `${colors.cyan}${padEnd(squad, w.squad)}${RESET}` +\n `${padEnd(String(squadSessions.length), w.sessions)}` +\n `${padEnd(`${activityColor}${lastActivity}${RESET}`, w.activity)}` +\n `${colors.purple}${box.vertical}${RESET}`;\n\n writeLine(row);\n }\n\n writeLine(` ${colors.purple}${box.bottomLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.bottomRight}${RESET}`);\n\n // Verbose: show individual sessions\n if (options.verbose) {\n writeLine();\n writeLine(` ${bold}Session Details${RESET}`);\n writeLine();\n\n for (const session of sessions) {\n const squad = session.squad || 'unknown';\n const ago = formatTimeAgo(new Date(session.lastHeartbeat).getTime());\n\n writeLine(` ${icons.active} ${colors.white}${session.sessionId}${RESET}`);\n writeLine(` ${colors.dim}squad: ${squad} | pid: ${session.pid} | heartbeat: ${ago}${RESET}`);\n writeLine(` ${colors.dim}cwd: ${session.cwd}${RESET}`);\n }\n }\n\n writeLine();\n writeLine(` ${colors.dim}$${RESET} squads sessions -v ${colors.dim}Show session details${RESET}`);\n writeLine();\n}\n\n/**\n * Format timestamp as \"Xm ago\" or \"Xs ago\"\n */\nfunction formatTimeAgo(timestamp: number): string {\n const now = Date.now();\n const diff = now - timestamp;\n\n const seconds = Math.floor(diff / 1000);\n const minutes = Math.floor(seconds / 60);\n\n if (minutes >= 1) {\n return `${minutes}m ago`;\n }\n return `${seconds}s ago`;\n}\n\n/**\n * Get color based on how recent the activity is\n */\nfunction getActivityColor(timestamp: number): string {\n const now = Date.now();\n const diff = now - timestamp;\n\n const minutes = Math.floor(diff / (1000 * 60));\n\n if (minutes < 1) return colors.green;\n if (minutes < 3) return colors.yellow;\n return colors.dim;\n}\n\ninterface HistoryOptions {\n days?: number;\n squad?: string;\n json?: boolean;\n}\n\ninterface SummaryOptions {\n json?: boolean;\n}\n\nexport interface SessionSummaryData {\n squads: Array<{\n name: string;\n actions: string;\n outputs: string;\n }>;\n decisions?: Array<{\n question: string;\n answer: string;\n }>;\n customer?: {\n vertical: string;\n persona: string;\n painPoints: string[];\n };\n nextActions?: Array<{\n squad: string;\n action: string;\n }>;\n filesUpdated?: string[];\n targets?: {\n metric: string;\n value: string;\n }[];\n model?: string; // e.g., \"Claude Opus 4.5\"\n duration?: string; // e.g., \"45m\"\n}\n\n/**\n * Show a pretty summary of session work\n */\nexport async function sessionsSummaryCommand(\n data: SessionSummaryData,\n options: SummaryOptions = {}\n): Promise<void> {\n if (options.json) {\n console.log(JSON.stringify(data, null, 2));\n return;\n }\n\n writeLine();\n writeLine(` ${gradient('squads')} ${colors.dim}session summary${RESET}`);\n writeLine();\n\n // Squads table\n if (data.squads.length > 0) {\n const w = { squad: 14, actions: 26, outputs: 36 };\n const tableWidth = w.squad + w.actions + w.outputs + 6;\n\n // Helper to truncate text\n const truncate = (text: string, max: number) =>\n text.length > max ? text.substring(0, max - 1) + '…' : text;\n\n writeLine(` ${colors.green}${icons.active}${RESET} ${bold}${data.squads.length} Squads Active${RESET}`);\n writeLine();\n\n writeLine(` ${colors.purple}${box.topLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.topRight}${RESET}`);\n\n const header = ` ${colors.purple}${box.vertical}${RESET} ` +\n `${bold}${padEnd('SQUAD', w.squad)}${RESET}` +\n `${bold}${padEnd('ACTIONS', w.actions)}${RESET}` +\n `${bold}${padEnd('KEY OUTPUTS', w.outputs)}${RESET}` +\n `${colors.purple}${box.vertical}${RESET}`;\n writeLine(header);\n\n writeLine(` ${colors.purple}${box.teeRight}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.teeLeft}${RESET}`);\n\n for (const squad of data.squads) {\n const row = ` ${colors.purple}${box.vertical}${RESET} ` +\n `${colors.cyan}${padEnd(truncate(squad.name, w.squad - 1), w.squad)}${RESET}` +\n `${padEnd(truncate(squad.actions, w.actions - 1), w.actions)}` +\n `${padEnd(truncate(squad.outputs, w.outputs - 1), w.outputs)}` +\n `${colors.purple}${box.vertical}${RESET}`;\n writeLine(row);\n }\n\n writeLine(` ${colors.purple}${box.bottomLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.bottomRight}${RESET}`);\n }\n\n // Decisions\n if (data.decisions && data.decisions.length > 0) {\n writeLine();\n writeLine(` ${bold}Strategic Decisions${RESET}`);\n writeLine();\n\n const w = { question: 16, answer: 50 };\n const tableWidth = w.question + w.answer + 4;\n\n writeLine(` ${colors.purple}${box.topLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.topRight}${RESET}`);\n\n for (const decision of data.decisions) {\n const row = ` ${colors.purple}${box.vertical}${RESET} ` +\n `${colors.yellow}${padEnd(decision.question, w.question)}${RESET}` +\n `${padEnd(decision.answer, w.answer)}` +\n `${colors.purple}${box.vertical}${RESET}`;\n writeLine(row);\n }\n\n writeLine(` ${colors.purple}${box.bottomLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.bottomRight}${RESET}`);\n }\n\n // Target customer\n if (data.customer) {\n writeLine();\n writeLine(` ${bold}Target Customer${RESET}`);\n writeLine();\n writeLine(` ${colors.dim}Vertical:${RESET} ${colors.cyan}${data.customer.vertical}${RESET}`);\n writeLine(` ${colors.dim}Persona:${RESET} ${colors.white}${data.customer.persona}${RESET}`);\n writeLine(` ${colors.dim}Pain:${RESET} ${data.customer.painPoints.join(', ')}`);\n }\n\n // Next actions\n if (data.nextActions && data.nextActions.length > 0) {\n writeLine();\n writeLine(` ${bold}Next Actions${RESET}`);\n writeLine();\n\n for (const action of data.nextActions) {\n writeLine(` ${colors.cyan}${padEnd(action.squad, 14)}${RESET}${colors.dim}→${RESET} ${action.action}`);\n }\n }\n\n // Q1 Targets\n if (data.targets && data.targets.length > 0) {\n writeLine();\n writeLine(` ${bold}Q1 Targets${RESET}`);\n writeLine();\n\n for (const target of data.targets) {\n writeLine(` ${colors.dim}•${RESET} ${target.metric}: ${colors.green}${target.value}${RESET}`);\n }\n }\n\n // Files updated\n if (data.filesUpdated && data.filesUpdated.length > 0) {\n writeLine();\n writeLine(` ${colors.dim}Files updated:${RESET}`);\n for (const file of data.filesUpdated) {\n writeLine(` ${colors.dim} •${RESET} ${colors.cyan}${file}${RESET}`);\n }\n }\n\n writeLine();\n\n // Footer with model attribution\n const modelText = data.model ? data.model : 'Claude';\n const durationText = data.duration ? ` ${colors.dim}(${data.duration})${RESET}` : '';\n writeLine(` ${colors.dim}Generated by${RESET} ${colors.purple}${modelText}${RESET}${durationText}`);\n writeLine();\n}\n\n/**\n * Build summary from current session by detecting recent activity\n */\nexport async function buildCurrentSessionSummary(): Promise<SessionSummaryData> {\n const { existsSync, readdirSync, statSync, readFileSync } = await import('fs');\n const { join } = await import('path');\n const { findMemoryDir } = await import('../lib/memory.js');\n\n const memoryDir = findMemoryDir();\n const squads: SessionSummaryData['squads'] = [];\n const filesUpdated: string[] = [];\n\n // Look for files modified in last 2 hours (current session window)\n const sessionWindow = 2 * 60 * 60 * 1000; // 2 hours\n const now = Date.now();\n\n if (memoryDir && existsSync(memoryDir)) {\n const squadDirs = readdirSync(memoryDir, { withFileTypes: true })\n .filter(d => d.isDirectory());\n\n for (const squadDir of squadDirs) {\n const squadPath = join(memoryDir, squadDir.name);\n let squadModified = false;\n let stateContent = '';\n let executionContent = '';\n\n try {\n const agentDirs = readdirSync(squadPath, { withFileTypes: true })\n .filter(d => d.isDirectory());\n\n for (const agentDir of agentDirs) {\n const agentPath = join(squadPath, agentDir.name);\n const files = readdirSync(agentPath).filter(f => f.endsWith('.md'));\n\n for (const file of files) {\n const filePath = join(agentPath, file);\n const stats = statSync(filePath);\n\n if (now - stats.mtimeMs < sessionWindow) {\n squadModified = true;\n const relativePath = `${squadDir.name}/${agentDir.name}/${file}`;\n filesUpdated.push(relativePath);\n\n // Read content for summary\n if (file === 'state.md') {\n stateContent = readFileSync(filePath, 'utf-8');\n } else if (file === 'executions.md') {\n executionContent = readFileSync(filePath, 'utf-8');\n }\n }\n }\n }\n\n if (squadModified) {\n // Extract summary from state/execution content\n let actions = 'State updated';\n let outputs = 'Memory refreshed';\n\n // Try to extract info from execution log\n if (executionContent) {\n const lines = executionContent.split('\\n').filter(l => l.trim());\n const recentEntry = lines.slice(-10).join(' ');\n if (recentEntry.includes('completed')) {\n actions = 'Execution completed';\n }\n // Extract key points\n const keyMatch = recentEntry.match(/Key (?:findings|decisions|outputs)?:?\\s*([^.]+)/i);\n if (keyMatch) {\n outputs = keyMatch[1].substring(0, 50);\n }\n }\n\n // Try to extract from state header\n if (stateContent) {\n const updatedMatch = stateContent.match(/Updated:\\s*([^\\n]+)/);\n if (updatedMatch) {\n actions = `Updated ${updatedMatch[1]}`;\n }\n }\n\n squads.push({\n name: squadDir.name.charAt(0).toUpperCase() + squadDir.name.slice(1),\n actions,\n outputs: outputs.length > 44 ? outputs.substring(0, 41) + '...' : outputs,\n });\n }\n } catch {\n // Skip if can't read\n }\n }\n }\n\n // If no recent activity found\n if (squads.length === 0) {\n squads.push({\n name: 'No recent activity',\n actions: '—',\n outputs: 'Run squads to see activity here',\n });\n }\n\n return {\n squads,\n filesUpdated: filesUpdated.length > 0 ? filesUpdated : undefined,\n model: process.env.ANTHROPIC_MODEL || 'Claude',\n };\n}\n\n/**\n * Show session history and statistics\n */\nexport async function sessionsHistoryCommand(\n options: HistoryOptions = {}\n): Promise<void> {\n const days = options.days || 7;\n const since = new Date(Date.now() - days * 24 * 60 * 60 * 1000);\n\n const stats = await getSessionHistoryStats({\n since,\n squad: options.squad,\n });\n\n const recentSessions = await getRecentSessions(10);\n\n // JSON output\n if (options.json) {\n console.log(JSON.stringify({ stats, recentSessions }, null, 2));\n return;\n }\n\n writeLine();\n writeLine(` ${gradient('squads')} ${colors.dim}sessions history${RESET} ${colors.dim}(${days}d)${RESET}`);\n writeLine();\n\n if (stats.totalSessions === 0) {\n writeLine(` ${colors.dim}No session history found${RESET}`);\n writeLine();\n writeLine(` ${colors.dim}Session events are logged to .agents/sessions/history.jsonl${RESET}`);\n writeLine();\n return;\n }\n\n // Summary stats\n const avgMinutes = Math.round(stats.avgDurationMs / 60000);\n const totalHours = Math.round(stats.totalDurationMs / 3600000 * 10) / 10;\n\n writeLine(` ${bold}Summary${RESET}`);\n writeLine(` ${colors.cyan}${stats.totalSessions}${RESET} sessions ${colors.dim}│${RESET} ${colors.green}${totalHours}h${RESET} total ${colors.dim}│${RESET} ${colors.yellow}${avgMinutes}m${RESET} avg ${colors.dim}│${RESET} ${colors.purple}${stats.peakConcurrent}${RESET} peak`);\n writeLine();\n\n // By squad table\n const squads = Object.entries(stats.bySquad).sort((a, b) => b[1].count - a[1].count);\n\n if (squads.length > 0) {\n const w = { squad: 16, sessions: 10, duration: 12 };\n const tableWidth = w.squad + w.sessions + w.duration + 4;\n\n writeLine(` ${bold}By Squad${RESET}`);\n writeLine();\n writeLine(` ${colors.purple}${box.topLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.topRight}${RESET}`);\n\n const header = ` ${colors.purple}${box.vertical}${RESET} ` +\n `${bold}${padEnd('SQUAD', w.squad)}${RESET}` +\n `${bold}${padEnd('SESSIONS', w.sessions)}${RESET}` +\n `${bold}DURATION${RESET}` +\n ` ${colors.purple}${box.vertical}${RESET}`;\n writeLine(header);\n\n writeLine(` ${colors.purple}${box.teeRight}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.teeLeft}${RESET}`);\n\n for (const [squad, data] of squads) {\n const hours = Math.round(data.durationMs / 3600000 * 10) / 10;\n\n const row = ` ${colors.purple}${box.vertical}${RESET} ` +\n `${colors.cyan}${padEnd(squad, w.squad)}${RESET}` +\n `${padEnd(String(data.count), w.sessions)}` +\n `${padEnd(`${hours}h`, w.duration)}` +\n `${colors.purple}${box.vertical}${RESET}`;\n\n writeLine(row);\n }\n\n writeLine(` ${colors.purple}${box.bottomLeft}${colors.dim}${box.horizontal.repeat(tableWidth)}${colors.purple}${box.bottomRight}${RESET}`);\n }\n\n // Recent sessions\n if (recentSessions.length > 0) {\n writeLine();\n writeLine(` ${bold}Recent Sessions${RESET}`);\n writeLine();\n\n for (const event of recentSessions.slice(0, 5)) {\n const squad = event.squad || 'unknown';\n const date = new Date(event.ts);\n const timeStr = date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' });\n const dateStr = date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' });\n\n writeLine(` ${colors.dim}${dateStr} ${timeStr}${RESET} ${colors.cyan}${squad}${RESET} ${colors.dim}${event.sessionId.slice(0, 8)}${RESET}`);\n }\n }\n\n // By date (last 7 days)\n const dates = Object.entries(stats.byDate)\n .sort((a, b) => b[0].localeCompare(a[0]))\n .slice(0, 7);\n\n if (dates.length > 1) {\n writeLine();\n writeLine(` ${bold}Daily Activity${RESET}`);\n writeLine();\n\n for (const [date, count] of dates) {\n const bar = '█'.repeat(Math.min(count, 20));\n writeLine(` ${colors.dim}${date}${RESET} ${colors.green}${bar}${RESET} ${count}`);\n }\n }\n\n writeLine();\n writeLine(` ${colors.dim}$${RESET} squads sessions history --days 30 ${colors.dim}Longer history${RESET}`);\n writeLine(` ${colors.dim}$${RESET} squads sessions history -s website ${colors.dim}Filter by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