@adhdev/daemon-core 0.9.82-rc.397 → 0.9.82-rc.398
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/commands/router.d.ts +23 -0
- package/dist/index.js +74 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/router.ts +66 -0
- package/src/mesh/mesh-event-forwarding.ts +23 -0
package/dist/index.mjs
CHANGED
|
@@ -378,10 +378,10 @@ function readInjected(value) {
|
|
|
378
378
|
}
|
|
379
379
|
function getDaemonBuildInfo() {
|
|
380
380
|
if (cached) return cached;
|
|
381
|
-
const commit = readInjected(true ? "
|
|
382
|
-
const commitShort = readInjected(true ? "
|
|
383
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
384
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
381
|
+
const commit = readInjected(true ? "a572a9e7fe0e92e33a309d89e35299ad42aa407d" : void 0) ?? "unknown";
|
|
382
|
+
const commitShort = readInjected(true ? "a572a9e7" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
383
|
+
const version = readInjected(true ? "0.9.82-rc.398" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
384
|
+
const builtAt = readInjected(true ? "2026-06-27T09:05:08.687Z" : void 0);
|
|
385
385
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
386
386
|
return cached;
|
|
387
387
|
}
|
|
@@ -14667,6 +14667,18 @@ function injectMeshSystemMessage(components, args) {
|
|
|
14667
14667
|
completedTaskForLedger = markSessionTerminal(sessionId, "failed");
|
|
14668
14668
|
}
|
|
14669
14669
|
} else if (args.event === "worktree_bootstrap_complete" || args.event === "worktree_bootstrap_failed") {
|
|
14670
|
+
const bootstrapNodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
|
|
14671
|
+
if (bootstrapNodeId) {
|
|
14672
|
+
try {
|
|
14673
|
+
components.router?.markWorktreeBootstrapTerminalState?.(
|
|
14674
|
+
args.meshId,
|
|
14675
|
+
bootstrapNodeId,
|
|
14676
|
+
args.event === "worktree_bootstrap_failed" ? "failed" : "complete"
|
|
14677
|
+
);
|
|
14678
|
+
} catch (e) {
|
|
14679
|
+
LOG.warn("MeshQueue", `Failed to stamp terminal bootstrap state for ${bootstrapNodeId} (mesh ${args.meshId}): ${e?.message || e}`);
|
|
14680
|
+
}
|
|
14681
|
+
}
|
|
14670
14682
|
setImmediate(() => {
|
|
14671
14683
|
triggerMeshQueue(components, args.meshId).catch((e) => {
|
|
14672
14684
|
LOG.warn("MeshQueue", `Queue re-fire after ${args.event} failed (mesh ${args.meshId}): ${e?.message || e}`);
|
|
@@ -52685,6 +52697,64 @@ var DaemonCommandRouter = class {
|
|
|
52685
52697
|
this.invalidateAggregateMeshStatus(meshId);
|
|
52686
52698
|
return true;
|
|
52687
52699
|
}
|
|
52700
|
+
/**
|
|
52701
|
+
* WORKTREE-BOOTSTRAP-COORD-STATE: mark a worktree node's bootstrap as reaching a
|
|
52702
|
+
* terminal state (complete / failed) in THIS daemon's mesh view.
|
|
52703
|
+
*
|
|
52704
|
+
* Root cause this fixes: clone_mesh_node forwards the clone+bootstrap to the
|
|
52705
|
+
* source node's daemon (the worktree's machine). persistWorktreeSetupState
|
|
52706
|
+
* therefore flips worktreeBootstrap.status to 'complete' on the WORKER daemon's
|
|
52707
|
+
* mesh object — never on the coordinator's. The coordinator only ever holds the
|
|
52708
|
+
* 'running' state it stamped from the forwarded clone reply. The claim path's
|
|
52709
|
+
* bootstrap gate (mesh-event-forwarding agent:ready / mesh-queue-assignment)
|
|
52710
|
+
* reads the coordinator's mesh via getMeshWithCache, sees status==='running'
|
|
52711
|
+
* forever, and DEFERS every claim — so the worktree_bootstrap_complete re-fire
|
|
52712
|
+
* (triggerMeshQueue) loops against a gate that never opens: claim never lands,
|
|
52713
|
+
* the idle session is re-registered each tick, and auto-launch keeps spawning
|
|
52714
|
+
* fresh sessions (runaway worktree-session multiplication).
|
|
52715
|
+
*
|
|
52716
|
+
* Called from the worktree_bootstrap_complete/_failed event handler BEFORE the
|
|
52717
|
+
* queue re-fire so the gate sees the terminal state and the deferred claim can
|
|
52718
|
+
* finally land. Updates the inline cache (clone worktree nodes are inline-only)
|
|
52719
|
+
* and, when the node also exists in local config, persists there too; both paths
|
|
52720
|
+
* invalidate the aggregate status cache. Best-effort and idempotent.
|
|
52721
|
+
*/
|
|
52722
|
+
markWorktreeBootstrapTerminalState(meshId, nodeId, status) {
|
|
52723
|
+
if (!meshId || !nodeId) return;
|
|
52724
|
+
const stamp = (mesh) => {
|
|
52725
|
+
if (!mesh || !Array.isArray(mesh.nodes)) return false;
|
|
52726
|
+
const node = mesh.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
|
|
52727
|
+
if (!node) return false;
|
|
52728
|
+
const prev = node.worktreeBootstrap && typeof node.worktreeBootstrap === "object" ? node.worktreeBootstrap : {};
|
|
52729
|
+
if (prev.status === status) return false;
|
|
52730
|
+
node.worktreeBootstrap = {
|
|
52731
|
+
...prev,
|
|
52732
|
+
status,
|
|
52733
|
+
completedAt: prev.completedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
52734
|
+
};
|
|
52735
|
+
return true;
|
|
52736
|
+
};
|
|
52737
|
+
let changed = false;
|
|
52738
|
+
try {
|
|
52739
|
+
const cached3 = this.getCachedInlineMesh(meshId);
|
|
52740
|
+
if (cached3 && stamp(cached3)) {
|
|
52741
|
+
cached3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
52742
|
+
this.inlineMeshCache.set(meshId, cached3);
|
|
52743
|
+
changed = true;
|
|
52744
|
+
}
|
|
52745
|
+
} catch {
|
|
52746
|
+
}
|
|
52747
|
+
if (changed) this.invalidateAggregateMeshStatus(meshId);
|
|
52748
|
+
void Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports)).then(({ getMesh: getMesh2, updateNode: updateNode2 }) => {
|
|
52749
|
+
const local = getMesh2(meshId);
|
|
52750
|
+
if (local && stamp(local)) {
|
|
52751
|
+
const node = local.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
|
|
52752
|
+
if (node) updateNode2(meshId, node.id, { worktreeBootstrap: node.worktreeBootstrap });
|
|
52753
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
52754
|
+
}
|
|
52755
|
+
}).catch(() => {
|
|
52756
|
+
});
|
|
52757
|
+
}
|
|
52688
52758
|
tombstoneRemovedInlineMeshNode(meshId, nodeId) {
|
|
52689
52759
|
if (!nodeId) return;
|
|
52690
52760
|
let set = this.removedInlineMeshNodeIds.get(meshId);
|