agenthud 0.7.3 → 0.7.4

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/index.js CHANGED
@@ -14,4 +14,4 @@ Error: Node.js ${MIN_NODE_VERSION}+ is required (current: ${process.version})
14
14
  console.error(" https://nodejs.org/\n");
15
15
  process.exit(1);
16
16
  }
17
- import("./main-4ACNXJYW.js").then(({ main }) => main());
17
+ import("./main-WFRLKQ72.js").then(({ main }) => main());
@@ -661,8 +661,13 @@ function parseSessionState(sessionFile, maxActivities = DEFAULT_MAX_ACTIVITIES)
661
661
  lastTurnDuration
662
662
  };
663
663
  }
664
- var DEFAULT_SESSION_TIMEOUT = 60 * 60 * 1e3;
665
- function getClaudeData(projectPath, maxActivities, sessionTimeout = DEFAULT_SESSION_TIMEOUT) {
664
+ function getTimeSinceMidnight() {
665
+ const now = /* @__PURE__ */ new Date();
666
+ const midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate());
667
+ return now.getTime() - midnight.getTime();
668
+ }
669
+ function getClaudeData(projectPath, maxActivities, sessionTimeout) {
670
+ const effectiveTimeout = sessionTimeout ?? getTimeSinceMidnight();
666
671
  const defaultState = {
667
672
  status: "none",
668
673
  activities: [],
@@ -675,7 +680,7 @@ function getClaudeData(projectPath, maxActivities, sessionTimeout = DEFAULT_SESS
675
680
  try {
676
681
  const sessionDir = getClaudeSessionPath2(projectPath);
677
682
  const hasSession = existsSync3(sessionDir);
678
- const sessionFile = findActiveSession(sessionDir, sessionTimeout);
683
+ const sessionFile = findActiveSession(sessionDir, effectiveTimeout);
679
684
  if (!sessionFile) {
680
685
  return {
681
686
  state: defaultState,
@@ -709,13 +714,32 @@ function getProjectsDir() {
709
714
  return join4(homedir3(), ".claude", "projects");
710
715
  }
711
716
  function decodeProjectPath(encoded) {
717
+ const windowsDriveMatch = encoded.match(/^([A-Za-z])--(.*)$/);
718
+ if (windowsDriveMatch) {
719
+ const driveLetter = windowsDriveMatch[1];
720
+ const rest = windowsDriveMatch[2];
721
+ const decodedRest = rest.replace(/-/g, sep);
722
+ const windowsPath = `${driveLetter}:${sep}${decodedRest}`;
723
+ if (existsSync4(windowsPath)) {
724
+ return windowsPath;
725
+ }
726
+ const smartDecodedRest = smartDecodePath(rest);
727
+ const smartWindowsPath = `${driveLetter}:${sep}${smartDecodedRest}`;
728
+ if (existsSync4(smartWindowsPath)) {
729
+ return smartWindowsPath;
730
+ }
731
+ return windowsPath;
732
+ }
712
733
  const naiveDecoded = encoded.replace(/-/g, sep);
713
734
  if (existsSync4(naiveDecoded)) {
714
735
  return naiveDecoded;
715
736
  }
737
+ return smartDecodePath(encoded) || naiveDecoded;
738
+ }
739
+ function smartDecodePath(encoded) {
716
740
  const segments = encoded.split("-").filter(Boolean);
717
741
  if (segments.length === 0) {
718
- return naiveDecoded;
742
+ return "";
719
743
  }
720
744
  let currentPath = "";
721
745
  let i = 0;
@@ -742,7 +766,7 @@ function decodeProjectPath(encoded) {
742
766
  i++;
743
767
  }
744
768
  }
745
- return currentPath || naiveDecoded;
769
+ return currentPath;
746
770
  }
747
771
  function getAllProjects() {
748
772
  const projectsDir = getProjectsDir();
@@ -1074,10 +1098,9 @@ function getDefaultConfig2() {
1074
1098
  },
1075
1099
  claude: {
1076
1100
  enabled: true,
1077
- interval: 1e4,
1101
+ interval: 1e4
1078
1102
  // 10 seconds default
1079
- sessionTimeout: 60 * 60 * 1e3
1080
- // 60 minutes default
1103
+ // sessionTimeout defaults to undefined = since midnight (today's sessions)
1081
1104
  },
1082
1105
  other_sessions: {
1083
1106
  enabled: true,
@@ -7,7 +7,7 @@ panels:
7
7
  enabled: true
8
8
  interval: 10s
9
9
  max_activities: 20
10
- # session_timeout: 60m # session inactive threshold (default: 60m)
10
+ # session_timeout: 60m # session inactive threshold (default: since midnight)
11
11
 
12
12
  git:
13
13
  enabled: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenthud",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "CLI tool to monitor agent status in real-time. Works with Claude Code, multi-agent workflows, and any AI agent system.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",