@adhdev/daemon-standalone 0.9.82-rc.5 → 0.9.82-rc.7
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
|
@@ -45903,26 +45903,57 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
45903
45903
|
...submodules ? { submodules } : {}
|
|
45904
45904
|
};
|
|
45905
45905
|
}
|
|
45906
|
+
function hasGitWorktreeChanges(git) {
|
|
45907
|
+
if (!git) return false;
|
|
45908
|
+
return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
|
|
45909
|
+
}
|
|
45910
|
+
function getGitSubmoduleDriftState(git) {
|
|
45911
|
+
const submodules = Array.isArray(git?.submodules) ? git.submodules : [];
|
|
45912
|
+
let dirty = false;
|
|
45913
|
+
let outOfSync = false;
|
|
45914
|
+
for (const entry of submodules) {
|
|
45915
|
+
const submodule = readObjectRecord(entry);
|
|
45916
|
+
if (readBooleanValue(submodule.dirty) === true) dirty = true;
|
|
45917
|
+
if (readBooleanValue(submodule.outOfSync) === true || !!readStringValue(submodule.error)) outOfSync = true;
|
|
45918
|
+
}
|
|
45919
|
+
return { dirty, outOfSync };
|
|
45920
|
+
}
|
|
45921
|
+
function deriveMeshNodeHealthFromGit(git) {
|
|
45922
|
+
if (!git || readBooleanValue(git.isGitRepo) === false) return "degraded";
|
|
45923
|
+
const branch = readStringValue(git.branch);
|
|
45924
|
+
if (!branch) return "degraded";
|
|
45925
|
+
const submoduleDrift = getGitSubmoduleDriftState(git);
|
|
45926
|
+
if (submoduleDrift.outOfSync) return "degraded";
|
|
45927
|
+
if (submoduleDrift.dirty || hasGitWorktreeChanges(git)) return "dirty";
|
|
45928
|
+
return "online";
|
|
45929
|
+
}
|
|
45930
|
+
function readCachedInlineMeshActiveSessions(node) {
|
|
45931
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45932
|
+
const activeSession = readObjectRecord(cachedStatus.activeSession);
|
|
45933
|
+
const fallbackSession = Object.keys(activeSession).length ? activeSession : readObjectRecord(node?.activeSession ?? node?.active_session);
|
|
45934
|
+
const sessionId = readStringValue(fallbackSession.id, fallbackSession.sessionId, fallbackSession.session_id, node?.activeSessionId, node?.active_session_id, node?.sessionId, node?.session_id);
|
|
45935
|
+
return sessionId ? [sessionId] : [];
|
|
45936
|
+
}
|
|
45906
45937
|
function applyCachedInlineMeshNodeStatus(status, node) {
|
|
45907
45938
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45908
45939
|
const git = buildCachedInlineMeshGitStatus(node);
|
|
45909
45940
|
const error48 = readStringValue(cachedStatus.error, node?.error);
|
|
45910
45941
|
const health = readStringValue(cachedStatus.health, node?.health);
|
|
45911
45942
|
const machineStatus = readStringValue(cachedStatus.machineStatus, node?.machineStatus);
|
|
45912
|
-
|
|
45913
|
-
if (!
|
|
45943
|
+
const activeSessions = readCachedInlineMeshActiveSessions(node);
|
|
45944
|
+
if (!git && !error48 && !health && !machineStatus && activeSessions.length === 0) return false;
|
|
45914
45945
|
if (git) status.git = git;
|
|
45915
45946
|
if (error48) status.error = error48;
|
|
45947
|
+
if (activeSessions.length > 0) status.activeSessions = activeSessions;
|
|
45916
45948
|
if (health) {
|
|
45917
45949
|
status.health = health;
|
|
45918
45950
|
return true;
|
|
45919
45951
|
}
|
|
45920
45952
|
if (git) {
|
|
45921
|
-
|
|
45922
|
-
status.health = git.isGitRepo === false ? "degraded" : dirty ? "dirty" : "online";
|
|
45953
|
+
status.health = deriveMeshNodeHealthFromGit(git);
|
|
45923
45954
|
return true;
|
|
45924
45955
|
}
|
|
45925
|
-
return
|
|
45956
|
+
return activeSessions.length > 0 || !!machineStatus;
|
|
45926
45957
|
}
|
|
45927
45958
|
async function resolveProviderTypeFromPriority(args) {
|
|
45928
45959
|
if (!args.providerPriority.length) {
|
|
@@ -48162,6 +48193,8 @@ ${block}`);
|
|
|
48162
48193
|
const { readLedgerEntries: readLedgerEntries2, getLedgerSummary: getLedgerSummary2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
48163
48194
|
const ledgerEntries = readLedgerEntries2(meshId, { tail: 20 });
|
|
48164
48195
|
const ledgerSummary = getLedgerSummary2(meshId);
|
|
48196
|
+
const sessionHostRecords = this.deps.sessionHostControl?.listSessions ? await this.deps.sessionHostControl.listSessions().catch(() => []) : [];
|
|
48197
|
+
const liveMeshSessions = partitionSessionHostRecords(Array.isArray(sessionHostRecords) ? sessionHostRecords : []).liveRuntimes;
|
|
48165
48198
|
const nodeStatuses = [];
|
|
48166
48199
|
for (const node of mesh.nodes || []) {
|
|
48167
48200
|
const status = {
|
|
@@ -48177,6 +48210,11 @@ ${block}`);
|
|
|
48177
48210
|
providers: node.providers || [],
|
|
48178
48211
|
activeSessions: []
|
|
48179
48212
|
};
|
|
48213
|
+
const nodeId = String(node.id || node.nodeId || "");
|
|
48214
|
+
const matchedLiveSessions = liveMeshSessions.filter((record2) => this.sessionMatchesMeshNode(record2, node, nodeId)).map((record2) => typeof record2?.sessionId === "string" ? record2.sessionId : "").filter(Boolean);
|
|
48215
|
+
if (matchedLiveSessions.length > 0) {
|
|
48216
|
+
status.activeSessions = matchedLiveSessions;
|
|
48217
|
+
}
|
|
48180
48218
|
if (node.workspace && typeof node.workspace === "string") {
|
|
48181
48219
|
if (!fs10.existsSync(node.workspace) && applyCachedInlineMeshNodeStatus(status, node)) {
|
|
48182
48220
|
nodeStatuses.push(status);
|
|
@@ -48186,8 +48224,7 @@ ${block}`);
|
|
|
48186
48224
|
const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
|
|
48187
48225
|
status.git = gitStatus;
|
|
48188
48226
|
if (gitStatus.isGitRepo) {
|
|
48189
|
-
|
|
48190
|
-
status.health = gitStatus.branch ? dirty ? "dirty" : "online" : "degraded";
|
|
48227
|
+
status.health = deriveMeshNodeHealthFromGit(gitStatus);
|
|
48191
48228
|
} else {
|
|
48192
48229
|
status.health = "degraded";
|
|
48193
48230
|
if (gitStatus.error && !status.error) status.error = gitStatus.error;
|