adhdev 0.9.82-rc.39 → 0.9.82-rc.40
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 +65 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +65 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -47604,9 +47604,56 @@ var init_router = __esm({
|
|
|
47604
47604
|
* Allows the MCP server to query mesh data via get_mesh even when
|
|
47605
47605
|
* the mesh doesn't exist in the local meshes.json file. */
|
|
47606
47606
|
inlineMeshCache = /* @__PURE__ */ new Map();
|
|
47607
|
+
/** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default. */
|
|
47608
|
+
aggregateMeshStatusCache = /* @__PURE__ */ new Map();
|
|
47607
47609
|
constructor(deps) {
|
|
47608
47610
|
this.deps = deps;
|
|
47609
47611
|
}
|
|
47612
|
+
cloneJsonValue(value) {
|
|
47613
|
+
if (typeof structuredClone === "function") return structuredClone(value);
|
|
47614
|
+
return JSON.parse(JSON.stringify(value));
|
|
47615
|
+
}
|
|
47616
|
+
getCachedAggregateMeshStatus(meshId) {
|
|
47617
|
+
const cached2 = this.aggregateMeshStatusCache.get(meshId);
|
|
47618
|
+
if (!cached2?.snapshot || cached2.snapshot.success !== true || !Array.isArray(cached2.snapshot.nodes)) return null;
|
|
47619
|
+
const snapshot = this.cloneJsonValue(cached2.snapshot);
|
|
47620
|
+
const ageMs = Math.max(0, Date.now() - cached2.builtAt);
|
|
47621
|
+
const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
|
|
47622
|
+
snapshot.sourceOfTruth = {
|
|
47623
|
+
...sourceOfTruth,
|
|
47624
|
+
aggregateSnapshot: {
|
|
47625
|
+
...sourceOfTruth.aggregateSnapshot && typeof sourceOfTruth.aggregateSnapshot === "object" ? sourceOfTruth.aggregateSnapshot : {},
|
|
47626
|
+
owner: "coordinator_daemon_memory",
|
|
47627
|
+
cached: true,
|
|
47628
|
+
source: "memory",
|
|
47629
|
+
refreshReason: "memory_cache_hit",
|
|
47630
|
+
ageMs,
|
|
47631
|
+
cachedAt: new Date(cached2.builtAt).toISOString(),
|
|
47632
|
+
returnedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
47633
|
+
}
|
|
47634
|
+
};
|
|
47635
|
+
return snapshot;
|
|
47636
|
+
}
|
|
47637
|
+
rememberAggregateMeshStatus(meshId, snapshot, refreshReason) {
|
|
47638
|
+
if (!snapshot || typeof snapshot !== "object" || snapshot.success !== true || !Array.isArray(snapshot.nodes)) return snapshot;
|
|
47639
|
+
const builtAt = Date.now();
|
|
47640
|
+
const next = this.cloneJsonValue(snapshot);
|
|
47641
|
+
const sourceOfTruth = next.sourceOfTruth && typeof next.sourceOfTruth === "object" ? next.sourceOfTruth : {};
|
|
47642
|
+
next.sourceOfTruth = {
|
|
47643
|
+
...sourceOfTruth,
|
|
47644
|
+
aggregateSnapshot: {
|
|
47645
|
+
owner: "coordinator_daemon_memory",
|
|
47646
|
+
cached: false,
|
|
47647
|
+
source: "live_refresh",
|
|
47648
|
+
refreshReason,
|
|
47649
|
+
ageMs: 0,
|
|
47650
|
+
cachedAt: new Date(builtAt).toISOString(),
|
|
47651
|
+
returnedAt: new Date(builtAt).toISOString()
|
|
47652
|
+
}
|
|
47653
|
+
};
|
|
47654
|
+
this.aggregateMeshStatusCache.set(meshId, { builtAt, snapshot: this.cloneJsonValue(next) });
|
|
47655
|
+
return next;
|
|
47656
|
+
}
|
|
47610
47657
|
getCachedInlineMesh(meshId, inlineMesh) {
|
|
47611
47658
|
if (inlineMesh && typeof inlineMesh === "object") {
|
|
47612
47659
|
return this.warmInlineMeshCache(meshId, inlineMesh);
|
|
@@ -47646,6 +47693,9 @@ var init_router = __esm({
|
|
|
47646
47693
|
const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
|
|
47647
47694
|
return warmedInline ? { mesh: warmedInline, inline: true, source: "inline_bootstrap" } : null;
|
|
47648
47695
|
}
|
|
47696
|
+
invalidateAggregateMeshStatus(meshId) {
|
|
47697
|
+
this.aggregateMeshStatusCache.delete(meshId);
|
|
47698
|
+
}
|
|
47649
47699
|
updateInlineMeshNode(meshId, mesh, node) {
|
|
47650
47700
|
if (!mesh || !Array.isArray(mesh.nodes) || !node?.id) return;
|
|
47651
47701
|
const idx = mesh.nodes.findIndex((entry) => entry?.id === node.id || entry?.nodeId === node.id);
|
|
@@ -47653,6 +47703,7 @@ var init_router = __esm({
|
|
|
47653
47703
|
else mesh.nodes.push(node);
|
|
47654
47704
|
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
47655
47705
|
this.inlineMeshCache.set(meshId, mesh);
|
|
47706
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
47656
47707
|
}
|
|
47657
47708
|
removeInlineMeshNode(meshId, mesh, nodeId) {
|
|
47658
47709
|
if (!mesh || !Array.isArray(mesh.nodes)) return false;
|
|
@@ -47661,6 +47712,7 @@ var init_router = __esm({
|
|
|
47661
47712
|
mesh.nodes.splice(idx, 1);
|
|
47662
47713
|
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
47663
47714
|
this.inlineMeshCache.set(meshId, mesh);
|
|
47715
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
47664
47716
|
return true;
|
|
47665
47717
|
}
|
|
47666
47718
|
normalizeMeshSessionCleanupMode(value) {
|
|
@@ -48702,6 +48754,7 @@ var init_router = __esm({
|
|
|
48702
48754
|
const mesh = updateMesh2(meshId, patch);
|
|
48703
48755
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
48704
48756
|
this.inlineMeshCache.set(meshId, mesh);
|
|
48757
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
48705
48758
|
return { success: true, mesh };
|
|
48706
48759
|
} catch (e) {
|
|
48707
48760
|
return { success: false, error: e.message };
|
|
@@ -49137,6 +49190,7 @@ var init_router = __esm({
|
|
|
49137
49190
|
} else {
|
|
49138
49191
|
const { removeNode: removeNode3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
49139
49192
|
removed = removeNode3(meshId, nodeId);
|
|
49193
|
+
if (removed) this.invalidateAggregateMeshStatus(meshId);
|
|
49140
49194
|
}
|
|
49141
49195
|
if (removed) {
|
|
49142
49196
|
try {
|
|
@@ -49215,6 +49269,7 @@ var init_router = __esm({
|
|
|
49215
49269
|
policy: { ...sourceNode.policy || {} }
|
|
49216
49270
|
});
|
|
49217
49271
|
if (!node) return { success: false, error: "Failed to register worktree node" };
|
|
49272
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
49218
49273
|
}
|
|
49219
49274
|
const initSubmodules = sourceNode.policy?.initSubmodulesOnClone !== false;
|
|
49220
49275
|
if (initSubmodules) {
|
|
@@ -49599,6 +49654,12 @@ ${block}`);
|
|
|
49599
49654
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
49600
49655
|
const mesh = meshRecord?.mesh;
|
|
49601
49656
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
49657
|
+
const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
|
|
49658
|
+
if (!refreshRequested) {
|
|
49659
|
+
const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
|
|
49660
|
+
if (cachedStatus) return cachedStatus;
|
|
49661
|
+
}
|
|
49662
|
+
const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
|
|
49602
49663
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
49603
49664
|
const queue = getQueue2(meshId);
|
|
49604
49665
|
const queueSummary = getMeshQueueStats2(meshId);
|
|
@@ -49822,13 +49883,13 @@ ${block}`);
|
|
|
49822
49883
|
finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
|
|
49823
49884
|
nodeStatuses.push(status);
|
|
49824
49885
|
}
|
|
49825
|
-
|
|
49886
|
+
const statusResult = {
|
|
49826
49887
|
success: true,
|
|
49827
49888
|
meshId: mesh.id,
|
|
49828
49889
|
meshName: mesh.name,
|
|
49829
49890
|
repoIdentity: mesh.repoIdentity,
|
|
49830
49891
|
defaultBranch: mesh.defaultBranch,
|
|
49831
|
-
refreshedAt
|
|
49892
|
+
refreshedAt,
|
|
49832
49893
|
sourceOfTruth: {
|
|
49833
49894
|
membership: meshRecord?.source === "inline_cache" ? "coordinator_inline_mesh_cache" : meshRecord?.source === "local_config" ? "local_mesh_config" : "inline_bootstrap_snapshot",
|
|
49834
49895
|
coordinatorOwnsLiveTruth: directTruthSatisfied,
|
|
@@ -49850,6 +49911,7 @@ ${block}`);
|
|
|
49850
49911
|
queue: { tasks: queue, summary: queueSummary },
|
|
49851
49912
|
ledger: { entries: ledgerEntries, summary: ledgerSummary }
|
|
49852
49913
|
};
|
|
49914
|
+
return this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
|
|
49853
49915
|
} catch (e) {
|
|
49854
49916
|
return { success: false, error: e.message };
|
|
49855
49917
|
}
|
|
@@ -99001,7 +99063,7 @@ var init_adhdev_daemon = __esm({
|
|
|
99001
99063
|
init_version();
|
|
99002
99064
|
init_src();
|
|
99003
99065
|
init_runtime_defaults();
|
|
99004
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
99066
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.40" });
|
|
99005
99067
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
99006
99068
|
localHttpServer = null;
|
|
99007
99069
|
localWss = null;
|