@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
|
@@ -203,6 +203,29 @@ export declare class DaemonCommandRouter {
|
|
|
203
203
|
private requireMeshHostMutationOwner;
|
|
204
204
|
private updateInlineMeshNode;
|
|
205
205
|
private removeInlineMeshNode;
|
|
206
|
+
/**
|
|
207
|
+
* WORKTREE-BOOTSTRAP-COORD-STATE: mark a worktree node's bootstrap as reaching a
|
|
208
|
+
* terminal state (complete / failed) in THIS daemon's mesh view.
|
|
209
|
+
*
|
|
210
|
+
* Root cause this fixes: clone_mesh_node forwards the clone+bootstrap to the
|
|
211
|
+
* source node's daemon (the worktree's machine). persistWorktreeSetupState
|
|
212
|
+
* therefore flips worktreeBootstrap.status to 'complete' on the WORKER daemon's
|
|
213
|
+
* mesh object — never on the coordinator's. The coordinator only ever holds the
|
|
214
|
+
* 'running' state it stamped from the forwarded clone reply. The claim path's
|
|
215
|
+
* bootstrap gate (mesh-event-forwarding agent:ready / mesh-queue-assignment)
|
|
216
|
+
* reads the coordinator's mesh via getMeshWithCache, sees status==='running'
|
|
217
|
+
* forever, and DEFERS every claim — so the worktree_bootstrap_complete re-fire
|
|
218
|
+
* (triggerMeshQueue) loops against a gate that never opens: claim never lands,
|
|
219
|
+
* the idle session is re-registered each tick, and auto-launch keeps spawning
|
|
220
|
+
* fresh sessions (runaway worktree-session multiplication).
|
|
221
|
+
*
|
|
222
|
+
* Called from the worktree_bootstrap_complete/_failed event handler BEFORE the
|
|
223
|
+
* queue re-fire so the gate sees the terminal state and the deferred claim can
|
|
224
|
+
* finally land. Updates the inline cache (clone worktree nodes are inline-only)
|
|
225
|
+
* and, when the node also exists in local config, persists there too; both paths
|
|
226
|
+
* invalidate the aggregate status cache. Best-effort and idempotent.
|
|
227
|
+
*/
|
|
228
|
+
markWorktreeBootstrapTerminalState(meshId: string, nodeId: string, status: 'complete' | 'failed'): void;
|
|
206
229
|
private tombstoneRemovedInlineMeshNode;
|
|
207
230
|
/** Filter an incoming inline mesh against this mesh's tombstones before it is
|
|
208
231
|
* reconciled into the cache. A tombstoned node is dropped only while its
|
package/dist/index.js
CHANGED
|
@@ -383,10 +383,10 @@ function readInjected(value) {
|
|
|
383
383
|
}
|
|
384
384
|
function getDaemonBuildInfo() {
|
|
385
385
|
if (cached) return cached;
|
|
386
|
-
const commit = readInjected(true ? "
|
|
387
|
-
const commitShort = readInjected(true ? "
|
|
388
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
389
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
386
|
+
const commit = readInjected(true ? "a572a9e7fe0e92e33a309d89e35299ad42aa407d" : void 0) ?? "unknown";
|
|
387
|
+
const commitShort = readInjected(true ? "a572a9e7" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
388
|
+
const version = readInjected(true ? "0.9.82-rc.398" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
389
|
+
const builtAt = readInjected(true ? "2026-06-27T09:05:08.687Z" : void 0);
|
|
390
390
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
391
391
|
return cached;
|
|
392
392
|
}
|
|
@@ -14672,6 +14672,18 @@ function injectMeshSystemMessage(components, args) {
|
|
|
14672
14672
|
completedTaskForLedger = markSessionTerminal(sessionId, "failed");
|
|
14673
14673
|
}
|
|
14674
14674
|
} else if (args.event === "worktree_bootstrap_complete" || args.event === "worktree_bootstrap_failed") {
|
|
14675
|
+
const bootstrapNodeId = readNonEmptyString2(args.nodeId) || readNonEmptyString2(args.metadataEvent.meshNodeId);
|
|
14676
|
+
if (bootstrapNodeId) {
|
|
14677
|
+
try {
|
|
14678
|
+
components.router?.markWorktreeBootstrapTerminalState?.(
|
|
14679
|
+
args.meshId,
|
|
14680
|
+
bootstrapNodeId,
|
|
14681
|
+
args.event === "worktree_bootstrap_failed" ? "failed" : "complete"
|
|
14682
|
+
);
|
|
14683
|
+
} catch (e) {
|
|
14684
|
+
LOG.warn("MeshQueue", `Failed to stamp terminal bootstrap state for ${bootstrapNodeId} (mesh ${args.meshId}): ${e?.message || e}`);
|
|
14685
|
+
}
|
|
14686
|
+
}
|
|
14675
14687
|
setImmediate(() => {
|
|
14676
14688
|
triggerMeshQueue(components, args.meshId).catch((e) => {
|
|
14677
14689
|
LOG.warn("MeshQueue", `Queue re-fire after ${args.event} failed (mesh ${args.meshId}): ${e?.message || e}`);
|
|
@@ -53061,6 +53073,64 @@ var DaemonCommandRouter = class {
|
|
|
53061
53073
|
this.invalidateAggregateMeshStatus(meshId);
|
|
53062
53074
|
return true;
|
|
53063
53075
|
}
|
|
53076
|
+
/**
|
|
53077
|
+
* WORKTREE-BOOTSTRAP-COORD-STATE: mark a worktree node's bootstrap as reaching a
|
|
53078
|
+
* terminal state (complete / failed) in THIS daemon's mesh view.
|
|
53079
|
+
*
|
|
53080
|
+
* Root cause this fixes: clone_mesh_node forwards the clone+bootstrap to the
|
|
53081
|
+
* source node's daemon (the worktree's machine). persistWorktreeSetupState
|
|
53082
|
+
* therefore flips worktreeBootstrap.status to 'complete' on the WORKER daemon's
|
|
53083
|
+
* mesh object — never on the coordinator's. The coordinator only ever holds the
|
|
53084
|
+
* 'running' state it stamped from the forwarded clone reply. The claim path's
|
|
53085
|
+
* bootstrap gate (mesh-event-forwarding agent:ready / mesh-queue-assignment)
|
|
53086
|
+
* reads the coordinator's mesh via getMeshWithCache, sees status==='running'
|
|
53087
|
+
* forever, and DEFERS every claim — so the worktree_bootstrap_complete re-fire
|
|
53088
|
+
* (triggerMeshQueue) loops against a gate that never opens: claim never lands,
|
|
53089
|
+
* the idle session is re-registered each tick, and auto-launch keeps spawning
|
|
53090
|
+
* fresh sessions (runaway worktree-session multiplication).
|
|
53091
|
+
*
|
|
53092
|
+
* Called from the worktree_bootstrap_complete/_failed event handler BEFORE the
|
|
53093
|
+
* queue re-fire so the gate sees the terminal state and the deferred claim can
|
|
53094
|
+
* finally land. Updates the inline cache (clone worktree nodes are inline-only)
|
|
53095
|
+
* and, when the node also exists in local config, persists there too; both paths
|
|
53096
|
+
* invalidate the aggregate status cache. Best-effort and idempotent.
|
|
53097
|
+
*/
|
|
53098
|
+
markWorktreeBootstrapTerminalState(meshId, nodeId, status) {
|
|
53099
|
+
if (!meshId || !nodeId) return;
|
|
53100
|
+
const stamp = (mesh) => {
|
|
53101
|
+
if (!mesh || !Array.isArray(mesh.nodes)) return false;
|
|
53102
|
+
const node = mesh.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
|
|
53103
|
+
if (!node) return false;
|
|
53104
|
+
const prev = node.worktreeBootstrap && typeof node.worktreeBootstrap === "object" ? node.worktreeBootstrap : {};
|
|
53105
|
+
if (prev.status === status) return false;
|
|
53106
|
+
node.worktreeBootstrap = {
|
|
53107
|
+
...prev,
|
|
53108
|
+
status,
|
|
53109
|
+
completedAt: prev.completedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
53110
|
+
};
|
|
53111
|
+
return true;
|
|
53112
|
+
};
|
|
53113
|
+
let changed = false;
|
|
53114
|
+
try {
|
|
53115
|
+
const cached3 = this.getCachedInlineMesh(meshId);
|
|
53116
|
+
if (cached3 && stamp(cached3)) {
|
|
53117
|
+
cached3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
53118
|
+
this.inlineMeshCache.set(meshId, cached3);
|
|
53119
|
+
changed = true;
|
|
53120
|
+
}
|
|
53121
|
+
} catch {
|
|
53122
|
+
}
|
|
53123
|
+
if (changed) this.invalidateAggregateMeshStatus(meshId);
|
|
53124
|
+
void Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports)).then(({ getMesh: getMesh2, updateNode: updateNode2 }) => {
|
|
53125
|
+
const local = getMesh2(meshId);
|
|
53126
|
+
if (local && stamp(local)) {
|
|
53127
|
+
const node = local.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
|
|
53128
|
+
if (node) updateNode2(meshId, node.id, { worktreeBootstrap: node.worktreeBootstrap });
|
|
53129
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
53130
|
+
}
|
|
53131
|
+
}).catch(() => {
|
|
53132
|
+
});
|
|
53133
|
+
}
|
|
53064
53134
|
tombstoneRemovedInlineMeshNode(meshId, nodeId) {
|
|
53065
53135
|
if (!nodeId) return;
|
|
53066
53136
|
let set = this.removedInlineMeshNodeIds.get(meshId);
|