@adhdev/daemon-core 0.9.82-rc.298 → 0.9.82-rc.299
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/index.js +44 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -11
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events-coordinator.d.ts +5 -0
- package/dist/mesh/mesh-runtime-store.d.ts +4 -0
- package/package.json +2 -2
- package/src/mesh/mesh-events-coordinator.ts +31 -3
- package/src/mesh/mesh-runtime-store.ts +37 -2
package/dist/index.mjs
CHANGED
|
@@ -270,10 +270,10 @@ function readInjected(value) {
|
|
|
270
270
|
}
|
|
271
271
|
function getDaemonBuildInfo() {
|
|
272
272
|
if (cached) return cached;
|
|
273
|
-
const commit = readInjected(true ? "
|
|
274
|
-
const commitShort = readInjected(true ? "
|
|
275
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
276
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
273
|
+
const commit = readInjected(true ? "86c45b0edabd4e1088f6333c996142f0dfaa930b" : void 0) ?? "unknown";
|
|
274
|
+
const commitShort = readInjected(true ? "86c45b0e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
275
|
+
const version = readInjected(true ? "0.9.82-rc.299" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
276
|
+
const builtAt = readInjected(true ? "2026-06-16T19:56:20.514Z" : void 0);
|
|
277
277
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
278
278
|
return cached;
|
|
279
279
|
}
|
|
@@ -3653,11 +3653,30 @@ var init_mesh_runtime_store = __esm({
|
|
|
3653
3653
|
`).get(meshId, sessionId, nodeId);
|
|
3654
3654
|
return row !== void 0;
|
|
3655
3655
|
}
|
|
3656
|
+
/** A session may only execute one task at a time, regardless of task mode. */
|
|
3657
|
+
hasActiveSessionAssignment(meshId, sessionId) {
|
|
3658
|
+
const row = this.db.prepare(`
|
|
3659
|
+
SELECT 1 FROM mesh_queue
|
|
3660
|
+
WHERE mesh_id = ? AND status = 'assigned' AND assigned_session_id = ?
|
|
3661
|
+
LIMIT 1
|
|
3662
|
+
`).get(meshId, sessionId);
|
|
3663
|
+
return row !== void 0;
|
|
3664
|
+
}
|
|
3665
|
+
/** A node may only execute one write task at a time (worktree isolation). */
|
|
3666
|
+
hasActiveNodeAssignment(meshId, nodeId) {
|
|
3667
|
+
const row = this.db.prepare(`
|
|
3668
|
+
SELECT 1 FROM mesh_queue
|
|
3669
|
+
WHERE mesh_id = ? AND status = 'assigned' AND assigned_node_id = ?
|
|
3670
|
+
LIMIT 1
|
|
3671
|
+
`).get(meshId, nodeId);
|
|
3672
|
+
return row !== void 0;
|
|
3673
|
+
}
|
|
3656
3674
|
// O(1) claim: transaction ensures only one session claims a pending task
|
|
3657
3675
|
claimNextQueueTask(meshId, nodeId, sessionId, capabilityTags = []) {
|
|
3658
3676
|
return this.transaction(() => {
|
|
3659
3677
|
this.ensureLegacyQueueMigrated(meshId);
|
|
3660
|
-
if (this.
|
|
3678
|
+
if (this.hasActiveSessionAssignment(meshId, sessionId)) return null;
|
|
3679
|
+
const nodeBusy = this.hasActiveNodeAssignment(meshId, nodeId);
|
|
3661
3680
|
const rows = [
|
|
3662
3681
|
...this.db.prepare(`
|
|
3663
3682
|
SELECT payload FROM mesh_queue
|
|
@@ -3690,7 +3709,11 @@ var init_mesh_runtime_store = __esm({
|
|
|
3690
3709
|
const deps = Array.isArray(candidate.dependsOn) ? candidate.dependsOn : [];
|
|
3691
3710
|
return deps.every((depId) => depStatus.get(depId) === "completed");
|
|
3692
3711
|
};
|
|
3693
|
-
const
|
|
3712
|
+
const nodeConflictAllows = (candidate) => {
|
|
3713
|
+
if (candidate.taskMode === "live_debug_readonly") return true;
|
|
3714
|
+
return !nodeBusy;
|
|
3715
|
+
};
|
|
3716
|
+
const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && nodeConflictAllows(candidate));
|
|
3694
3717
|
if (!entry) return null;
|
|
3695
3718
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3696
3719
|
entry.status = "assigned";
|
|
@@ -8061,8 +8084,11 @@ function localAutoLaunchSkipReason(node) {
|
|
|
8061
8084
|
}
|
|
8062
8085
|
return null;
|
|
8063
8086
|
}
|
|
8064
|
-
function
|
|
8065
|
-
return getQueue(meshId, { status: ["assigned"] }).length;
|
|
8087
|
+
function activeWriteAssignedCount(meshId) {
|
|
8088
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.taskMode !== "live_debug_readonly").length;
|
|
8089
|
+
}
|
|
8090
|
+
function activeReadonlyAssignedCount(meshId) {
|
|
8091
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.taskMode === "live_debug_readonly").length;
|
|
8066
8092
|
}
|
|
8067
8093
|
function nodeHasActiveAssignment(meshId, nodeId) {
|
|
8068
8094
|
return getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedNodeId === nodeId);
|
|
@@ -8169,10 +8195,17 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
8169
8195
|
const pending = queue.filter((task) => task.status === "pending");
|
|
8170
8196
|
if (!pending.length) return false;
|
|
8171
8197
|
const maxParallelTasks = Math.max(1, Math.floor(Number(mesh?.policy?.maxParallelTasks) || 2));
|
|
8198
|
+
const maxReadonlyParallelTasks = Math.max(2, maxParallelTasks * 2);
|
|
8172
8199
|
for (const task of pending) {
|
|
8173
|
-
|
|
8200
|
+
const isReadonly = task.taskMode === "live_debug_readonly";
|
|
8201
|
+
if (isReadonly) {
|
|
8202
|
+
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
8203
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_readonly_parallel_tasks_reached" });
|
|
8204
|
+
continue;
|
|
8205
|
+
}
|
|
8206
|
+
} else if (activeWriteAssignedCount(meshId) >= maxParallelTasks) {
|
|
8174
8207
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_parallel_tasks_reached" });
|
|
8175
|
-
|
|
8208
|
+
continue;
|
|
8176
8209
|
}
|
|
8177
8210
|
if (task.targetSessionId) {
|
|
8178
8211
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "target_session_constraint" });
|
|
@@ -8221,7 +8254,7 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
8221
8254
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: localSkipReason, nodeId });
|
|
8222
8255
|
continue;
|
|
8223
8256
|
}
|
|
8224
|
-
if (nodeHasActiveAssignment(meshId, nodeId)) {
|
|
8257
|
+
if (task.taskMode !== "live_debug_readonly" && nodeHasActiveAssignment(meshId, nodeId)) {
|
|
8225
8258
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "node_has_active_assignment", nodeId });
|
|
8226
8259
|
continue;
|
|
8227
8260
|
}
|