@adhdev/daemon-core 0.9.82-rc.302 → 0.9.82-rc.304
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/git/git-executor.d.ts +11 -0
- package/dist/git/git-status.d.ts +2 -0
- package/dist/index.js +88 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/router.ts +23 -3
- package/src/git/git-executor.ts +12 -0
- package/src/git/git-status.ts +71 -13
package/dist/index.mjs
CHANGED
|
@@ -77,6 +77,7 @@ var init_repo_mesh_types = __esm({
|
|
|
77
77
|
// src/git/git-executor.ts
|
|
78
78
|
var git_executor_exports = {};
|
|
79
79
|
__export(git_executor_exports, {
|
|
80
|
+
GIT_STATUS_TIMEOUT_MS: () => GIT_STATUS_TIMEOUT_MS,
|
|
80
81
|
GitCommandError: () => GitCommandError,
|
|
81
82
|
isPathInside: () => isPathInside,
|
|
82
83
|
normalizeGitOutput: () => normalizeGitOutput,
|
|
@@ -246,13 +247,14 @@ function mapExecError(error, cwd, argv, behavior) {
|
|
|
246
247
|
cause: error
|
|
247
248
|
});
|
|
248
249
|
}
|
|
249
|
-
var execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GitCommandError;
|
|
250
|
+
var execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GIT_STATUS_TIMEOUT_MS, GitCommandError;
|
|
250
251
|
var init_git_executor = __esm({
|
|
251
252
|
"src/git/git-executor.ts"() {
|
|
252
253
|
"use strict";
|
|
253
254
|
execFileAsync = promisify(execFile);
|
|
254
255
|
DEFAULT_TIMEOUT_MS = 5e3;
|
|
255
256
|
DEFAULT_MAX_BUFFER = 1024 * 1024;
|
|
257
|
+
GIT_STATUS_TIMEOUT_MS = process.platform === "win32" ? 3e4 : 2e4;
|
|
256
258
|
GitCommandError = class extends Error {
|
|
257
259
|
reason;
|
|
258
260
|
stdout;
|
|
@@ -288,10 +290,10 @@ function readInjected(value) {
|
|
|
288
290
|
}
|
|
289
291
|
function getDaemonBuildInfo() {
|
|
290
292
|
if (cached) return cached;
|
|
291
|
-
const commit = readInjected(true ? "
|
|
292
|
-
const commitShort = readInjected(true ? "
|
|
293
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
294
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
293
|
+
const commit = readInjected(true ? "1d8f7eabac25d169c6344185357519db0c0ffd13" : void 0) ?? "unknown";
|
|
294
|
+
const commitShort = readInjected(true ? "1d8f7eab" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
295
|
+
const version = readInjected(true ? "0.9.82-rc.304" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
296
|
+
const builtAt = readInjected(true ? "2026-06-17T05:27:03.554Z" : void 0);
|
|
295
297
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
296
298
|
return cached;
|
|
297
299
|
}
|
|
@@ -303,65 +305,80 @@ var init_build_info = __esm({
|
|
|
303
305
|
});
|
|
304
306
|
|
|
305
307
|
// src/git/git-status.ts
|
|
308
|
+
function isTransientGitFailure(error) {
|
|
309
|
+
return error.reason === "timeout" || error.reason === "git_command_failed";
|
|
310
|
+
}
|
|
306
311
|
async function getGitRepoStatus(workspace, options = {}) {
|
|
307
312
|
const lastCheckedAt = Date.now();
|
|
308
313
|
const includeSubmodules = options.includeSubmodules !== false;
|
|
314
|
+
const effectiveOptions = options.timeoutMs === void 0 ? { ...options, timeoutMs: GIT_STATUS_TIMEOUT_MS } : options;
|
|
309
315
|
try {
|
|
310
|
-
const repo = await resolveGitRepository(workspace,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
upstreamProbe = await refreshTrackedUpstream(repo, parsed, options);
|
|
315
|
-
if (upstreamProbe.upstreamStatus === "fresh") {
|
|
316
|
-
parsed = await readPorcelainStatus(repo, options);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
const head = await readHead(repo, options);
|
|
320
|
-
const stashCount = await readStashCount(repo, options);
|
|
321
|
-
let submodules;
|
|
322
|
-
if (includeSubmodules) {
|
|
323
|
-
submodules = await getSubmoduleStatuses(repo, options);
|
|
324
|
-
}
|
|
325
|
-
const submoduleDirty = (submodules || []).some((submodule) => submodule.dirty || submodule.outOfSync || !!submodule.error);
|
|
326
|
-
const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0 || parsed.conflictFiles.length > 0 || stashCount > 0 || submoduleDirty;
|
|
327
|
-
const daemonBuildBehind = await detectDaemonBuildBehind(repo, submodules, options);
|
|
328
|
-
return {
|
|
329
|
-
workspace: repo.workspace,
|
|
330
|
-
repoRoot: repo.repoRoot,
|
|
331
|
-
isGitRepo: true,
|
|
332
|
-
branch: parsed.branch,
|
|
333
|
-
headCommit: head.commit,
|
|
334
|
-
headMessage: head.message,
|
|
335
|
-
upstream: parsed.upstream,
|
|
336
|
-
upstreamStatus: parsed.upstream ? upstreamProbe.upstreamStatus : "no_upstream",
|
|
337
|
-
upstreamFetchedAt: upstreamProbe.upstreamFetchedAt,
|
|
338
|
-
upstreamFetchError: upstreamProbe.upstreamFetchError,
|
|
339
|
-
ahead: parsed.ahead,
|
|
340
|
-
behind: parsed.behind,
|
|
341
|
-
staged: parsed.staged,
|
|
342
|
-
modified: parsed.modified,
|
|
343
|
-
untracked: parsed.untracked,
|
|
344
|
-
deleted: parsed.deleted,
|
|
345
|
-
renamed: parsed.renamed,
|
|
346
|
-
dirty,
|
|
347
|
-
hasConflicts: parsed.conflictFiles.length > 0,
|
|
348
|
-
conflictFiles: parsed.conflictFiles,
|
|
349
|
-
stashCount,
|
|
350
|
-
lastCheckedAt,
|
|
351
|
-
submodules,
|
|
352
|
-
...daemonBuildBehind ? { daemonBuildBehind } : {}
|
|
353
|
-
};
|
|
316
|
+
const repo = await resolveGitRepository(workspace, effectiveOptions);
|
|
317
|
+
const status = await collectGitRepoStatus(repo, includeSubmodules, lastCheckedAt, effectiveOptions);
|
|
318
|
+
lastKnownGoodStatus.set(workspace, status);
|
|
319
|
+
return status;
|
|
354
320
|
} catch (error) {
|
|
355
|
-
|
|
356
|
-
|
|
321
|
+
const gitError = error instanceof GitCommandError ? error : new GitCommandError("git_command_failed", "Failed to read Git status", { cause: error });
|
|
322
|
+
if (isTransientGitFailure(gitError)) {
|
|
323
|
+
const cached2 = lastKnownGoodStatus.get(workspace);
|
|
324
|
+
if (cached2) {
|
|
325
|
+
return {
|
|
326
|
+
...cached2,
|
|
327
|
+
lastCheckedAt,
|
|
328
|
+
upstreamStatus: "unavailable",
|
|
329
|
+
error: gitError.stderr || gitError.message,
|
|
330
|
+
reason: gitError.reason
|
|
331
|
+
};
|
|
332
|
+
}
|
|
357
333
|
}
|
|
358
|
-
return emptyStatus(
|
|
359
|
-
workspace,
|
|
360
|
-
lastCheckedAt,
|
|
361
|
-
new GitCommandError("git_command_failed", "Failed to read Git status", { cause: error })
|
|
362
|
-
);
|
|
334
|
+
return emptyStatus(workspace, lastCheckedAt, gitError);
|
|
363
335
|
}
|
|
364
336
|
}
|
|
337
|
+
async function collectGitRepoStatus(repo, includeSubmodules, lastCheckedAt, options) {
|
|
338
|
+
let parsed = await readPorcelainStatus(repo, options);
|
|
339
|
+
let upstreamProbe = getInitialUpstreamProbe(parsed);
|
|
340
|
+
if (options.refreshUpstream) {
|
|
341
|
+
upstreamProbe = await refreshTrackedUpstream(repo, parsed, options);
|
|
342
|
+
if (upstreamProbe.upstreamStatus === "fresh") {
|
|
343
|
+
parsed = await readPorcelainStatus(repo, options);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const head = await readHead(repo, options);
|
|
347
|
+
const stashCount = await readStashCount(repo, options);
|
|
348
|
+
let submodules;
|
|
349
|
+
if (includeSubmodules) {
|
|
350
|
+
submodules = await getSubmoduleStatuses(repo, options);
|
|
351
|
+
}
|
|
352
|
+
const submoduleDirty = (submodules || []).some((submodule) => submodule.dirty || submodule.outOfSync || !!submodule.error);
|
|
353
|
+
const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0 || parsed.conflictFiles.length > 0 || stashCount > 0 || submoduleDirty;
|
|
354
|
+
const daemonBuildBehind = await detectDaemonBuildBehind(repo, submodules, options);
|
|
355
|
+
return {
|
|
356
|
+
workspace: repo.workspace,
|
|
357
|
+
repoRoot: repo.repoRoot,
|
|
358
|
+
isGitRepo: true,
|
|
359
|
+
branch: parsed.branch,
|
|
360
|
+
headCommit: head.commit,
|
|
361
|
+
headMessage: head.message,
|
|
362
|
+
upstream: parsed.upstream,
|
|
363
|
+
upstreamStatus: parsed.upstream ? upstreamProbe.upstreamStatus : "no_upstream",
|
|
364
|
+
upstreamFetchedAt: upstreamProbe.upstreamFetchedAt,
|
|
365
|
+
upstreamFetchError: upstreamProbe.upstreamFetchError,
|
|
366
|
+
ahead: parsed.ahead,
|
|
367
|
+
behind: parsed.behind,
|
|
368
|
+
staged: parsed.staged,
|
|
369
|
+
modified: parsed.modified,
|
|
370
|
+
untracked: parsed.untracked,
|
|
371
|
+
deleted: parsed.deleted,
|
|
372
|
+
renamed: parsed.renamed,
|
|
373
|
+
dirty,
|
|
374
|
+
hasConflicts: parsed.conflictFiles.length > 0,
|
|
375
|
+
conflictFiles: parsed.conflictFiles,
|
|
376
|
+
stashCount,
|
|
377
|
+
lastCheckedAt,
|
|
378
|
+
submodules,
|
|
379
|
+
...daemonBuildBehind ? { daemonBuildBehind } : {}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
365
382
|
function isNonRuntimeRootFile(file) {
|
|
366
383
|
const base = file.slice(file.lastIndexOf("/") + 1);
|
|
367
384
|
if (/^\.(?:verify|marker|converge|ff-verify|patch-equiv|live-verify)\b/i.test(base)) return true;
|
|
@@ -602,7 +619,7 @@ function emptyStatus(workspace, lastCheckedAt, error) {
|
|
|
602
619
|
async function getSubmoduleStatuses(repo, options) {
|
|
603
620
|
if (!repo.repoRoot) return [];
|
|
604
621
|
try {
|
|
605
|
-
const result = await runGit(repo, ["submodule", "status"
|
|
622
|
+
const result = await runGit(repo, ["submodule", "status"], options);
|
|
606
623
|
const submodules = parseSubmoduleStatusOutput(result.stdout, repo.repoRoot, options.submoduleIgnorePaths);
|
|
607
624
|
await Promise.all(submodules.map((submodule) => enrichSubmoduleWorktreeStatus(repo, submodule, options)));
|
|
608
625
|
return submodules;
|
|
@@ -646,12 +663,13 @@ function parseSubmoduleStatusOutput(output, repoRoot, ignorePaths) {
|
|
|
646
663
|
}
|
|
647
664
|
return submodules;
|
|
648
665
|
}
|
|
649
|
-
var DAEMON_RUNTIME_PACKAGES, WEB_ONLY_PACKAGES;
|
|
666
|
+
var lastKnownGoodStatus, DAEMON_RUNTIME_PACKAGES, WEB_ONLY_PACKAGES;
|
|
650
667
|
var init_git_status = __esm({
|
|
651
668
|
"src/git/git-status.ts"() {
|
|
652
669
|
"use strict";
|
|
653
670
|
init_git_executor();
|
|
654
671
|
init_build_info();
|
|
672
|
+
lastKnownGoodStatus = /* @__PURE__ */ new Map();
|
|
655
673
|
DAEMON_RUNTIME_PACKAGES = /* @__PURE__ */ new Set([
|
|
656
674
|
"daemon-core",
|
|
657
675
|
"daemon-standalone",
|
|
@@ -41968,6 +41986,15 @@ function finalizeMeshNodeStatus(args) {
|
|
|
41968
41986
|
const connectionState = readStringValue(readObjectRecord(status.connection).state);
|
|
41969
41987
|
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || connectionState === "connected" || isSelfNode);
|
|
41970
41988
|
}
|
|
41989
|
+
function readMeshTimeoutEnvMs(name, defaultMs) {
|
|
41990
|
+
const raw = process.env[name]?.trim();
|
|
41991
|
+
if (!raw) return defaultMs;
|
|
41992
|
+
const parsed = Number.parseInt(raw, 10);
|
|
41993
|
+
if (Number.isFinite(parsed) && parsed >= 1e3 && parsed <= 12e4) return parsed;
|
|
41994
|
+
return defaultMs;
|
|
41995
|
+
}
|
|
41996
|
+
var MESH_DIRECT_PROBE_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_TIMEOUT_MS", 25e3);
|
|
41997
|
+
var MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS", 25e3);
|
|
41971
41998
|
async function probeRemoteMeshGitStatus(args) {
|
|
41972
41999
|
if (!args.dispatchMeshCommand) return null;
|
|
41973
42000
|
const remoteResult = await Promise.race([
|
|
@@ -42031,7 +42058,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
42031
42058
|
dispatchMeshCommand: args.dispatchMeshCommand,
|
|
42032
42059
|
daemonId,
|
|
42033
42060
|
workspace,
|
|
42034
|
-
timeoutMs:
|
|
42061
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS
|
|
42035
42062
|
});
|
|
42036
42063
|
if (remoteGit) {
|
|
42037
42064
|
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
@@ -48001,7 +48028,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48001
48028
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
48002
48029
|
daemonId,
|
|
48003
48030
|
workspace,
|
|
48004
|
-
timeoutMs:
|
|
48031
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS
|
|
48005
48032
|
});
|
|
48006
48033
|
if (remoteGit) {
|
|
48007
48034
|
status.git = remoteGit;
|
|
@@ -48025,7 +48052,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
48025
48052
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
48026
48053
|
daemonId,
|
|
48027
48054
|
workspace,
|
|
48028
|
-
timeoutMs:
|
|
48055
|
+
timeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS
|
|
48029
48056
|
});
|
|
48030
48057
|
if (remoteGit) {
|
|
48031
48058
|
status.git = remoteGit;
|