@adhdev/daemon-standalone 0.9.82-rc.21 → 0.9.82-rc.23
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 +125 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-CiB8XPwO.css +1 -0
- package/public/assets/index-Dt2Xvr87.js +98 -0
- package/public/index.html +2 -2
- package/vendor/mcp-server/index.js +157 -20
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -45981,6 +45981,96 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
45981
45981
|
...submodules ? { submodules } : {}
|
|
45982
45982
|
};
|
|
45983
45983
|
}
|
|
45984
|
+
function shouldDiscardCachedInlineMeshStatus(node) {
|
|
45985
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
45986
|
+
if (!Object.keys(cachedStatus).length) return false;
|
|
45987
|
+
const cachedGit = readObjectRecord(cachedStatus.git);
|
|
45988
|
+
const workspaceError = readStringValue(cachedStatus.error, node?.error);
|
|
45989
|
+
if (workspaceError && /workspace must be an existing directory/i.test(workspaceError)) return true;
|
|
45990
|
+
const isGitRepo = readBooleanValue(cachedGit.isGitRepo);
|
|
45991
|
+
const branch = readStringValue(cachedGit.branch);
|
|
45992
|
+
const headCommit = readStringValue(cachedGit.headCommit);
|
|
45993
|
+
return isGitRepo === false && !branch && !headCommit;
|
|
45994
|
+
}
|
|
45995
|
+
function stripInlineMeshTransientNodeState(node) {
|
|
45996
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return node;
|
|
45997
|
+
const {
|
|
45998
|
+
cachedStatus,
|
|
45999
|
+
lastGit: _lastGit,
|
|
46000
|
+
last_git: _lastGitLegacy,
|
|
46001
|
+
lastProbe: _lastProbe,
|
|
46002
|
+
last_probe: _lastProbeLegacy,
|
|
46003
|
+
error: _error,
|
|
46004
|
+
health: _health,
|
|
46005
|
+
machineStatus: _machineStatus,
|
|
46006
|
+
lastSeenAt: _lastSeenAt,
|
|
46007
|
+
last_seen_at: _lastSeenAtLegacy,
|
|
46008
|
+
updatedAt: _updatedAt,
|
|
46009
|
+
updated_at: _updatedAtLegacy,
|
|
46010
|
+
activeSession: _activeSession,
|
|
46011
|
+
active_session: _activeSessionLegacy,
|
|
46012
|
+
activeSessionId: _activeSessionId,
|
|
46013
|
+
active_session_id: _activeSessionIdLegacy,
|
|
46014
|
+
sessionId: _sessionId,
|
|
46015
|
+
session_id: _sessionIdLegacy,
|
|
46016
|
+
providerType: _providerType,
|
|
46017
|
+
provider_type: _providerTypeLegacy,
|
|
46018
|
+
providers: _providers,
|
|
46019
|
+
...rest
|
|
46020
|
+
} = node;
|
|
46021
|
+
if (cachedStatus && !shouldDiscardCachedInlineMeshStatus(node)) {
|
|
46022
|
+
return { ...rest, cachedStatus };
|
|
46023
|
+
}
|
|
46024
|
+
return rest;
|
|
46025
|
+
}
|
|
46026
|
+
function hasInlineMeshTransientNodeState(node) {
|
|
46027
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return false;
|
|
46028
|
+
return "cachedStatus" in node || "lastGit" in node || "last_git" in node || "lastProbe" in node || "last_probe" in node || "error" in node || "health" in node || "machineStatus" in node || "lastSeenAt" in node || "last_seen_at" in node || "updatedAt" in node || "updated_at" in node || "activeSession" in node || "active_session" in node || "activeSessionId" in node || "active_session_id" in node || "sessionId" in node || "session_id" in node || "providerType" in node || "provider_type" in node || "providers" in node;
|
|
46029
|
+
}
|
|
46030
|
+
function readInlineMeshNodeId(node) {
|
|
46031
|
+
return readStringValue(node?.id, node?.nodeId) || "";
|
|
46032
|
+
}
|
|
46033
|
+
function sanitizeInlineMesh(inlineMesh) {
|
|
46034
|
+
if (!inlineMesh || typeof inlineMesh !== "object" || Array.isArray(inlineMesh)) return inlineMesh;
|
|
46035
|
+
if (!Array.isArray(inlineMesh.nodes)) return inlineMesh;
|
|
46036
|
+
let changed = false;
|
|
46037
|
+
const nodes = inlineMesh.nodes.map((node) => {
|
|
46038
|
+
if (!hasInlineMeshTransientNodeState(node)) return node;
|
|
46039
|
+
changed = true;
|
|
46040
|
+
return stripInlineMeshTransientNodeState(node);
|
|
46041
|
+
});
|
|
46042
|
+
if (!changed) return inlineMesh;
|
|
46043
|
+
return {
|
|
46044
|
+
...inlineMesh,
|
|
46045
|
+
nodes
|
|
46046
|
+
};
|
|
46047
|
+
}
|
|
46048
|
+
function reconcileInlineMeshCache(cached2, incoming) {
|
|
46049
|
+
if (!cached2 || typeof cached2 !== "object" || Array.isArray(cached2)) return incoming;
|
|
46050
|
+
if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached2;
|
|
46051
|
+
const cachedNodes = Array.isArray(cached2.nodes) ? cached2.nodes : [];
|
|
46052
|
+
const incomingNodes = Array.isArray(incoming.nodes) ? incoming.nodes : [];
|
|
46053
|
+
if (!cachedNodes.length || !incomingNodes.length) return { ...cached2, ...incoming };
|
|
46054
|
+
const incomingById = /* @__PURE__ */ new Map();
|
|
46055
|
+
for (const node of incomingNodes) {
|
|
46056
|
+
const nodeId = readInlineMeshNodeId(node);
|
|
46057
|
+
if (nodeId) incomingById.set(nodeId, node);
|
|
46058
|
+
}
|
|
46059
|
+
const nodes = cachedNodes.map((cachedNode) => {
|
|
46060
|
+
const nodeId = readInlineMeshNodeId(cachedNode);
|
|
46061
|
+
const incomingNode = nodeId ? incomingById.get(nodeId) : void 0;
|
|
46062
|
+
if (!incomingNode) return cachedNode;
|
|
46063
|
+
if (hasInlineMeshTransientNodeState(incomingNode)) {
|
|
46064
|
+
return { ...cachedNode, ...incomingNode };
|
|
46065
|
+
}
|
|
46066
|
+
return { ...stripInlineMeshTransientNodeState(cachedNode), ...incomingNode };
|
|
46067
|
+
});
|
|
46068
|
+
return {
|
|
46069
|
+
...cached2,
|
|
46070
|
+
...incoming,
|
|
46071
|
+
nodes
|
|
46072
|
+
};
|
|
46073
|
+
}
|
|
45984
46074
|
function hasGitWorktreeChanges(git) {
|
|
45985
46075
|
if (!git) return false;
|
|
45986
46076
|
return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
|
|
@@ -46075,8 +46165,21 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46075
46165
|
isCached: false
|
|
46076
46166
|
};
|
|
46077
46167
|
}
|
|
46168
|
+
function liveSessionRecordMatchesMeshNode(record2, meshId, nodeId) {
|
|
46169
|
+
const recordNodeId = readStringValue(record2?.meta?.meshNodeId);
|
|
46170
|
+
if (!recordNodeId || recordNodeId !== nodeId) return false;
|
|
46171
|
+
const recordMeshId = readStringValue(record2?.meta?.meshNodeFor);
|
|
46172
|
+
return !recordMeshId || recordMeshId === meshId;
|
|
46173
|
+
}
|
|
46174
|
+
function liveSessionRecordMatchesMeshWorkspace(record2, meshId, workspace) {
|
|
46175
|
+
const recordWorkspace = readStringValue(record2?.workspace);
|
|
46176
|
+
if (!recordWorkspace || !workspace || recordWorkspace !== workspace) return false;
|
|
46177
|
+
const recordMeshId = readStringValue(record2?.meta?.meshNodeFor);
|
|
46178
|
+
if (recordMeshId) return recordMeshId === meshId;
|
|
46179
|
+
return record2?.meta?.launchedByCoordinator === true || !!readStringValue(record2?.meta?.meshNodeId);
|
|
46180
|
+
}
|
|
46078
46181
|
function readLiveMeshNodeWorkspace(args) {
|
|
46079
|
-
const directNodeWorkspace = args.liveSessionRecords.find((record2) =>
|
|
46182
|
+
const directNodeWorkspace = args.liveSessionRecords.find((record2) => liveSessionRecordMatchesMeshNode(record2, args.meshId, args.nodeId) && readStringValue(record2?.workspace));
|
|
46080
46183
|
if (directNodeWorkspace) {
|
|
46081
46184
|
return readStringValue(directNodeWorkspace.workspace) || "";
|
|
46082
46185
|
}
|
|
@@ -46090,10 +46193,9 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46090
46193
|
}
|
|
46091
46194
|
function collectLiveMeshSessionRecords(args) {
|
|
46092
46195
|
const matches = args.liveSessionRecords.filter((record2) => {
|
|
46093
|
-
if (readStringValue(record2?.meta?.meshNodeId) === args.nodeId) return true;
|
|
46094
|
-
const recordWorkspace = readStringValue(record2?.workspace);
|
|
46095
46196
|
const nodeWorkspace = readStringValue(args.node?.workspace);
|
|
46096
|
-
|
|
46197
|
+
if (liveSessionRecordMatchesMeshNode(record2, args.meshId, args.nodeId)) return true;
|
|
46198
|
+
return !!nodeWorkspace && liveSessionRecordMatchesMeshWorkspace(record2, args.meshId, nodeWorkspace);
|
|
46097
46199
|
});
|
|
46098
46200
|
if (args.allowCoordinatorSession) {
|
|
46099
46201
|
for (const record2 of args.liveSessionRecords) {
|
|
@@ -46535,10 +46637,15 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46535
46637
|
}
|
|
46536
46638
|
warmInlineMeshCache(meshId, inlineMesh) {
|
|
46537
46639
|
if (!inlineMesh || typeof inlineMesh !== "object") return void 0;
|
|
46640
|
+
const sanitizedInlineMesh = sanitizeInlineMesh(inlineMesh);
|
|
46538
46641
|
const cached2 = this.inlineMeshCache.get(meshId);
|
|
46539
|
-
if (cached2)
|
|
46540
|
-
|
|
46541
|
-
|
|
46642
|
+
if (cached2) {
|
|
46643
|
+
const merged = reconcileInlineMeshCache(cached2, sanitizedInlineMesh);
|
|
46644
|
+
this.inlineMeshCache.set(meshId, merged);
|
|
46645
|
+
return merged;
|
|
46646
|
+
}
|
|
46647
|
+
this.inlineMeshCache.set(meshId, sanitizedInlineMesh);
|
|
46648
|
+
return sanitizedInlineMesh;
|
|
46542
46649
|
}
|
|
46543
46650
|
async getMeshForCommand(meshId, inlineMesh, options) {
|
|
46544
46651
|
const preferInline = options?.preferInline === true;
|
|
@@ -48481,10 +48588,17 @@ ${block}`);
|
|
|
48481
48588
|
}
|
|
48482
48589
|
}
|
|
48483
48590
|
if (workspace) {
|
|
48484
|
-
if (!fs10.existsSync(workspace)
|
|
48485
|
-
|
|
48486
|
-
|
|
48487
|
-
|
|
48591
|
+
if (!fs10.existsSync(workspace)) {
|
|
48592
|
+
if (applyCachedInlineMeshNodeStatus(status, node)) {
|
|
48593
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
48594
|
+
nodeStatuses.push(status);
|
|
48595
|
+
continue;
|
|
48596
|
+
}
|
|
48597
|
+
if (meshRecord?.source === "inline_cache" && !isSelfNode) {
|
|
48598
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
48599
|
+
nodeStatuses.push(status);
|
|
48600
|
+
continue;
|
|
48601
|
+
}
|
|
48488
48602
|
}
|
|
48489
48603
|
try {
|
|
48490
48604
|
const gitStatus = await getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
|