@adhdev/daemon-standalone 0.9.81 → 0.9.82-rc.2
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
|
@@ -45791,6 +45791,115 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
45791
45791
|
return true;
|
|
45792
45792
|
});
|
|
45793
45793
|
}
|
|
45794
|
+
function readObjectRecord(value) {
|
|
45795
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
45796
|
+
}
|
|
45797
|
+
function readStringValue(...values) {
|
|
45798
|
+
for (const value of values) {
|
|
45799
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
45800
|
+
}
|
|
45801
|
+
return void 0;
|
|
45802
|
+
}
|
|
45803
|
+
function readNumberValue(...values) {
|
|
45804
|
+
for (const value of values) {
|
|
45805
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
45806
|
+
}
|
|
45807
|
+
return void 0;
|
|
45808
|
+
}
|
|
45809
|
+
function readBooleanValue(...values) {
|
|
45810
|
+
for (const value of values) {
|
|
45811
|
+
if (typeof value === "boolean") return value;
|
|
45812
|
+
}
|
|
45813
|
+
return void 0;
|
|
45814
|
+
}
|
|
45815
|
+
function buildCachedInlineMeshGitStatus(node) {
|
|
45816
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45817
|
+
const cachedGit = readObjectRecord(cachedStatus.git);
|
|
45818
|
+
if (Object.keys(cachedGit).length) {
|
|
45819
|
+
const conflictFiles2 = Array.isArray(cachedGit.conflictFiles) ? cachedGit.conflictFiles.filter((value) => typeof value === "string") : [];
|
|
45820
|
+
const conflictCount2 = readNumberValue(cachedGit.conflicts) ?? conflictFiles2.length;
|
|
45821
|
+
const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
|
|
45822
|
+
const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
|
|
45823
|
+
if (isGitRepo2 !== void 0) {
|
|
45824
|
+
return {
|
|
45825
|
+
workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
|
|
45826
|
+
repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
|
|
45827
|
+
isGitRepo: isGitRepo2,
|
|
45828
|
+
branch: readStringValue(cachedGit.branch) ?? null,
|
|
45829
|
+
headCommit: readStringValue(cachedGit.headCommit) ?? null,
|
|
45830
|
+
headMessage: readStringValue(cachedGit.headMessage) ?? null,
|
|
45831
|
+
upstream: readStringValue(cachedGit.upstream) ?? null,
|
|
45832
|
+
ahead: readNumberValue(cachedGit.ahead) ?? 0,
|
|
45833
|
+
behind: readNumberValue(cachedGit.behind) ?? 0,
|
|
45834
|
+
staged: readNumberValue(cachedGit.staged) ?? 0,
|
|
45835
|
+
modified: readNumberValue(cachedGit.modified) ?? 0,
|
|
45836
|
+
untracked: readNumberValue(cachedGit.untracked) ?? 0,
|
|
45837
|
+
deleted: readNumberValue(cachedGit.deleted) ?? 0,
|
|
45838
|
+
renamed: readNumberValue(cachedGit.renamed) ?? 0,
|
|
45839
|
+
hasConflicts: hasConflicts2,
|
|
45840
|
+
conflictFiles: conflictFiles2,
|
|
45841
|
+
stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
|
|
45842
|
+
lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
|
|
45843
|
+
};
|
|
45844
|
+
}
|
|
45845
|
+
}
|
|
45846
|
+
const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
|
|
45847
|
+
const gitResult = readObjectRecord(rawGit.result);
|
|
45848
|
+
const directStatus = readObjectRecord(rawGit.status);
|
|
45849
|
+
const nestedStatus = readObjectRecord(gitResult.status);
|
|
45850
|
+
const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
|
|
45851
|
+
const probeGit = readObjectRecord(rawProbe.git);
|
|
45852
|
+
const probeGitResult = readObjectRecord(probeGit.result);
|
|
45853
|
+
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
45854
|
+
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
45855
|
+
const status = Object.keys(directStatus).length ? directStatus : Object.keys(nestedStatus).length ? nestedStatus : Object.keys(probeDirectStatus).length ? probeDirectStatus : Object.keys(probeNestedStatus).length ? probeNestedStatus : {};
|
|
45856
|
+
const isGitRepo = readBooleanValue(status.isGitRepo);
|
|
45857
|
+
if (!Object.keys(status).length || isGitRepo === void 0) return void 0;
|
|
45858
|
+
const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
|
|
45859
|
+
const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
|
|
45860
|
+
const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
|
|
45861
|
+
return {
|
|
45862
|
+
workspace: readStringValue(status.workspace, node?.workspace) || "",
|
|
45863
|
+
repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
|
|
45864
|
+
isGitRepo,
|
|
45865
|
+
branch: readStringValue(status.branch) ?? null,
|
|
45866
|
+
headCommit: readStringValue(status.headCommit) ?? null,
|
|
45867
|
+
headMessage: readStringValue(status.headMessage) ?? null,
|
|
45868
|
+
upstream: readStringValue(status.upstream) ?? null,
|
|
45869
|
+
ahead: readNumberValue(status.ahead) ?? 0,
|
|
45870
|
+
behind: readNumberValue(status.behind) ?? 0,
|
|
45871
|
+
staged: readNumberValue(status.staged) ?? 0,
|
|
45872
|
+
modified: readNumberValue(status.modified) ?? 0,
|
|
45873
|
+
untracked: readNumberValue(status.untracked) ?? 0,
|
|
45874
|
+
deleted: readNumberValue(status.deleted) ?? 0,
|
|
45875
|
+
renamed: readNumberValue(status.renamed) ?? 0,
|
|
45876
|
+
hasConflicts,
|
|
45877
|
+
conflictFiles,
|
|
45878
|
+
stashCount: readNumberValue(status.stashCount) ?? 0,
|
|
45879
|
+
lastCheckedAt: Date.now()
|
|
45880
|
+
};
|
|
45881
|
+
}
|
|
45882
|
+
function applyCachedInlineMeshNodeStatus(status, node) {
|
|
45883
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45884
|
+
const git = buildCachedInlineMeshGitStatus(node);
|
|
45885
|
+
const error48 = readStringValue(cachedStatus.error, node?.error);
|
|
45886
|
+
const health = readStringValue(cachedStatus.health, node?.health);
|
|
45887
|
+
const machineStatus = readStringValue(cachedStatus.machineStatus, node?.machineStatus);
|
|
45888
|
+
if (!git && !error48 && !health) return false;
|
|
45889
|
+
if (!machineStatus && !git && !error48) return false;
|
|
45890
|
+
if (git) status.git = git;
|
|
45891
|
+
if (error48) status.error = error48;
|
|
45892
|
+
if (health) {
|
|
45893
|
+
status.health = health;
|
|
45894
|
+
return true;
|
|
45895
|
+
}
|
|
45896
|
+
if (git) {
|
|
45897
|
+
const dirty = Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
|
|
45898
|
+
status.health = git.isGitRepo === false ? "degraded" : dirty ? "dirty" : "online";
|
|
45899
|
+
return true;
|
|
45900
|
+
}
|
|
45901
|
+
return false;
|
|
45902
|
+
}
|
|
45794
45903
|
async function resolveProviderTypeFromPriority(args) {
|
|
45795
45904
|
if (!args.providerPriority.length) {
|
|
45796
45905
|
return { error: `Node '${args.nodeId}' has no providerPriority policy; pass cliType explicitly or configure node.policy.providerPriority` };
|
|
@@ -46192,7 +46301,12 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46192
46301
|
}
|
|
46193
46302
|
return this.inlineMeshCache.get(meshId);
|
|
46194
46303
|
}
|
|
46195
|
-
async getMeshForCommand(meshId, inlineMesh) {
|
|
46304
|
+
async getMeshForCommand(meshId, inlineMesh, options) {
|
|
46305
|
+
const preferInline = options?.preferInline === true;
|
|
46306
|
+
if (preferInline) {
|
|
46307
|
+
const cached22 = this.getCachedInlineMesh(meshId, inlineMesh);
|
|
46308
|
+
if (cached22) return { mesh: cached22, inline: true };
|
|
46309
|
+
}
|
|
46196
46310
|
try {
|
|
46197
46311
|
const { getMesh: getMesh3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
46198
46312
|
const mesh = getMesh3(meshId);
|
|
@@ -48015,7 +48129,7 @@ ${block}`);
|
|
|
48015
48129
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
48016
48130
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
48017
48131
|
try {
|
|
48018
|
-
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
|
|
48132
|
+
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
48019
48133
|
const mesh = meshRecord?.mesh;
|
|
48020
48134
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
48021
48135
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
@@ -48040,6 +48154,10 @@ ${block}`);
|
|
|
48040
48154
|
activeSessions: []
|
|
48041
48155
|
};
|
|
48042
48156
|
if (node.workspace && typeof node.workspace === "string") {
|
|
48157
|
+
if (!fs10.existsSync(node.workspace) && applyCachedInlineMeshNodeStatus(status, node)) {
|
|
48158
|
+
nodeStatuses.push(status);
|
|
48159
|
+
continue;
|
|
48160
|
+
}
|
|
48043
48161
|
try {
|
|
48044
48162
|
const { execFile: execFile3 } = await import("child_process");
|
|
48045
48163
|
const { promisify: promisify3 } = await import("util");
|
|
@@ -48099,8 +48217,12 @@ ${block}`);
|
|
|
48099
48217
|
};
|
|
48100
48218
|
status.health = branch ? dirty ? "dirty" : "online" : "degraded";
|
|
48101
48219
|
} catch {
|
|
48102
|
-
status
|
|
48220
|
+
if (!applyCachedInlineMeshNodeStatus(status, node)) {
|
|
48221
|
+
status.health = "degraded";
|
|
48222
|
+
}
|
|
48103
48223
|
}
|
|
48224
|
+
} else {
|
|
48225
|
+
applyCachedInlineMeshNodeStatus(status, node);
|
|
48104
48226
|
}
|
|
48105
48227
|
nodeStatuses.push(status);
|
|
48106
48228
|
}
|