agentflow-core 0.2.1 → 0.2.2
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/dist/{chunk-FJVQYJFB.js → chunk-WOJEID7V.js} +37 -28
- package/dist/cli.cjs +41 -31
- package/dist/cli.js +5 -4
- package/dist/index.cjs +37 -28
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -647,7 +647,7 @@ var C = {
|
|
|
647
647
|
white: "\x1B[37m"
|
|
648
648
|
};
|
|
649
649
|
function parseArgs(argv) {
|
|
650
|
-
const config = {
|
|
650
|
+
const config = { dirs: [], refreshMs: 3e3, recursive: false };
|
|
651
651
|
const args = argv.slice(0);
|
|
652
652
|
if (args[0] === "live") args.shift();
|
|
653
653
|
let i = 0;
|
|
@@ -664,18 +664,14 @@ function parseArgs(argv) {
|
|
|
664
664
|
} else if (arg === "--recursive" || arg === "-R") {
|
|
665
665
|
config.recursive = true;
|
|
666
666
|
i++;
|
|
667
|
-
} else if (arg === "--traces-dir" || arg === "-t") {
|
|
668
|
-
i++;
|
|
669
|
-
config.tracesDir = args[i] ?? config.tracesDir;
|
|
670
|
-
i++;
|
|
671
667
|
} else if (!arg.startsWith("-")) {
|
|
672
|
-
config.
|
|
668
|
+
config.dirs.push(resolve2(arg));
|
|
673
669
|
i++;
|
|
674
670
|
} else {
|
|
675
671
|
i++;
|
|
676
672
|
}
|
|
677
673
|
}
|
|
678
|
-
config.
|
|
674
|
+
if (config.dirs.length === 0) config.dirs.push(resolve2("."));
|
|
679
675
|
return config;
|
|
680
676
|
}
|
|
681
677
|
function printUsage() {
|
|
@@ -683,13 +679,13 @@ function printUsage() {
|
|
|
683
679
|
AgentFlow Live Monitor \u2014 real-time terminal dashboard for agent systems.
|
|
684
680
|
|
|
685
681
|
Auto-detects agent traces, state files, job schedulers, and session logs
|
|
686
|
-
from any JSON/JSONL files in the watched
|
|
682
|
+
from any JSON/JSONL files in the watched directories.
|
|
687
683
|
|
|
688
684
|
Usage:
|
|
689
|
-
agentflow live [
|
|
685
|
+
agentflow live [dir...] [options]
|
|
690
686
|
|
|
691
687
|
Arguments:
|
|
692
|
-
|
|
688
|
+
dir One or more directories to watch (default: .)
|
|
693
689
|
|
|
694
690
|
Options:
|
|
695
691
|
-r, --refresh <secs> Refresh interval in seconds (default: 3)
|
|
@@ -698,38 +694,42 @@ Options:
|
|
|
698
694
|
|
|
699
695
|
Examples:
|
|
700
696
|
agentflow live ./data
|
|
701
|
-
agentflow live ./traces --refresh 5
|
|
697
|
+
agentflow live ./traces ./cron ./workers --refresh 5
|
|
702
698
|
agentflow live /var/lib/myagent -R
|
|
703
699
|
`.trim());
|
|
704
700
|
}
|
|
705
|
-
function scanFiles(
|
|
701
|
+
function scanFiles(dirs, recursive) {
|
|
706
702
|
const results = [];
|
|
707
|
-
|
|
703
|
+
const seen = /* @__PURE__ */ new Set();
|
|
704
|
+
function scanDir(d, topLevel) {
|
|
708
705
|
try {
|
|
709
706
|
for (const f of readdirSync2(d)) {
|
|
710
707
|
if (f.startsWith(".")) continue;
|
|
711
708
|
const fp = join2(d, f);
|
|
709
|
+
if (seen.has(fp)) continue;
|
|
712
710
|
let stat;
|
|
713
711
|
try {
|
|
714
712
|
stat = statSync2(fp);
|
|
715
713
|
} catch {
|
|
716
714
|
continue;
|
|
717
715
|
}
|
|
718
|
-
if (stat.isDirectory() && recursive &&
|
|
719
|
-
scanDir(fp);
|
|
716
|
+
if (stat.isDirectory() && recursive && topLevel) {
|
|
717
|
+
scanDir(fp, false);
|
|
720
718
|
continue;
|
|
721
719
|
}
|
|
722
720
|
if (!stat.isFile()) continue;
|
|
723
721
|
if (f.endsWith(".json")) {
|
|
722
|
+
seen.add(fp);
|
|
724
723
|
results.push({ filename: f, path: fp, mtime: stat.mtime.getTime(), ext: ".json" });
|
|
725
724
|
} else if (f.endsWith(".jsonl")) {
|
|
725
|
+
seen.add(fp);
|
|
726
726
|
results.push({ filename: f, path: fp, mtime: stat.mtime.getTime(), ext: ".jsonl" });
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
} catch {
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
scanDir(dir);
|
|
732
|
+
for (const dir of dirs) scanDir(dir, true);
|
|
733
733
|
results.sort((a, b) => b.mtime - a.mtime);
|
|
734
734
|
return results;
|
|
735
735
|
}
|
|
@@ -883,7 +883,7 @@ var prevFileCount = 0;
|
|
|
883
883
|
var newExecCount = 0;
|
|
884
884
|
var sessionStart = Date.now();
|
|
885
885
|
function render(config) {
|
|
886
|
-
const files = scanFiles(config.
|
|
886
|
+
const files = scanFiles(config.dirs, config.recursive);
|
|
887
887
|
if (files.length > prevFileCount && prevFileCount > 0) {
|
|
888
888
|
newExecCount += files.length - prevFileCount;
|
|
889
889
|
}
|
|
@@ -1047,10 +1047,11 @@ function render(config) {
|
|
|
1047
1047
|
if (files.length === 0) {
|
|
1048
1048
|
console.log("");
|
|
1049
1049
|
console.log(` ${C.dim}No JSON/JSONL files found. Waiting for data in:${C.reset}`);
|
|
1050
|
-
console.log(` ${C.dim}${
|
|
1050
|
+
for (const d of config.dirs) console.log(` ${C.dim} ${d}${C.reset}`);
|
|
1051
1051
|
}
|
|
1052
1052
|
console.log("");
|
|
1053
|
-
|
|
1053
|
+
const dirLabel = config.dirs.length === 1 ? config.dirs[0] : `${config.dirs.length} directories`;
|
|
1054
|
+
console.log(` ${C.dim}Watching: ${dirLabel}${C.reset}`);
|
|
1054
1055
|
console.log(` ${C.dim}Press Ctrl+C to exit${C.reset}`);
|
|
1055
1056
|
}
|
|
1056
1057
|
function getDistDepth(dt, spanId) {
|
|
@@ -1061,19 +1062,27 @@ function getDistDepth(dt, spanId) {
|
|
|
1061
1062
|
}
|
|
1062
1063
|
function startLive(argv) {
|
|
1063
1064
|
const config = parseArgs(argv);
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
console.error(
|
|
1065
|
+
const valid = config.dirs.filter((d) => existsSync2(d));
|
|
1066
|
+
if (valid.length === 0) {
|
|
1067
|
+
console.error(`No valid directories found: ${config.dirs.join(", ")}`);
|
|
1068
|
+
console.error("Specify directories containing JSON/JSONL files: agentflow live <dir> [dir...]");
|
|
1067
1069
|
process.exit(1);
|
|
1068
1070
|
}
|
|
1071
|
+
const invalid = config.dirs.filter((d) => !existsSync2(d));
|
|
1072
|
+
if (invalid.length > 0) {
|
|
1073
|
+
console.warn(`Skipping non-existent: ${invalid.join(", ")}`);
|
|
1074
|
+
}
|
|
1075
|
+
config.dirs = valid;
|
|
1069
1076
|
render(config);
|
|
1070
1077
|
let debounce = null;
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1078
|
+
for (const dir of config.dirs) {
|
|
1079
|
+
try {
|
|
1080
|
+
watch(dir, { recursive: config.recursive }, () => {
|
|
1081
|
+
if (debounce) clearTimeout(debounce);
|
|
1082
|
+
debounce = setTimeout(() => render(config), 500);
|
|
1083
|
+
});
|
|
1084
|
+
} catch {
|
|
1085
|
+
}
|
|
1077
1086
|
}
|
|
1078
1087
|
setInterval(() => render(config), config.refreshMs);
|
|
1079
1088
|
process.on("SIGINT", () => {
|
package/dist/cli.cjs
CHANGED
|
@@ -587,7 +587,7 @@ var C = {
|
|
|
587
587
|
white: "\x1B[37m"
|
|
588
588
|
};
|
|
589
589
|
function parseArgs(argv) {
|
|
590
|
-
const config = {
|
|
590
|
+
const config = { dirs: [], refreshMs: 3e3, recursive: false };
|
|
591
591
|
const args = argv.slice(0);
|
|
592
592
|
if (args[0] === "live") args.shift();
|
|
593
593
|
let i = 0;
|
|
@@ -604,18 +604,14 @@ function parseArgs(argv) {
|
|
|
604
604
|
} else if (arg === "--recursive" || arg === "-R") {
|
|
605
605
|
config.recursive = true;
|
|
606
606
|
i++;
|
|
607
|
-
} else if (arg === "--traces-dir" || arg === "-t") {
|
|
608
|
-
i++;
|
|
609
|
-
config.tracesDir = args[i] ?? config.tracesDir;
|
|
610
|
-
i++;
|
|
611
607
|
} else if (!arg.startsWith("-")) {
|
|
612
|
-
config.
|
|
608
|
+
config.dirs.push((0, import_node_path2.resolve)(arg));
|
|
613
609
|
i++;
|
|
614
610
|
} else {
|
|
615
611
|
i++;
|
|
616
612
|
}
|
|
617
613
|
}
|
|
618
|
-
config.
|
|
614
|
+
if (config.dirs.length === 0) config.dirs.push((0, import_node_path2.resolve)("."));
|
|
619
615
|
return config;
|
|
620
616
|
}
|
|
621
617
|
function printUsage() {
|
|
@@ -623,13 +619,13 @@ function printUsage() {
|
|
|
623
619
|
AgentFlow Live Monitor \u2014 real-time terminal dashboard for agent systems.
|
|
624
620
|
|
|
625
621
|
Auto-detects agent traces, state files, job schedulers, and session logs
|
|
626
|
-
from any JSON/JSONL files in the watched
|
|
622
|
+
from any JSON/JSONL files in the watched directories.
|
|
627
623
|
|
|
628
624
|
Usage:
|
|
629
|
-
agentflow live [
|
|
625
|
+
agentflow live [dir...] [options]
|
|
630
626
|
|
|
631
627
|
Arguments:
|
|
632
|
-
|
|
628
|
+
dir One or more directories to watch (default: .)
|
|
633
629
|
|
|
634
630
|
Options:
|
|
635
631
|
-r, --refresh <secs> Refresh interval in seconds (default: 3)
|
|
@@ -638,38 +634,42 @@ Options:
|
|
|
638
634
|
|
|
639
635
|
Examples:
|
|
640
636
|
agentflow live ./data
|
|
641
|
-
agentflow live ./traces --refresh 5
|
|
637
|
+
agentflow live ./traces ./cron ./workers --refresh 5
|
|
642
638
|
agentflow live /var/lib/myagent -R
|
|
643
639
|
`.trim());
|
|
644
640
|
}
|
|
645
|
-
function scanFiles(
|
|
641
|
+
function scanFiles(dirs, recursive) {
|
|
646
642
|
const results = [];
|
|
647
|
-
|
|
643
|
+
const seen = /* @__PURE__ */ new Set();
|
|
644
|
+
function scanDir(d, topLevel) {
|
|
648
645
|
try {
|
|
649
646
|
for (const f of (0, import_node_fs2.readdirSync)(d)) {
|
|
650
647
|
if (f.startsWith(".")) continue;
|
|
651
648
|
const fp = (0, import_node_path2.join)(d, f);
|
|
649
|
+
if (seen.has(fp)) continue;
|
|
652
650
|
let stat;
|
|
653
651
|
try {
|
|
654
652
|
stat = (0, import_node_fs2.statSync)(fp);
|
|
655
653
|
} catch {
|
|
656
654
|
continue;
|
|
657
655
|
}
|
|
658
|
-
if (stat.isDirectory() && recursive &&
|
|
659
|
-
scanDir(fp);
|
|
656
|
+
if (stat.isDirectory() && recursive && topLevel) {
|
|
657
|
+
scanDir(fp, false);
|
|
660
658
|
continue;
|
|
661
659
|
}
|
|
662
660
|
if (!stat.isFile()) continue;
|
|
663
661
|
if (f.endsWith(".json")) {
|
|
662
|
+
seen.add(fp);
|
|
664
663
|
results.push({ filename: f, path: fp, mtime: stat.mtime.getTime(), ext: ".json" });
|
|
665
664
|
} else if (f.endsWith(".jsonl")) {
|
|
665
|
+
seen.add(fp);
|
|
666
666
|
results.push({ filename: f, path: fp, mtime: stat.mtime.getTime(), ext: ".jsonl" });
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
} catch {
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
scanDir(dir);
|
|
672
|
+
for (const dir of dirs) scanDir(dir, true);
|
|
673
673
|
results.sort((a, b) => b.mtime - a.mtime);
|
|
674
674
|
return results;
|
|
675
675
|
}
|
|
@@ -823,7 +823,7 @@ var prevFileCount = 0;
|
|
|
823
823
|
var newExecCount = 0;
|
|
824
824
|
var sessionStart = Date.now();
|
|
825
825
|
function render(config) {
|
|
826
|
-
const files = scanFiles(config.
|
|
826
|
+
const files = scanFiles(config.dirs, config.recursive);
|
|
827
827
|
if (files.length > prevFileCount && prevFileCount > 0) {
|
|
828
828
|
newExecCount += files.length - prevFileCount;
|
|
829
829
|
}
|
|
@@ -987,10 +987,11 @@ function render(config) {
|
|
|
987
987
|
if (files.length === 0) {
|
|
988
988
|
console.log("");
|
|
989
989
|
console.log(` ${C.dim}No JSON/JSONL files found. Waiting for data in:${C.reset}`);
|
|
990
|
-
console.log(` ${C.dim}${
|
|
990
|
+
for (const d of config.dirs) console.log(` ${C.dim} ${d}${C.reset}`);
|
|
991
991
|
}
|
|
992
992
|
console.log("");
|
|
993
|
-
|
|
993
|
+
const dirLabel = config.dirs.length === 1 ? config.dirs[0] : `${config.dirs.length} directories`;
|
|
994
|
+
console.log(` ${C.dim}Watching: ${dirLabel}${C.reset}`);
|
|
994
995
|
console.log(` ${C.dim}Press Ctrl+C to exit${C.reset}`);
|
|
995
996
|
}
|
|
996
997
|
function getDistDepth(dt, spanId) {
|
|
@@ -1001,19 +1002,27 @@ function getDistDepth(dt, spanId) {
|
|
|
1001
1002
|
}
|
|
1002
1003
|
function startLive(argv) {
|
|
1003
1004
|
const config = parseArgs(argv);
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
console.error(
|
|
1005
|
+
const valid = config.dirs.filter((d) => (0, import_node_fs2.existsSync)(d));
|
|
1006
|
+
if (valid.length === 0) {
|
|
1007
|
+
console.error(`No valid directories found: ${config.dirs.join(", ")}`);
|
|
1008
|
+
console.error("Specify directories containing JSON/JSONL files: agentflow live <dir> [dir...]");
|
|
1007
1009
|
process.exit(1);
|
|
1008
1010
|
}
|
|
1011
|
+
const invalid = config.dirs.filter((d) => !(0, import_node_fs2.existsSync)(d));
|
|
1012
|
+
if (invalid.length > 0) {
|
|
1013
|
+
console.warn(`Skipping non-existent: ${invalid.join(", ")}`);
|
|
1014
|
+
}
|
|
1015
|
+
config.dirs = valid;
|
|
1009
1016
|
render(config);
|
|
1010
1017
|
let debounce = null;
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1018
|
+
for (const dir of config.dirs) {
|
|
1019
|
+
try {
|
|
1020
|
+
(0, import_node_fs2.watch)(dir, { recursive: config.recursive }, () => {
|
|
1021
|
+
if (debounce) clearTimeout(debounce);
|
|
1022
|
+
debounce = setTimeout(() => render(config), 500);
|
|
1023
|
+
});
|
|
1024
|
+
} catch {
|
|
1025
|
+
}
|
|
1017
1026
|
}
|
|
1018
1027
|
setInterval(() => render(config), config.refreshMs);
|
|
1019
1028
|
process.on("SIGINT", () => {
|
|
@@ -1031,15 +1040,16 @@ Usage:
|
|
|
1031
1040
|
agentflow <command> [options]
|
|
1032
1041
|
|
|
1033
1042
|
Commands:
|
|
1034
|
-
run [options] -- <cmd>
|
|
1035
|
-
live [dir] [options] Real-time terminal monitor (auto-detects any JSON/JSONL)
|
|
1043
|
+
run [options] -- <cmd> Wrap a command with automatic execution tracing
|
|
1044
|
+
live [dir...] [options] Real-time terminal monitor (auto-detects any JSON/JSONL)
|
|
1036
1045
|
|
|
1037
1046
|
Run \`agentflow <command> --help\` for command-specific options.
|
|
1038
1047
|
|
|
1039
1048
|
Examples:
|
|
1040
1049
|
agentflow run --traces-dir ./traces -- python -m myagent process
|
|
1041
1050
|
agentflow live ./data
|
|
1042
|
-
agentflow live ./
|
|
1051
|
+
agentflow live ./traces ./cron ./workers -R
|
|
1052
|
+
agentflow live ./data --refresh 5
|
|
1043
1053
|
`.trim());
|
|
1044
1054
|
}
|
|
1045
1055
|
function parseRunArgs(argv) {
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runTraced,
|
|
4
4
|
startLive
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WOJEID7V.js";
|
|
6
6
|
|
|
7
7
|
// src/cli.ts
|
|
8
8
|
import { basename } from "path";
|
|
@@ -14,15 +14,16 @@ Usage:
|
|
|
14
14
|
agentflow <command> [options]
|
|
15
15
|
|
|
16
16
|
Commands:
|
|
17
|
-
run [options] -- <cmd>
|
|
18
|
-
live [dir] [options] Real-time terminal monitor (auto-detects any JSON/JSONL)
|
|
17
|
+
run [options] -- <cmd> Wrap a command with automatic execution tracing
|
|
18
|
+
live [dir...] [options] Real-time terminal monitor (auto-detects any JSON/JSONL)
|
|
19
19
|
|
|
20
20
|
Run \`agentflow <command> --help\` for command-specific options.
|
|
21
21
|
|
|
22
22
|
Examples:
|
|
23
23
|
agentflow run --traces-dir ./traces -- python -m myagent process
|
|
24
24
|
agentflow live ./data
|
|
25
|
-
agentflow live ./
|
|
25
|
+
agentflow live ./traces ./cron ./workers -R
|
|
26
|
+
agentflow live ./data --refresh 5
|
|
26
27
|
`.trim());
|
|
27
28
|
}
|
|
28
29
|
function parseRunArgs(argv) {
|
package/dist/index.cjs
CHANGED
|
@@ -693,7 +693,7 @@ var C = {
|
|
|
693
693
|
white: "\x1B[37m"
|
|
694
694
|
};
|
|
695
695
|
function parseArgs(argv) {
|
|
696
|
-
const config = {
|
|
696
|
+
const config = { dirs: [], refreshMs: 3e3, recursive: false };
|
|
697
697
|
const args = argv.slice(0);
|
|
698
698
|
if (args[0] === "live") args.shift();
|
|
699
699
|
let i = 0;
|
|
@@ -710,18 +710,14 @@ function parseArgs(argv) {
|
|
|
710
710
|
} else if (arg === "--recursive" || arg === "-R") {
|
|
711
711
|
config.recursive = true;
|
|
712
712
|
i++;
|
|
713
|
-
} else if (arg === "--traces-dir" || arg === "-t") {
|
|
714
|
-
i++;
|
|
715
|
-
config.tracesDir = args[i] ?? config.tracesDir;
|
|
716
|
-
i++;
|
|
717
713
|
} else if (!arg.startsWith("-")) {
|
|
718
|
-
config.
|
|
714
|
+
config.dirs.push((0, import_node_path2.resolve)(arg));
|
|
719
715
|
i++;
|
|
720
716
|
} else {
|
|
721
717
|
i++;
|
|
722
718
|
}
|
|
723
719
|
}
|
|
724
|
-
config.
|
|
720
|
+
if (config.dirs.length === 0) config.dirs.push((0, import_node_path2.resolve)("."));
|
|
725
721
|
return config;
|
|
726
722
|
}
|
|
727
723
|
function printUsage() {
|
|
@@ -729,13 +725,13 @@ function printUsage() {
|
|
|
729
725
|
AgentFlow Live Monitor \u2014 real-time terminal dashboard for agent systems.
|
|
730
726
|
|
|
731
727
|
Auto-detects agent traces, state files, job schedulers, and session logs
|
|
732
|
-
from any JSON/JSONL files in the watched
|
|
728
|
+
from any JSON/JSONL files in the watched directories.
|
|
733
729
|
|
|
734
730
|
Usage:
|
|
735
|
-
agentflow live [
|
|
731
|
+
agentflow live [dir...] [options]
|
|
736
732
|
|
|
737
733
|
Arguments:
|
|
738
|
-
|
|
734
|
+
dir One or more directories to watch (default: .)
|
|
739
735
|
|
|
740
736
|
Options:
|
|
741
737
|
-r, --refresh <secs> Refresh interval in seconds (default: 3)
|
|
@@ -744,38 +740,42 @@ Options:
|
|
|
744
740
|
|
|
745
741
|
Examples:
|
|
746
742
|
agentflow live ./data
|
|
747
|
-
agentflow live ./traces --refresh 5
|
|
743
|
+
agentflow live ./traces ./cron ./workers --refresh 5
|
|
748
744
|
agentflow live /var/lib/myagent -R
|
|
749
745
|
`.trim());
|
|
750
746
|
}
|
|
751
|
-
function scanFiles(
|
|
747
|
+
function scanFiles(dirs, recursive) {
|
|
752
748
|
const results = [];
|
|
753
|
-
|
|
749
|
+
const seen = /* @__PURE__ */ new Set();
|
|
750
|
+
function scanDir(d, topLevel) {
|
|
754
751
|
try {
|
|
755
752
|
for (const f of (0, import_node_fs2.readdirSync)(d)) {
|
|
756
753
|
if (f.startsWith(".")) continue;
|
|
757
754
|
const fp = (0, import_node_path2.join)(d, f);
|
|
755
|
+
if (seen.has(fp)) continue;
|
|
758
756
|
let stat;
|
|
759
757
|
try {
|
|
760
758
|
stat = (0, import_node_fs2.statSync)(fp);
|
|
761
759
|
} catch {
|
|
762
760
|
continue;
|
|
763
761
|
}
|
|
764
|
-
if (stat.isDirectory() && recursive &&
|
|
765
|
-
scanDir(fp);
|
|
762
|
+
if (stat.isDirectory() && recursive && topLevel) {
|
|
763
|
+
scanDir(fp, false);
|
|
766
764
|
continue;
|
|
767
765
|
}
|
|
768
766
|
if (!stat.isFile()) continue;
|
|
769
767
|
if (f.endsWith(".json")) {
|
|
768
|
+
seen.add(fp);
|
|
770
769
|
results.push({ filename: f, path: fp, mtime: stat.mtime.getTime(), ext: ".json" });
|
|
771
770
|
} else if (f.endsWith(".jsonl")) {
|
|
771
|
+
seen.add(fp);
|
|
772
772
|
results.push({ filename: f, path: fp, mtime: stat.mtime.getTime(), ext: ".jsonl" });
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
775
|
} catch {
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
|
-
scanDir(dir);
|
|
778
|
+
for (const dir of dirs) scanDir(dir, true);
|
|
779
779
|
results.sort((a, b) => b.mtime - a.mtime);
|
|
780
780
|
return results;
|
|
781
781
|
}
|
|
@@ -929,7 +929,7 @@ var prevFileCount = 0;
|
|
|
929
929
|
var newExecCount = 0;
|
|
930
930
|
var sessionStart = Date.now();
|
|
931
931
|
function render(config) {
|
|
932
|
-
const files = scanFiles(config.
|
|
932
|
+
const files = scanFiles(config.dirs, config.recursive);
|
|
933
933
|
if (files.length > prevFileCount && prevFileCount > 0) {
|
|
934
934
|
newExecCount += files.length - prevFileCount;
|
|
935
935
|
}
|
|
@@ -1093,10 +1093,11 @@ function render(config) {
|
|
|
1093
1093
|
if (files.length === 0) {
|
|
1094
1094
|
console.log("");
|
|
1095
1095
|
console.log(` ${C.dim}No JSON/JSONL files found. Waiting for data in:${C.reset}`);
|
|
1096
|
-
console.log(` ${C.dim}${
|
|
1096
|
+
for (const d of config.dirs) console.log(` ${C.dim} ${d}${C.reset}`);
|
|
1097
1097
|
}
|
|
1098
1098
|
console.log("");
|
|
1099
|
-
|
|
1099
|
+
const dirLabel = config.dirs.length === 1 ? config.dirs[0] : `${config.dirs.length} directories`;
|
|
1100
|
+
console.log(` ${C.dim}Watching: ${dirLabel}${C.reset}`);
|
|
1100
1101
|
console.log(` ${C.dim}Press Ctrl+C to exit${C.reset}`);
|
|
1101
1102
|
}
|
|
1102
1103
|
function getDistDepth(dt, spanId) {
|
|
@@ -1107,19 +1108,27 @@ function getDistDepth(dt, spanId) {
|
|
|
1107
1108
|
}
|
|
1108
1109
|
function startLive(argv) {
|
|
1109
1110
|
const config = parseArgs(argv);
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
console.error(
|
|
1111
|
+
const valid = config.dirs.filter((d) => (0, import_node_fs2.existsSync)(d));
|
|
1112
|
+
if (valid.length === 0) {
|
|
1113
|
+
console.error(`No valid directories found: ${config.dirs.join(", ")}`);
|
|
1114
|
+
console.error("Specify directories containing JSON/JSONL files: agentflow live <dir> [dir...]");
|
|
1113
1115
|
process.exit(1);
|
|
1114
1116
|
}
|
|
1117
|
+
const invalid = config.dirs.filter((d) => !(0, import_node_fs2.existsSync)(d));
|
|
1118
|
+
if (invalid.length > 0) {
|
|
1119
|
+
console.warn(`Skipping non-existent: ${invalid.join(", ")}`);
|
|
1120
|
+
}
|
|
1121
|
+
config.dirs = valid;
|
|
1115
1122
|
render(config);
|
|
1116
1123
|
let debounce = null;
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1124
|
+
for (const dir of config.dirs) {
|
|
1125
|
+
try {
|
|
1126
|
+
(0, import_node_fs2.watch)(dir, { recursive: config.recursive }, () => {
|
|
1127
|
+
if (debounce) clearTimeout(debounce);
|
|
1128
|
+
debounce = setTimeout(() => render(config), 500);
|
|
1129
|
+
});
|
|
1130
|
+
} catch {
|
|
1131
|
+
}
|
|
1123
1132
|
}
|
|
1124
1133
|
setInterval(() => render(config), config.refreshMs);
|
|
1125
1134
|
process.on("SIGINT", () => {
|
package/dist/index.js
CHANGED