@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.js
CHANGED
|
@@ -275,10 +275,10 @@ function readInjected(value) {
|
|
|
275
275
|
}
|
|
276
276
|
function getDaemonBuildInfo() {
|
|
277
277
|
if (cached) return cached;
|
|
278
|
-
const commit = readInjected(true ? "
|
|
279
|
-
const commitShort = readInjected(true ? "
|
|
280
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
281
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
278
|
+
const commit = readInjected(true ? "86c45b0edabd4e1088f6333c996142f0dfaa930b" : void 0) ?? "unknown";
|
|
279
|
+
const commitShort = readInjected(true ? "86c45b0e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
280
|
+
const version = readInjected(true ? "0.9.82-rc.299" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
281
|
+
const builtAt = readInjected(true ? "2026-06-16T19:56:20.514Z" : void 0);
|
|
282
282
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
283
283
|
return cached;
|
|
284
284
|
}
|
|
@@ -3659,11 +3659,30 @@ var init_mesh_runtime_store = __esm({
|
|
|
3659
3659
|
`).get(meshId, sessionId, nodeId);
|
|
3660
3660
|
return row !== void 0;
|
|
3661
3661
|
}
|
|
3662
|
+
/** A session may only execute one task at a time, regardless of task mode. */
|
|
3663
|
+
hasActiveSessionAssignment(meshId, sessionId) {
|
|
3664
|
+
const row = this.db.prepare(`
|
|
3665
|
+
SELECT 1 FROM mesh_queue
|
|
3666
|
+
WHERE mesh_id = ? AND status = 'assigned' AND assigned_session_id = ?
|
|
3667
|
+
LIMIT 1
|
|
3668
|
+
`).get(meshId, sessionId);
|
|
3669
|
+
return row !== void 0;
|
|
3670
|
+
}
|
|
3671
|
+
/** A node may only execute one write task at a time (worktree isolation). */
|
|
3672
|
+
hasActiveNodeAssignment(meshId, nodeId) {
|
|
3673
|
+
const row = this.db.prepare(`
|
|
3674
|
+
SELECT 1 FROM mesh_queue
|
|
3675
|
+
WHERE mesh_id = ? AND status = 'assigned' AND assigned_node_id = ?
|
|
3676
|
+
LIMIT 1
|
|
3677
|
+
`).get(meshId, nodeId);
|
|
3678
|
+
return row !== void 0;
|
|
3679
|
+
}
|
|
3662
3680
|
// O(1) claim: transaction ensures only one session claims a pending task
|
|
3663
3681
|
claimNextQueueTask(meshId, nodeId, sessionId, capabilityTags = []) {
|
|
3664
3682
|
return this.transaction(() => {
|
|
3665
3683
|
this.ensureLegacyQueueMigrated(meshId);
|
|
3666
|
-
if (this.
|
|
3684
|
+
if (this.hasActiveSessionAssignment(meshId, sessionId)) return null;
|
|
3685
|
+
const nodeBusy = this.hasActiveNodeAssignment(meshId, nodeId);
|
|
3667
3686
|
const rows = [
|
|
3668
3687
|
...this.db.prepare(`
|
|
3669
3688
|
SELECT payload FROM mesh_queue
|
|
@@ -3696,7 +3715,11 @@ var init_mesh_runtime_store = __esm({
|
|
|
3696
3715
|
const deps = Array.isArray(candidate.dependsOn) ? candidate.dependsOn : [];
|
|
3697
3716
|
return deps.every((depId) => depStatus.get(depId) === "completed");
|
|
3698
3717
|
};
|
|
3699
|
-
const
|
|
3718
|
+
const nodeConflictAllows = (candidate) => {
|
|
3719
|
+
if (candidate.taskMode === "live_debug_readonly") return true;
|
|
3720
|
+
return !nodeBusy;
|
|
3721
|
+
};
|
|
3722
|
+
const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && nodeConflictAllows(candidate));
|
|
3700
3723
|
if (!entry) return null;
|
|
3701
3724
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3702
3725
|
entry.status = "assigned";
|
|
@@ -8067,8 +8090,11 @@ function localAutoLaunchSkipReason(node) {
|
|
|
8067
8090
|
}
|
|
8068
8091
|
return null;
|
|
8069
8092
|
}
|
|
8070
|
-
function
|
|
8071
|
-
return getQueue(meshId, { status: ["assigned"] }).length;
|
|
8093
|
+
function activeWriteAssignedCount(meshId) {
|
|
8094
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.taskMode !== "live_debug_readonly").length;
|
|
8095
|
+
}
|
|
8096
|
+
function activeReadonlyAssignedCount(meshId) {
|
|
8097
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.taskMode === "live_debug_readonly").length;
|
|
8072
8098
|
}
|
|
8073
8099
|
function nodeHasActiveAssignment(meshId, nodeId) {
|
|
8074
8100
|
return getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedNodeId === nodeId);
|
|
@@ -8175,10 +8201,17 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
8175
8201
|
const pending = queue.filter((task) => task.status === "pending");
|
|
8176
8202
|
if (!pending.length) return false;
|
|
8177
8203
|
const maxParallelTasks = Math.max(1, Math.floor(Number(mesh?.policy?.maxParallelTasks) || 2));
|
|
8204
|
+
const maxReadonlyParallelTasks = Math.max(2, maxParallelTasks * 2);
|
|
8178
8205
|
for (const task of pending) {
|
|
8179
|
-
|
|
8206
|
+
const isReadonly = task.taskMode === "live_debug_readonly";
|
|
8207
|
+
if (isReadonly) {
|
|
8208
|
+
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
8209
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_readonly_parallel_tasks_reached" });
|
|
8210
|
+
continue;
|
|
8211
|
+
}
|
|
8212
|
+
} else if (activeWriteAssignedCount(meshId) >= maxParallelTasks) {
|
|
8180
8213
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_parallel_tasks_reached" });
|
|
8181
|
-
|
|
8214
|
+
continue;
|
|
8182
8215
|
}
|
|
8183
8216
|
if (task.targetSessionId) {
|
|
8184
8217
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "target_session_constraint" });
|
|
@@ -8227,7 +8260,7 @@ async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
|
8227
8260
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: localSkipReason, nodeId });
|
|
8228
8261
|
continue;
|
|
8229
8262
|
}
|
|
8230
|
-
if (nodeHasActiveAssignment(meshId, nodeId)) {
|
|
8263
|
+
if (task.taskMode !== "live_debug_readonly" && nodeHasActiveAssignment(meshId, nodeId)) {
|
|
8231
8264
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "node_has_active_assignment", nodeId });
|
|
8232
8265
|
continue;
|
|
8233
8266
|
}
|