agenthud 0.12.3 → 0.12.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
|
@@ -1302,8 +1302,8 @@ function truncateByWidth(text, maxWidth) {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
var widthCache = /* @__PURE__ */ new Map();
|
|
1304
1304
|
function getDisplayWidth(s) {
|
|
1305
|
-
const
|
|
1306
|
-
if (
|
|
1305
|
+
const cached2 = widthCache.get(s);
|
|
1306
|
+
if (cached2 !== void 0) return cached2;
|
|
1307
1307
|
const w = stringWidth(s);
|
|
1308
1308
|
widthCache.set(s, w);
|
|
1309
1309
|
return w;
|
|
@@ -1688,8 +1688,28 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
1688
1688
|
|
|
1689
1689
|
// src/utils/openInDefaultApp.ts
|
|
1690
1690
|
import { spawn } from "child_process";
|
|
1691
|
-
import { existsSync as existsSync4
|
|
1691
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1692
1692
|
import { join as join4 } from "path";
|
|
1693
|
+
|
|
1694
|
+
// src/utils/platform.ts
|
|
1695
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
1696
|
+
var cached = null;
|
|
1697
|
+
function isWSL() {
|
|
1698
|
+
if (cached !== null) return cached;
|
|
1699
|
+
if (process.env.WSL_DISTRO_NAME) {
|
|
1700
|
+
cached = true;
|
|
1701
|
+
return cached;
|
|
1702
|
+
}
|
|
1703
|
+
try {
|
|
1704
|
+
const ver = readFileSync5("/proc/version", "utf-8");
|
|
1705
|
+
cached = /microsoft|wsl/i.test(ver);
|
|
1706
|
+
} catch {
|
|
1707
|
+
cached = false;
|
|
1708
|
+
}
|
|
1709
|
+
return cached;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
// src/utils/openInDefaultApp.ts
|
|
1693
1713
|
function buildOpenCommand(platform, path, opts = {}) {
|
|
1694
1714
|
switch (platform) {
|
|
1695
1715
|
case "darwin":
|
|
@@ -1703,15 +1723,6 @@ function buildOpenCommand(platform, path, opts = {}) {
|
|
|
1703
1723
|
return null;
|
|
1704
1724
|
}
|
|
1705
1725
|
}
|
|
1706
|
-
function isWSL() {
|
|
1707
|
-
if (process.env.WSL_DISTRO_NAME) return true;
|
|
1708
|
-
try {
|
|
1709
|
-
const ver = readFileSync5("/proc/version", "utf-8");
|
|
1710
|
-
return /microsoft|wsl/i.test(ver);
|
|
1711
|
-
} catch {
|
|
1712
|
-
return false;
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
1726
|
function commandExists(command) {
|
|
1716
1727
|
const PATH = process.env.PATH ?? "";
|
|
1717
1728
|
const sep = process.platform === "win32" ? ";" : ":";
|
|
@@ -2289,13 +2300,13 @@ var REPORT_TOKEN_WARN_THRESHOLD = 3e5;
|
|
|
2289
2300
|
async function generateDailySummary(opts) {
|
|
2290
2301
|
ensureUserPromptFile("daily");
|
|
2291
2302
|
const isToday = isSameLocalDay2(opts.date, opts.today);
|
|
2292
|
-
const
|
|
2303
|
+
const cached2 = dailyCachePath(opts.date);
|
|
2293
2304
|
const dateLabel = dateKey(opts.date);
|
|
2294
|
-
if (!isToday && !opts.force && existsSync6(
|
|
2305
|
+
if (!isToday && !opts.force && existsSync6(cached2)) {
|
|
2295
2306
|
try {
|
|
2296
|
-
const content = readFileSync7(
|
|
2307
|
+
const content = readFileSync7(cached2, "utf-8");
|
|
2297
2308
|
if (opts.announce) {
|
|
2298
|
-
process.stderr.write(`cached summary from ${
|
|
2309
|
+
process.stderr.write(`cached summary from ${cached2}
|
|
2299
2310
|
`);
|
|
2300
2311
|
}
|
|
2301
2312
|
if (opts.streamToStdout) {
|
|
@@ -2412,14 +2423,14 @@ async function generateDailySummary(opts) {
|
|
|
2412
2423
|
const result = await spawnClaude({
|
|
2413
2424
|
prompt,
|
|
2414
2425
|
stdin: reportMarkdown,
|
|
2415
|
-
cachePath:
|
|
2426
|
+
cachePath: cached2,
|
|
2416
2427
|
streamToStdout: opts.streamToStdout,
|
|
2417
2428
|
model: opts.model
|
|
2418
2429
|
});
|
|
2419
2430
|
if (stopTicker) stopTicker();
|
|
2420
2431
|
if (opts.announce && result.code === 0) {
|
|
2421
2432
|
process.stderr.write("\n");
|
|
2422
|
-
process.stderr.write(`saved to ${
|
|
2433
|
+
process.stderr.write(`saved to ${cached2}
|
|
2423
2434
|
`);
|
|
2424
2435
|
if (result.usage) {
|
|
2425
2436
|
process.stderr.write(`${formatUsage(result.usage)}
|
|
@@ -4709,10 +4720,14 @@ function installAltScreenCleanup() {
|
|
|
4709
4720
|
|
|
4710
4721
|
// src/utils/legacyConfig.ts
|
|
4711
4722
|
import { join as join7, resolve } from "path";
|
|
4712
|
-
|
|
4723
|
+
var WSL_WINDOWS_USER_HOME = /^\/mnt\/[a-z]\/Users\/[^/]+\/?$/i;
|
|
4724
|
+
function isLegacyProjectConfig(cwd, home, opts = {}) {
|
|
4713
4725
|
const legacy = resolve(join7(cwd, ".agenthud", "config.yaml"));
|
|
4714
4726
|
const global = resolve(join7(home, ".agenthud", "config.yaml"));
|
|
4715
|
-
|
|
4727
|
+
if (legacy === global) return false;
|
|
4728
|
+
const wsl = opts.isWSL ?? isWSL();
|
|
4729
|
+
if (wsl && WSL_WINDOWS_USER_HOME.test(cwd)) return false;
|
|
4730
|
+
return true;
|
|
4716
4731
|
}
|
|
4717
4732
|
|
|
4718
4733
|
// src/main.ts
|
package/package.json
CHANGED