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/index.js
CHANGED
|
@@ -46616,9 +46616,56 @@ var init_router = __esm({
|
|
|
46616
46616
|
* Allows the MCP server to query mesh data via get_mesh even when
|
|
46617
46617
|
* the mesh doesn't exist in the local meshes.json file. */
|
|
46618
46618
|
inlineMeshCache = /* @__PURE__ */ new Map();
|
|
46619
|
+
/** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default. */
|
|
46620
|
+
aggregateMeshStatusCache = /* @__PURE__ */ new Map();
|
|
46619
46621
|
constructor(deps) {
|
|
46620
46622
|
this.deps = deps;
|
|
46621
46623
|
}
|
|
46624
|
+
cloneJsonValue(value) {
|
|
46625
|
+
if (typeof structuredClone === "function") return structuredClone(value);
|
|
46626
|
+
return JSON.parse(JSON.stringify(value));
|
|
46627
|
+
}
|
|
46628
|
+
getCachedAggregateMeshStatus(meshId) {
|
|
46629
|
+
const cached2 = this.aggregateMeshStatusCache.get(meshId);
|
|
46630
|
+
if (!cached2?.snapshot || cached2.snapshot.success !== true || !Array.isArray(cached2.snapshot.nodes)) return null;
|
|
46631
|
+
const snapshot = this.cloneJsonValue(cached2.snapshot);
|
|
46632
|
+
const ageMs = Math.max(0, Date.now() - cached2.builtAt);
|
|
46633
|
+
const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
|
|
46634
|
+
snapshot.sourceOfTruth = {
|
|
46635
|
+
...sourceOfTruth,
|
|
46636
|
+
aggregateSnapshot: {
|
|
46637
|
+
...sourceOfTruth.aggregateSnapshot && typeof sourceOfTruth.aggregateSnapshot === "object" ? sourceOfTruth.aggregateSnapshot : {},
|
|
46638
|
+
owner: "coordinator_daemon_memory",
|
|
46639
|
+
cached: true,
|
|
46640
|
+
source: "memory",
|
|
46641
|
+
refreshReason: "memory_cache_hit",
|
|
46642
|
+
ageMs,
|
|
46643
|
+
cachedAt: new Date(cached2.builtAt).toISOString(),
|
|
46644
|
+
returnedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
46645
|
+
}
|
|
46646
|
+
};
|
|
46647
|
+
return snapshot;
|
|
46648
|
+
}
|
|
46649
|
+
rememberAggregateMeshStatus(meshId, snapshot, refreshReason) {
|
|
46650
|
+
if (!snapshot || typeof snapshot !== "object" || snapshot.success !== true || !Array.isArray(snapshot.nodes)) return snapshot;
|
|
46651
|
+
const builtAt = Date.now();
|
|
46652
|
+
const next = this.cloneJsonValue(snapshot);
|
|
46653
|
+
const sourceOfTruth = next.sourceOfTruth && typeof next.sourceOfTruth === "object" ? next.sourceOfTruth : {};
|
|
46654
|
+
next.sourceOfTruth = {
|
|
46655
|
+
...sourceOfTruth,
|
|
46656
|
+
aggregateSnapshot: {
|
|
46657
|
+
owner: "coordinator_daemon_memory",
|
|
46658
|
+
cached: false,
|
|
46659
|
+
source: "live_refresh",
|
|
46660
|
+
refreshReason,
|
|
46661
|
+
ageMs: 0,
|
|
46662
|
+
cachedAt: new Date(builtAt).toISOString(),
|
|
46663
|
+
returnedAt: new Date(builtAt).toISOString()
|
|
46664
|
+
}
|
|
46665
|
+
};
|
|
46666
|
+
this.aggregateMeshStatusCache.set(meshId, { builtAt, snapshot: this.cloneJsonValue(next) });
|
|
46667
|
+
return next;
|
|
46668
|
+
}
|
|
46622
46669
|
getCachedInlineMesh(meshId, inlineMesh) {
|
|
46623
46670
|
if (inlineMesh && typeof inlineMesh === "object") {
|
|
46624
46671
|
return this.warmInlineMeshCache(meshId, inlineMesh);
|
|
@@ -46658,6 +46705,9 @@ var init_router = __esm({
|
|
|
46658
46705
|
const warmedInline = this.warmInlineMeshCache(meshId, inlineMesh);
|
|
46659
46706
|
return warmedInline ? { mesh: warmedInline, inline: true, source: "inline_bootstrap" } : null;
|
|
46660
46707
|
}
|
|
46708
|
+
invalidateAggregateMeshStatus(meshId) {
|
|
46709
|
+
this.aggregateMeshStatusCache.delete(meshId);
|
|
46710
|
+
}
|
|
46661
46711
|
updateInlineMeshNode(meshId, mesh, node) {
|
|
46662
46712
|
if (!mesh || !Array.isArray(mesh.nodes) || !node?.id) return;
|
|
46663
46713
|
const idx = mesh.nodes.findIndex((entry) => entry?.id === node.id || entry?.nodeId === node.id);
|
|
@@ -46665,6 +46715,7 @@ var init_router = __esm({
|
|
|
46665
46715
|
else mesh.nodes.push(node);
|
|
46666
46716
|
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
46667
46717
|
this.inlineMeshCache.set(meshId, mesh);
|
|
46718
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
46668
46719
|
}
|
|
46669
46720
|
removeInlineMeshNode(meshId, mesh, nodeId) {
|
|
46670
46721
|
if (!mesh || !Array.isArray(mesh.nodes)) return false;
|
|
@@ -46673,6 +46724,7 @@ var init_router = __esm({
|
|
|
46673
46724
|
mesh.nodes.splice(idx, 1);
|
|
46674
46725
|
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
46675
46726
|
this.inlineMeshCache.set(meshId, mesh);
|
|
46727
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
46676
46728
|
return true;
|
|
46677
46729
|
}
|
|
46678
46730
|
normalizeMeshSessionCleanupMode(value) {
|
|
@@ -47714,6 +47766,7 @@ var init_router = __esm({
|
|
|
47714
47766
|
const mesh = updateMesh2(meshId, patch);
|
|
47715
47767
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
47716
47768
|
this.inlineMeshCache.set(meshId, mesh);
|
|
47769
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
47717
47770
|
return { success: true, mesh };
|
|
47718
47771
|
} catch (e) {
|
|
47719
47772
|
return { success: false, error: e.message };
|
|
@@ -48149,6 +48202,7 @@ var init_router = __esm({
|
|
|
48149
48202
|
} else {
|
|
48150
48203
|
const { removeNode: removeNode3 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
48151
48204
|
removed = removeNode3(meshId, nodeId);
|
|
48205
|
+
if (removed) this.invalidateAggregateMeshStatus(meshId);
|
|
48152
48206
|
}
|
|
48153
48207
|
if (removed) {
|
|
48154
48208
|
try {
|
|
@@ -48227,6 +48281,7 @@ var init_router = __esm({
|
|
|
48227
48281
|
policy: { ...sourceNode.policy || {} }
|
|
48228
48282
|
});
|
|
48229
48283
|
if (!node) return { success: false, error: "Failed to register worktree node" };
|
|
48284
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
48230
48285
|
}
|
|
48231
48286
|
const initSubmodules = sourceNode.policy?.initSubmodulesOnClone !== false;
|
|
48232
48287
|
if (initSubmodules) {
|
|
@@ -48611,6 +48666,12 @@ ${block}`);
|
|
|
48611
48666
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
48612
48667
|
const mesh = meshRecord?.mesh;
|
|
48613
48668
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
48669
|
+
const refreshRequested = args?.refresh === true || args?.forceRefresh === true;
|
|
48670
|
+
if (!refreshRequested) {
|
|
48671
|
+
const cachedStatus = this.getCachedAggregateMeshStatus(meshId);
|
|
48672
|
+
if (cachedStatus) return cachedStatus;
|
|
48673
|
+
}
|
|
48674
|
+
const refreshReason = refreshRequested ? "explicit_refresh" : "cold_cache_miss";
|
|
48614
48675
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
48615
48676
|
const queue = getQueue2(meshId);
|
|
48616
48677
|
const queueSummary = getMeshQueueStats2(meshId);
|
|
@@ -48834,13 +48895,13 @@ ${block}`);
|
|
|
48834
48895
|
finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode });
|
|
48835
48896
|
nodeStatuses.push(status);
|
|
48836
48897
|
}
|
|
48837
|
-
|
|
48898
|
+
const statusResult = {
|
|
48838
48899
|
success: true,
|
|
48839
48900
|
meshId: mesh.id,
|
|
48840
48901
|
meshName: mesh.name,
|
|
48841
48902
|
repoIdentity: mesh.repoIdentity,
|
|
48842
48903
|
defaultBranch: mesh.defaultBranch,
|
|
48843
|
-
refreshedAt
|
|
48904
|
+
refreshedAt,
|
|
48844
48905
|
sourceOfTruth: {
|
|
48845
48906
|
membership: meshRecord?.source === "inline_cache" ? "coordinator_inline_mesh_cache" : meshRecord?.source === "local_config" ? "local_mesh_config" : "inline_bootstrap_snapshot",
|
|
48846
48907
|
coordinatorOwnsLiveTruth: directTruthSatisfied,
|
|
@@ -48862,6 +48923,7 @@ ${block}`);
|
|
|
48862
48923
|
queue: { tasks: queue, summary: queueSummary },
|
|
48863
48924
|
ledger: { entries: ledgerEntries, summary: ledgerSummary }
|
|
48864
48925
|
};
|
|
48926
|
+
return this.rememberAggregateMeshStatus(meshId, statusResult, refreshReason);
|
|
48865
48927
|
} catch (e) {
|
|
48866
48928
|
return { success: false, error: e.message };
|
|
48867
48929
|
}
|
|
@@ -67828,7 +67890,7 @@ var init_adhdev_daemon = __esm({
|
|
|
67828
67890
|
init_version();
|
|
67829
67891
|
init_src();
|
|
67830
67892
|
init_runtime_defaults();
|
|
67831
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
67893
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.40" });
|
|
67832
67894
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
67833
67895
|
localHttpServer = null;
|
|
67834
67896
|
localWss = null;
|