adhdev 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/cli/index.js +126 -12
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +126 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +157 -20
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -46570,6 +46570,96 @@ function buildCachedInlineMeshGitStatus(node) {
|
|
|
46570
46570
|
...submodules ? { submodules } : {}
|
|
46571
46571
|
};
|
|
46572
46572
|
}
|
|
46573
|
+
function shouldDiscardCachedInlineMeshStatus(node) {
|
|
46574
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
46575
|
+
if (!Object.keys(cachedStatus).length) return false;
|
|
46576
|
+
const cachedGit = readObjectRecord(cachedStatus.git);
|
|
46577
|
+
const workspaceError = readStringValue(cachedStatus.error, node?.error);
|
|
46578
|
+
if (workspaceError && /workspace must be an existing directory/i.test(workspaceError)) return true;
|
|
46579
|
+
const isGitRepo = readBooleanValue(cachedGit.isGitRepo);
|
|
46580
|
+
const branch = readStringValue(cachedGit.branch);
|
|
46581
|
+
const headCommit = readStringValue(cachedGit.headCommit);
|
|
46582
|
+
return isGitRepo === false && !branch && !headCommit;
|
|
46583
|
+
}
|
|
46584
|
+
function stripInlineMeshTransientNodeState(node) {
|
|
46585
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return node;
|
|
46586
|
+
const {
|
|
46587
|
+
cachedStatus,
|
|
46588
|
+
lastGit: _lastGit,
|
|
46589
|
+
last_git: _lastGitLegacy,
|
|
46590
|
+
lastProbe: _lastProbe,
|
|
46591
|
+
last_probe: _lastProbeLegacy,
|
|
46592
|
+
error: _error,
|
|
46593
|
+
health: _health,
|
|
46594
|
+
machineStatus: _machineStatus,
|
|
46595
|
+
lastSeenAt: _lastSeenAt,
|
|
46596
|
+
last_seen_at: _lastSeenAtLegacy,
|
|
46597
|
+
updatedAt: _updatedAt,
|
|
46598
|
+
updated_at: _updatedAtLegacy,
|
|
46599
|
+
activeSession: _activeSession,
|
|
46600
|
+
active_session: _activeSessionLegacy,
|
|
46601
|
+
activeSessionId: _activeSessionId,
|
|
46602
|
+
active_session_id: _activeSessionIdLegacy,
|
|
46603
|
+
sessionId: _sessionId,
|
|
46604
|
+
session_id: _sessionIdLegacy,
|
|
46605
|
+
providerType: _providerType,
|
|
46606
|
+
provider_type: _providerTypeLegacy,
|
|
46607
|
+
providers: _providers,
|
|
46608
|
+
...rest
|
|
46609
|
+
} = node;
|
|
46610
|
+
if (cachedStatus && !shouldDiscardCachedInlineMeshStatus(node)) {
|
|
46611
|
+
return { ...rest, cachedStatus };
|
|
46612
|
+
}
|
|
46613
|
+
return rest;
|
|
46614
|
+
}
|
|
46615
|
+
function hasInlineMeshTransientNodeState(node) {
|
|
46616
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return false;
|
|
46617
|
+
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;
|
|
46618
|
+
}
|
|
46619
|
+
function readInlineMeshNodeId(node) {
|
|
46620
|
+
return readStringValue(node?.id, node?.nodeId) || "";
|
|
46621
|
+
}
|
|
46622
|
+
function sanitizeInlineMesh(inlineMesh) {
|
|
46623
|
+
if (!inlineMesh || typeof inlineMesh !== "object" || Array.isArray(inlineMesh)) return inlineMesh;
|
|
46624
|
+
if (!Array.isArray(inlineMesh.nodes)) return inlineMesh;
|
|
46625
|
+
let changed = false;
|
|
46626
|
+
const nodes = inlineMesh.nodes.map((node) => {
|
|
46627
|
+
if (!hasInlineMeshTransientNodeState(node)) return node;
|
|
46628
|
+
changed = true;
|
|
46629
|
+
return stripInlineMeshTransientNodeState(node);
|
|
46630
|
+
});
|
|
46631
|
+
if (!changed) return inlineMesh;
|
|
46632
|
+
return {
|
|
46633
|
+
...inlineMesh,
|
|
46634
|
+
nodes
|
|
46635
|
+
};
|
|
46636
|
+
}
|
|
46637
|
+
function reconcileInlineMeshCache(cached2, incoming) {
|
|
46638
|
+
if (!cached2 || typeof cached2 !== "object" || Array.isArray(cached2)) return incoming;
|
|
46639
|
+
if (!incoming || typeof incoming !== "object" || Array.isArray(incoming)) return cached2;
|
|
46640
|
+
const cachedNodes = Array.isArray(cached2.nodes) ? cached2.nodes : [];
|
|
46641
|
+
const incomingNodes = Array.isArray(incoming.nodes) ? incoming.nodes : [];
|
|
46642
|
+
if (!cachedNodes.length || !incomingNodes.length) return { ...cached2, ...incoming };
|
|
46643
|
+
const incomingById = /* @__PURE__ */ new Map();
|
|
46644
|
+
for (const node of incomingNodes) {
|
|
46645
|
+
const nodeId = readInlineMeshNodeId(node);
|
|
46646
|
+
if (nodeId) incomingById.set(nodeId, node);
|
|
46647
|
+
}
|
|
46648
|
+
const nodes = cachedNodes.map((cachedNode) => {
|
|
46649
|
+
const nodeId = readInlineMeshNodeId(cachedNode);
|
|
46650
|
+
const incomingNode = nodeId ? incomingById.get(nodeId) : void 0;
|
|
46651
|
+
if (!incomingNode) return cachedNode;
|
|
46652
|
+
if (hasInlineMeshTransientNodeState(incomingNode)) {
|
|
46653
|
+
return { ...cachedNode, ...incomingNode };
|
|
46654
|
+
}
|
|
46655
|
+
return { ...stripInlineMeshTransientNodeState(cachedNode), ...incomingNode };
|
|
46656
|
+
});
|
|
46657
|
+
return {
|
|
46658
|
+
...cached2,
|
|
46659
|
+
...incoming,
|
|
46660
|
+
nodes
|
|
46661
|
+
};
|
|
46662
|
+
}
|
|
46573
46663
|
function hasGitWorktreeChanges(git) {
|
|
46574
46664
|
if (!git) return false;
|
|
46575
46665
|
return Number(git.staged || 0) + Number(git.modified || 0) + Number(git.untracked || 0) + Number(git.deleted || 0) + Number(git.renamed || 0) > 0;
|
|
@@ -46664,8 +46754,21 @@ function summarizeMeshSessionRecord(record2) {
|
|
|
46664
46754
|
isCached: false
|
|
46665
46755
|
};
|
|
46666
46756
|
}
|
|
46757
|
+
function liveSessionRecordMatchesMeshNode(record2, meshId, nodeId) {
|
|
46758
|
+
const recordNodeId = readStringValue(record2?.meta?.meshNodeId);
|
|
46759
|
+
if (!recordNodeId || recordNodeId !== nodeId) return false;
|
|
46760
|
+
const recordMeshId = readStringValue(record2?.meta?.meshNodeFor);
|
|
46761
|
+
return !recordMeshId || recordMeshId === meshId;
|
|
46762
|
+
}
|
|
46763
|
+
function liveSessionRecordMatchesMeshWorkspace(record2, meshId, workspace) {
|
|
46764
|
+
const recordWorkspace = readStringValue(record2?.workspace);
|
|
46765
|
+
if (!recordWorkspace || !workspace || recordWorkspace !== workspace) return false;
|
|
46766
|
+
const recordMeshId = readStringValue(record2?.meta?.meshNodeFor);
|
|
46767
|
+
if (recordMeshId) return recordMeshId === meshId;
|
|
46768
|
+
return record2?.meta?.launchedByCoordinator === true || !!readStringValue(record2?.meta?.meshNodeId);
|
|
46769
|
+
}
|
|
46667
46770
|
function readLiveMeshNodeWorkspace(args) {
|
|
46668
|
-
const directNodeWorkspace = args.liveSessionRecords.find((record2) =>
|
|
46771
|
+
const directNodeWorkspace = args.liveSessionRecords.find((record2) => liveSessionRecordMatchesMeshNode(record2, args.meshId, args.nodeId) && readStringValue(record2?.workspace));
|
|
46669
46772
|
if (directNodeWorkspace) {
|
|
46670
46773
|
return readStringValue(directNodeWorkspace.workspace) || "";
|
|
46671
46774
|
}
|
|
@@ -46679,10 +46782,9 @@ function readLiveMeshNodeWorkspace(args) {
|
|
|
46679
46782
|
}
|
|
46680
46783
|
function collectLiveMeshSessionRecords(args) {
|
|
46681
46784
|
const matches = args.liveSessionRecords.filter((record2) => {
|
|
46682
|
-
if (readStringValue(record2?.meta?.meshNodeId) === args.nodeId) return true;
|
|
46683
|
-
const recordWorkspace = readStringValue(record2?.workspace);
|
|
46684
46785
|
const nodeWorkspace = readStringValue(args.node?.workspace);
|
|
46685
|
-
|
|
46786
|
+
if (liveSessionRecordMatchesMeshNode(record2, args.meshId, args.nodeId)) return true;
|
|
46787
|
+
return !!nodeWorkspace && liveSessionRecordMatchesMeshWorkspace(record2, args.meshId, nodeWorkspace);
|
|
46686
46788
|
});
|
|
46687
46789
|
if (args.allowCoordinatorSession) {
|
|
46688
46790
|
for (const record2 of args.liveSessionRecords) {
|
|
@@ -47161,10 +47263,15 @@ var init_router = __esm({
|
|
|
47161
47263
|
}
|
|
47162
47264
|
warmInlineMeshCache(meshId, inlineMesh) {
|
|
47163
47265
|
if (!inlineMesh || typeof inlineMesh !== "object") return void 0;
|
|
47266
|
+
const sanitizedInlineMesh = sanitizeInlineMesh(inlineMesh);
|
|
47164
47267
|
const cached2 = this.inlineMeshCache.get(meshId);
|
|
47165
|
-
if (cached2)
|
|
47166
|
-
|
|
47167
|
-
|
|
47268
|
+
if (cached2) {
|
|
47269
|
+
const merged = reconcileInlineMeshCache(cached2, sanitizedInlineMesh);
|
|
47270
|
+
this.inlineMeshCache.set(meshId, merged);
|
|
47271
|
+
return merged;
|
|
47272
|
+
}
|
|
47273
|
+
this.inlineMeshCache.set(meshId, sanitizedInlineMesh);
|
|
47274
|
+
return sanitizedInlineMesh;
|
|
47168
47275
|
}
|
|
47169
47276
|
async getMeshForCommand(meshId, inlineMesh, options) {
|
|
47170
47277
|
const preferInline = options?.preferInline === true;
|
|
@@ -49107,10 +49214,17 @@ ${block}`);
|
|
|
49107
49214
|
}
|
|
49108
49215
|
}
|
|
49109
49216
|
if (workspace) {
|
|
49110
|
-
if (!fs10.existsSync(workspace)
|
|
49111
|
-
|
|
49112
|
-
|
|
49113
|
-
|
|
49217
|
+
if (!fs10.existsSync(workspace)) {
|
|
49218
|
+
if (applyCachedInlineMeshNodeStatus(status, node)) {
|
|
49219
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
49220
|
+
nodeStatuses.push(status);
|
|
49221
|
+
continue;
|
|
49222
|
+
}
|
|
49223
|
+
if (meshRecord?.source === "inline_cache" && !isSelfNode) {
|
|
49224
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
49225
|
+
nodeStatuses.push(status);
|
|
49226
|
+
continue;
|
|
49227
|
+
}
|
|
49114
49228
|
}
|
|
49115
49229
|
try {
|
|
49116
49230
|
const gitStatus = await getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
|
|
@@ -98169,7 +98283,7 @@ var init_adhdev_daemon = __esm({
|
|
|
98169
98283
|
init_version();
|
|
98170
98284
|
init_src();
|
|
98171
98285
|
init_runtime_defaults();
|
|
98172
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
98286
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.23" });
|
|
98173
98287
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
98174
98288
|
localHttpServer = null;
|
|
98175
98289
|
localWss = null;
|