@adhdev/daemon-core 0.9.82-rc.397 → 0.9.82-rc.399
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 +76 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +76 -5
- 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/src/providers/cli-provider-instance.ts +29 -2
|
@@ -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 ? "a77fca338e386be4785dcfb7e765826155817728" : void 0) ?? "unknown";
|
|
387
|
+
const commitShort = readInjected(true ? "a77fca33" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
388
|
+
const version = readInjected(true ? "0.9.82-rc.399" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
389
|
+
const builtAt = readInjected(true ? "2026-06-27T10:12:40.786Z" : 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}`);
|
|
@@ -40390,7 +40402,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
40390
40402
|
const previousStatus = this.lastStatus;
|
|
40391
40403
|
if (newStatus !== this.lastStatus) {
|
|
40392
40404
|
LOG.info("CLI", `[${this.type}] status: ${this.lastStatus} \u2192 ${newStatus}`);
|
|
40393
|
-
|
|
40405
|
+
const startingToGeneratingWithActiveTurn = this.lastStatus === "starting" && newStatus === "generating" && this.hasAdapterPendingResponse();
|
|
40406
|
+
if (this.lastStatus === "idle" && newStatus === "generating" || startingToGeneratingWithActiveTurn) {
|
|
40394
40407
|
if (this.completedDebouncePending && this.generatingStartedAt === 0) {
|
|
40395
40408
|
LOG.debug("CLI", `[${this.type}] ignoring post-completion PTY generating blip (generatingStartedAt=0)`);
|
|
40396
40409
|
return;
|
|
@@ -53061,6 +53074,64 @@ var DaemonCommandRouter = class {
|
|
|
53061
53074
|
this.invalidateAggregateMeshStatus(meshId);
|
|
53062
53075
|
return true;
|
|
53063
53076
|
}
|
|
53077
|
+
/**
|
|
53078
|
+
* WORKTREE-BOOTSTRAP-COORD-STATE: mark a worktree node's bootstrap as reaching a
|
|
53079
|
+
* terminal state (complete / failed) in THIS daemon's mesh view.
|
|
53080
|
+
*
|
|
53081
|
+
* Root cause this fixes: clone_mesh_node forwards the clone+bootstrap to the
|
|
53082
|
+
* source node's daemon (the worktree's machine). persistWorktreeSetupState
|
|
53083
|
+
* therefore flips worktreeBootstrap.status to 'complete' on the WORKER daemon's
|
|
53084
|
+
* mesh object — never on the coordinator's. The coordinator only ever holds the
|
|
53085
|
+
* 'running' state it stamped from the forwarded clone reply. The claim path's
|
|
53086
|
+
* bootstrap gate (mesh-event-forwarding agent:ready / mesh-queue-assignment)
|
|
53087
|
+
* reads the coordinator's mesh via getMeshWithCache, sees status==='running'
|
|
53088
|
+
* forever, and DEFERS every claim — so the worktree_bootstrap_complete re-fire
|
|
53089
|
+
* (triggerMeshQueue) loops against a gate that never opens: claim never lands,
|
|
53090
|
+
* the idle session is re-registered each tick, and auto-launch keeps spawning
|
|
53091
|
+
* fresh sessions (runaway worktree-session multiplication).
|
|
53092
|
+
*
|
|
53093
|
+
* Called from the worktree_bootstrap_complete/_failed event handler BEFORE the
|
|
53094
|
+
* queue re-fire so the gate sees the terminal state and the deferred claim can
|
|
53095
|
+
* finally land. Updates the inline cache (clone worktree nodes are inline-only)
|
|
53096
|
+
* and, when the node also exists in local config, persists there too; both paths
|
|
53097
|
+
* invalidate the aggregate status cache. Best-effort and idempotent.
|
|
53098
|
+
*/
|
|
53099
|
+
markWorktreeBootstrapTerminalState(meshId, nodeId, status) {
|
|
53100
|
+
if (!meshId || !nodeId) return;
|
|
53101
|
+
const stamp = (mesh) => {
|
|
53102
|
+
if (!mesh || !Array.isArray(mesh.nodes)) return false;
|
|
53103
|
+
const node = mesh.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
|
|
53104
|
+
if (!node) return false;
|
|
53105
|
+
const prev = node.worktreeBootstrap && typeof node.worktreeBootstrap === "object" ? node.worktreeBootstrap : {};
|
|
53106
|
+
if (prev.status === status) return false;
|
|
53107
|
+
node.worktreeBootstrap = {
|
|
53108
|
+
...prev,
|
|
53109
|
+
status,
|
|
53110
|
+
completedAt: prev.completedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
53111
|
+
};
|
|
53112
|
+
return true;
|
|
53113
|
+
};
|
|
53114
|
+
let changed = false;
|
|
53115
|
+
try {
|
|
53116
|
+
const cached3 = this.getCachedInlineMesh(meshId);
|
|
53117
|
+
if (cached3 && stamp(cached3)) {
|
|
53118
|
+
cached3.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
53119
|
+
this.inlineMeshCache.set(meshId, cached3);
|
|
53120
|
+
changed = true;
|
|
53121
|
+
}
|
|
53122
|
+
} catch {
|
|
53123
|
+
}
|
|
53124
|
+
if (changed) this.invalidateAggregateMeshStatus(meshId);
|
|
53125
|
+
void Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports)).then(({ getMesh: getMesh2, updateNode: updateNode2 }) => {
|
|
53126
|
+
const local = getMesh2(meshId);
|
|
53127
|
+
if (local && stamp(local)) {
|
|
53128
|
+
const node = local.nodes.find((entry) => meshNodeIdMatches(entry, nodeId));
|
|
53129
|
+
if (node) updateNode2(meshId, node.id, { worktreeBootstrap: node.worktreeBootstrap });
|
|
53130
|
+
this.invalidateAggregateMeshStatus(meshId);
|
|
53131
|
+
}
|
|
53132
|
+
}).catch(() => {
|
|
53133
|
+
});
|
|
53134
|
+
}
|
|
53064
53135
|
tombstoneRemovedInlineMeshNode(meshId, nodeId) {
|
|
53065
53136
|
if (!nodeId) return;
|
|
53066
53137
|
let set = this.removedInlineMeshNodeIds.get(meshId);
|