agenthud 0.5.12 → 0.5.14
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 +40 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1748,7 +1748,40 @@ function getProjectsDir() {
|
|
|
1748
1748
|
return join3(homedir2(), ".claude", "projects");
|
|
1749
1749
|
}
|
|
1750
1750
|
function decodeProjectPath(encoded) {
|
|
1751
|
-
|
|
1751
|
+
const naiveDecoded = encoded.replace(/-/g, "/");
|
|
1752
|
+
if (fs2.existsSync(naiveDecoded)) {
|
|
1753
|
+
return naiveDecoded;
|
|
1754
|
+
}
|
|
1755
|
+
const segments = encoded.split("-").filter(Boolean);
|
|
1756
|
+
if (segments.length === 0) {
|
|
1757
|
+
return naiveDecoded;
|
|
1758
|
+
}
|
|
1759
|
+
let currentPath = "";
|
|
1760
|
+
let i = 0;
|
|
1761
|
+
while (i < segments.length) {
|
|
1762
|
+
let found = false;
|
|
1763
|
+
for (let j = segments.length; j > i; j--) {
|
|
1764
|
+
const segment = segments.slice(i, j).join("-");
|
|
1765
|
+
const testPath = currentPath + "/" + segment;
|
|
1766
|
+
try {
|
|
1767
|
+
if (fs2.existsSync(testPath)) {
|
|
1768
|
+
const stat = fs2.statSync(testPath);
|
|
1769
|
+
if (stat.isDirectory?.()) {
|
|
1770
|
+
currentPath = testPath;
|
|
1771
|
+
i = j;
|
|
1772
|
+
found = true;
|
|
1773
|
+
break;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
} catch {
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
if (!found) {
|
|
1780
|
+
currentPath += "/" + segments[i];
|
|
1781
|
+
i++;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
return currentPath || naiveDecoded;
|
|
1752
1785
|
}
|
|
1753
1786
|
function getAllProjects() {
|
|
1754
1787
|
const projectsDir = getProjectsDir();
|
|
@@ -1902,7 +1935,12 @@ function getOtherSessionsData(currentProjectPath, options2 = {}) {
|
|
|
1902
1935
|
return defaultResult;
|
|
1903
1936
|
}
|
|
1904
1937
|
otherSessions.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
1905
|
-
|
|
1938
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1939
|
+
defaultResult.projectNames = otherSessions.map((s) => s.projectName).filter((name) => {
|
|
1940
|
+
if (seen.has(name)) return false;
|
|
1941
|
+
seen.add(name);
|
|
1942
|
+
return true;
|
|
1943
|
+
});
|
|
1906
1944
|
const mostRecent = otherSessions[0];
|
|
1907
1945
|
const lastMessage = parseLastAssistantMessage(mostRecent.sessionFile);
|
|
1908
1946
|
const isActive = now - mostRecent.mtimeMs < activeThresholdMs;
|
package/package.json
CHANGED