@adhdev/daemon-standalone 0.9.82-rc.313 → 0.9.82-rc.315
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 +116 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30029,10 +30029,10 @@ var require_dist3 = __commonJS({
|
|
|
30029
30029
|
}
|
|
30030
30030
|
function getDaemonBuildInfo() {
|
|
30031
30031
|
if (cached2) return cached2;
|
|
30032
|
-
const commit = readInjected(true ? "
|
|
30033
|
-
const commitShort = readInjected(true ? "
|
|
30034
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30035
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30032
|
+
const commit = readInjected(true ? "e28347641639c9d0a1e46a6141e3cfed2bc90ac2" : void 0) ?? "unknown";
|
|
30033
|
+
const commitShort = readInjected(true ? "e2834764" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30034
|
+
const version2 = readInjected(true ? "0.9.82-rc.315" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30035
|
+
const builtAt = readInjected(true ? "2026-06-18T05:48:10.109Z" : void 0);
|
|
30036
30036
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30037
30037
|
return cached2;
|
|
30038
30038
|
}
|
|
@@ -61009,6 +61009,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61009
61009
|
var fs12 = __toESM2(require("fs"));
|
|
61010
61010
|
var os17 = __toESM2(require("os"));
|
|
61011
61011
|
var path21 = __toESM2(require("path"));
|
|
61012
|
+
init_logger();
|
|
61012
61013
|
var UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
|
|
61013
61014
|
function executeNativeHistory(cfg, input) {
|
|
61014
61015
|
if (!cfg?.source) return null;
|
|
@@ -61041,8 +61042,33 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61041
61042
|
if (!sourcePath && hasDateTemplateSegment(src.path)) {
|
|
61042
61043
|
sourcePath = pickExactSessionFileAcrossDateWindow(src.path, input, filePat, requestedSessionId) || (requestedSessionId ? null : pickSessionBoundFileAcrossDateWindow(src.path, input, filePat, windowMs, sessionFloor, workspaceHint)) || (requestedSessionId ? null : newestRecentFileAcrossDateWindow(src.path, input, filePat, windowMs, sessionFloor));
|
|
61043
61044
|
}
|
|
61045
|
+
if (!sourcePath && !hasDateTemplateSegment(src.path)) {
|
|
61046
|
+
const resolvedRaw = expandPath2(src.path, input, { skipWorkspaceRealpath: true });
|
|
61047
|
+
if (resolvedRaw && resolvedRaw !== resolved) {
|
|
61048
|
+
try {
|
|
61049
|
+
const rawStat = fs12.statSync(resolvedRaw);
|
|
61050
|
+
if (rawStat.isFile()) sourcePath = resolvedRaw;
|
|
61051
|
+
else if (rawStat.isDirectory()) {
|
|
61052
|
+
sourcePath = pickExactSessionFile(resolvedRaw, filePat, requestedSessionId) || (requestedSessionId ? null : newestRecentFile(resolvedRaw, filePat, windowMs, sessionFloor));
|
|
61053
|
+
}
|
|
61054
|
+
} catch {
|
|
61055
|
+
}
|
|
61056
|
+
}
|
|
61057
|
+
}
|
|
61058
|
+
if (!sourcePath && requestedSessionId) {
|
|
61059
|
+
sourcePath = scanProjectsRootForSessionFile(src.path, input, requestedSessionId);
|
|
61060
|
+
}
|
|
61061
|
+
}
|
|
61062
|
+
if (!sourcePath) {
|
|
61063
|
+
const wsRaw = typeof input.workspace === "string" ? input.workspace : "";
|
|
61064
|
+
let wsReal = wsRaw;
|
|
61065
|
+
try {
|
|
61066
|
+
if (wsRaw) wsReal = fs12.realpathSync(wsRaw);
|
|
61067
|
+
} catch {
|
|
61068
|
+
}
|
|
61069
|
+
LOG2.debug("NativeHistory", `jsonl unresolved: tried=${JSON.stringify(resolved)} sessionId=${requestedSessionId || "(none)"} wsRaw=${JSON.stringify(wsRaw)} wsReal=${JSON.stringify(wsReal)} rawSlug=${JSON.stringify(claudeProjectDirName(wsRaw))} realSlug=${JSON.stringify(claudeProjectDirName(wsReal))} (concrete miss + raw-slug retry + projects scan all failed)`);
|
|
61070
|
+
return null;
|
|
61044
61071
|
}
|
|
61045
|
-
if (!sourcePath) return null;
|
|
61046
61072
|
const mtime = safeMtimeMs(sourcePath);
|
|
61047
61073
|
const lines = readJsonlLines(sourcePath);
|
|
61048
61074
|
if (lines.length === 0) return null;
|
|
@@ -61161,7 +61187,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61161
61187
|
}
|
|
61162
61188
|
}
|
|
61163
61189
|
}
|
|
61164
|
-
function expandPath2(template, input) {
|
|
61190
|
+
function expandPath2(template, input, opts) {
|
|
61165
61191
|
if (!template) return null;
|
|
61166
61192
|
let out = template;
|
|
61167
61193
|
if (out.startsWith("~/") || out === "~") {
|
|
@@ -61175,7 +61201,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61175
61201
|
const now = /* @__PURE__ */ new Date();
|
|
61176
61202
|
const workspaceRaw = input.workspace ?? "";
|
|
61177
61203
|
let workspaceResolved = workspaceRaw;
|
|
61178
|
-
if (workspaceRaw) {
|
|
61204
|
+
if (workspaceRaw && !opts?.skipWorkspaceRealpath) {
|
|
61179
61205
|
try {
|
|
61180
61206
|
workspaceResolved = fs12.realpathSync(workspaceRaw);
|
|
61181
61207
|
} catch {
|
|
@@ -61202,6 +61228,50 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61202
61228
|
function claudeProjectDirName(workspace) {
|
|
61203
61229
|
return workspace.replace(/[^A-Za-z0-9_-]/g, "-");
|
|
61204
61230
|
}
|
|
61231
|
+
function scanProjectsRootForSessionFile(template, input, requestedSessionId) {
|
|
61232
|
+
if (!requestedSessionId) return null;
|
|
61233
|
+
let head = template;
|
|
61234
|
+
if (head.startsWith("~/") || head === "~") head = path21.join(os17.homedir(), head.slice(2));
|
|
61235
|
+
const segs = head.split("/");
|
|
61236
|
+
const baseParts = [];
|
|
61237
|
+
for (const seg of segs) {
|
|
61238
|
+
if (/[{}*?]/.test(seg)) break;
|
|
61239
|
+
baseParts.push(seg);
|
|
61240
|
+
}
|
|
61241
|
+
const base = baseParts.join("/");
|
|
61242
|
+
if (!base) return null;
|
|
61243
|
+
let baseStat = null;
|
|
61244
|
+
try {
|
|
61245
|
+
baseStat = fs12.statSync(base);
|
|
61246
|
+
} catch {
|
|
61247
|
+
return null;
|
|
61248
|
+
}
|
|
61249
|
+
if (!baseStat.isDirectory()) return null;
|
|
61250
|
+
const needle = `${requestedSessionId.toLowerCase()}.jsonl`;
|
|
61251
|
+
const dirsToScan = [base];
|
|
61252
|
+
try {
|
|
61253
|
+
for (const entry of fs12.readdirSync(base, { withFileTypes: true })) {
|
|
61254
|
+
if (entry.isDirectory()) dirsToScan.push(path21.join(base, entry.name));
|
|
61255
|
+
}
|
|
61256
|
+
} catch {
|
|
61257
|
+
}
|
|
61258
|
+
for (const dir of dirsToScan) {
|
|
61259
|
+
let entries;
|
|
61260
|
+
try {
|
|
61261
|
+
entries = fs12.readdirSync(dir, { withFileTypes: true });
|
|
61262
|
+
} catch {
|
|
61263
|
+
continue;
|
|
61264
|
+
}
|
|
61265
|
+
for (const entry of entries) {
|
|
61266
|
+
if (!entry.isFile()) continue;
|
|
61267
|
+
if (entry.name.toLowerCase() !== needle) continue;
|
|
61268
|
+
const found = path21.join(dir, entry.name);
|
|
61269
|
+
LOG2.debug("NativeHistory", `jsonl scan-fallback hit: sessionId=${requestedSessionId} resolved via projects-root scan \u2192 ${JSON.stringify(found)} (slug-derived path missed; likely realpath/slug divergence)`);
|
|
61270
|
+
return found;
|
|
61271
|
+
}
|
|
61272
|
+
}
|
|
61273
|
+
return null;
|
|
61274
|
+
}
|
|
61205
61275
|
function globToRegex(pattern) {
|
|
61206
61276
|
const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]");
|
|
61207
61277
|
return new RegExp(`^${re}$`);
|
|
@@ -71707,39 +71777,48 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71707
71777
|
} catch {
|
|
71708
71778
|
}
|
|
71709
71779
|
}
|
|
71780
|
+
function safeRemoveStaleEntry(target, label) {
|
|
71781
|
+
try {
|
|
71782
|
+
fs24.rmSync(target, { recursive: true, force: true });
|
|
71783
|
+
appendUpgradeLog(`${label}: ${target}`);
|
|
71784
|
+
} catch (error48) {
|
|
71785
|
+
appendUpgradeLog(`Skipped locked stale entry (${error48?.code || "error"}): ${target} \u2014 ${error48?.message || String(error48)}`);
|
|
71786
|
+
}
|
|
71787
|
+
}
|
|
71710
71788
|
function cleanupStaleGlobalInstallDirs(pkgName, surface) {
|
|
71711
|
-
|
|
71712
|
-
|
|
71713
|
-
|
|
71714
|
-
|
|
71715
|
-
|
|
71716
|
-
|
|
71717
|
-
|
|
71718
|
-
|
|
71719
|
-
|
|
71720
|
-
|
|
71721
|
-
|
|
71722
|
-
|
|
71723
|
-
|
|
71724
|
-
|
|
71725
|
-
|
|
71726
|
-
|
|
71727
|
-
|
|
71728
|
-
|
|
71729
|
-
|
|
71730
|
-
|
|
71731
|
-
|
|
71732
|
-
|
|
71733
|
-
|
|
71734
|
-
|
|
71789
|
+
try {
|
|
71790
|
+
const prefixArgs = surface.installPrefix ? ["--prefix", surface.installPrefix] : [];
|
|
71791
|
+
const npmRoot = String(execNpmCommandSync(["root", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
|
|
71792
|
+
if (!npmRoot) return;
|
|
71793
|
+
const npmPrefix = surface.installPrefix || String(execNpmCommandSync(["prefix", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
|
|
71794
|
+
const binDir = process.platform === "win32" ? npmPrefix : path35.join(npmPrefix, "bin");
|
|
71795
|
+
const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
|
|
71796
|
+
const binNames = /* @__PURE__ */ new Set([packageBaseName]);
|
|
71797
|
+
if (pkgName === "@adhdev/daemon-standalone") {
|
|
71798
|
+
binNames.add("adhdev-standalone");
|
|
71799
|
+
}
|
|
71800
|
+
if (pkgName.startsWith("@")) {
|
|
71801
|
+
const [scope, name] = pkgName.split("/");
|
|
71802
|
+
const scopeDir = path35.join(npmRoot, scope);
|
|
71803
|
+
if (!fs24.existsSync(scopeDir)) return;
|
|
71804
|
+
for (const entry of fs24.readdirSync(scopeDir)) {
|
|
71805
|
+
if (!entry.startsWith(`.${name}-`)) continue;
|
|
71806
|
+
safeRemoveStaleEntry(path35.join(scopeDir, entry), "Removed stale scoped staging dir");
|
|
71807
|
+
}
|
|
71808
|
+
} else {
|
|
71809
|
+
for (const entry of fs24.readdirSync(npmRoot)) {
|
|
71810
|
+
if (!entry.startsWith(`.${pkgName}-`)) continue;
|
|
71811
|
+
safeRemoveStaleEntry(path35.join(npmRoot, entry), "Removed stale staging dir");
|
|
71812
|
+
}
|
|
71735
71813
|
}
|
|
71736
|
-
|
|
71737
|
-
|
|
71738
|
-
|
|
71739
|
-
|
|
71740
|
-
|
|
71741
|
-
appendUpgradeLog(`Removed stale bin staging entry: ${path35.join(binDir, entry)}`);
|
|
71814
|
+
if (fs24.existsSync(binDir)) {
|
|
71815
|
+
for (const entry of fs24.readdirSync(binDir)) {
|
|
71816
|
+
if (!Array.from(binNames).some((name) => entry.startsWith(`.${name}-`))) continue;
|
|
71817
|
+
safeRemoveStaleEntry(path35.join(binDir, entry), "Removed stale bin staging entry");
|
|
71818
|
+
}
|
|
71742
71819
|
}
|
|
71820
|
+
} catch (error48) {
|
|
71821
|
+
appendUpgradeLog(`Stale staging cleanup skipped (${error48?.code || "error"}): ${error48?.message || String(error48)}`);
|
|
71743
71822
|
}
|
|
71744
71823
|
}
|
|
71745
71824
|
function spawnDetachedDaemonUpgradeHelper(payload) {
|