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
|
@@ -661,8 +661,13 @@ function parseSessionState(sessionFile, maxActivities = DEFAULT_MAX_ACTIVITIES)
|
|
|
661
661
|
lastTurnDuration
|
|
662
662
|
};
|
|
663
663
|
}
|
|
664
|
-
|
|
665
|
-
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
1080
|
-
// 60 minutes default
|
|
1103
|
+
// sessionTimeout defaults to undefined = since midnight (today's sessions)
|
|
1081
1104
|
},
|
|
1082
1105
|
other_sessions: {
|
|
1083
1106
|
enabled: true,
|
package/package.json
CHANGED