@adhdev/daemon-standalone 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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29983,10 +29983,10 @@ var require_dist3 = __commonJS({
|
|
|
29983
29983
|
}
|
|
29984
29984
|
function getDaemonBuildInfo() {
|
|
29985
29985
|
if (cached2) return cached2;
|
|
29986
|
-
const commit = readInjected(true ? "
|
|
29987
|
-
const commitShort = readInjected(true ? "
|
|
29988
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
29989
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
29986
|
+
const commit = readInjected(true ? "86c45b0edabd4e1088f6333c996142f0dfaa930b" : void 0) ?? "unknown";
|
|
29987
|
+
const commitShort = readInjected(true ? "86c45b0e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
29988
|
+
const version2 = readInjected(true ? "0.9.82-rc.299" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
29989
|
+
const builtAt = readInjected(true ? "2026-06-16T19:56:45.959Z" : void 0);
|
|
29990
29990
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
29991
29991
|
return cached2;
|
|
29992
29992
|
}
|
|
@@ -33402,11 +33402,30 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
33402
33402
|
`).get(meshId, sessionId, nodeId);
|
|
33403
33403
|
return row !== void 0;
|
|
33404
33404
|
}
|
|
33405
|
+
/** A session may only execute one task at a time, regardless of task mode. */
|
|
33406
|
+
hasActiveSessionAssignment(meshId, sessionId) {
|
|
33407
|
+
const row = this.db.prepare(`
|
|
33408
|
+
SELECT 1 FROM mesh_queue
|
|
33409
|
+
WHERE mesh_id = ? AND status = 'assigned' AND assigned_session_id = ?
|
|
33410
|
+
LIMIT 1
|
|
33411
|
+
`).get(meshId, sessionId);
|
|
33412
|
+
return row !== void 0;
|
|
33413
|
+
}
|
|
33414
|
+
/** A node may only execute one write task at a time (worktree isolation). */
|
|
33415
|
+
hasActiveNodeAssignment(meshId, nodeId) {
|
|
33416
|
+
const row = this.db.prepare(`
|
|
33417
|
+
SELECT 1 FROM mesh_queue
|
|
33418
|
+
WHERE mesh_id = ? AND status = 'assigned' AND assigned_node_id = ?
|
|
33419
|
+
LIMIT 1
|
|
33420
|
+
`).get(meshId, nodeId);
|
|
33421
|
+
return row !== void 0;
|
|
33422
|
+
}
|
|
33405
33423
|
// O(1) claim: transaction ensures only one session claims a pending task
|
|
33406
33424
|
claimNextQueueTask(meshId, nodeId, sessionId, capabilityTags = []) {
|
|
33407
33425
|
return this.transaction(() => {
|
|
33408
33426
|
this.ensureLegacyQueueMigrated(meshId);
|
|
33409
|
-
if (this.
|
|
33427
|
+
if (this.hasActiveSessionAssignment(meshId, sessionId)) return null;
|
|
33428
|
+
const nodeBusy = this.hasActiveNodeAssignment(meshId, nodeId);
|
|
33410
33429
|
const rows = [
|
|
33411
33430
|
...this.db.prepare(`
|
|
33412
33431
|
SELECT payload FROM mesh_queue
|
|
@@ -33439,7 +33458,11 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
33439
33458
|
const deps = Array.isArray(candidate.dependsOn) ? candidate.dependsOn : [];
|
|
33440
33459
|
return deps.every((depId) => depStatus.get(depId) === "completed");
|
|
33441
33460
|
};
|
|
33442
|
-
const
|
|
33461
|
+
const nodeConflictAllows = (candidate) => {
|
|
33462
|
+
if (candidate.taskMode === "live_debug_readonly") return true;
|
|
33463
|
+
return !nodeBusy;
|
|
33464
|
+
};
|
|
33465
|
+
const entry = candidates.find((candidate) => nodeSatisfiesRequiredTags(candidate.requiredTags, capabilityTags) && dependenciesSatisfied(candidate) && nodeConflictAllows(candidate));
|
|
33443
33466
|
if (!entry) return null;
|
|
33444
33467
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
33445
33468
|
entry.status = "assigned";
|
|
@@ -37826,8 +37849,11 @@ Next step: ${nextStep}`;
|
|
|
37826
37849
|
}
|
|
37827
37850
|
return null;
|
|
37828
37851
|
}
|
|
37829
|
-
function
|
|
37830
|
-
return getQueue(meshId, { status: ["assigned"] }).length;
|
|
37852
|
+
function activeWriteAssignedCount(meshId) {
|
|
37853
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.taskMode !== "live_debug_readonly").length;
|
|
37854
|
+
}
|
|
37855
|
+
function activeReadonlyAssignedCount(meshId) {
|
|
37856
|
+
return getQueue(meshId, { status: ["assigned"] }).filter((task) => task.taskMode === "live_debug_readonly").length;
|
|
37831
37857
|
}
|
|
37832
37858
|
function nodeHasActiveAssignment(meshId, nodeId) {
|
|
37833
37859
|
return getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedNodeId === nodeId);
|
|
@@ -37934,10 +37960,17 @@ Next step: ${nextStep}`;
|
|
|
37934
37960
|
const pending = queue.filter((task) => task.status === "pending");
|
|
37935
37961
|
if (!pending.length) return false;
|
|
37936
37962
|
const maxParallelTasks = Math.max(1, Math.floor(Number(mesh?.policy?.maxParallelTasks) || 2));
|
|
37963
|
+
const maxReadonlyParallelTasks = Math.max(2, maxParallelTasks * 2);
|
|
37937
37964
|
for (const task of pending) {
|
|
37938
|
-
|
|
37965
|
+
const isReadonly = task.taskMode === "live_debug_readonly";
|
|
37966
|
+
if (isReadonly) {
|
|
37967
|
+
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
37968
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_readonly_parallel_tasks_reached" });
|
|
37969
|
+
continue;
|
|
37970
|
+
}
|
|
37971
|
+
} else if (activeWriteAssignedCount(meshId) >= maxParallelTasks) {
|
|
37939
37972
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_parallel_tasks_reached" });
|
|
37940
|
-
|
|
37973
|
+
continue;
|
|
37941
37974
|
}
|
|
37942
37975
|
if (task.targetSessionId) {
|
|
37943
37976
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "target_session_constraint" });
|
|
@@ -37986,7 +38019,7 @@ Next step: ${nextStep}`;
|
|
|
37986
38019
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: localSkipReason, nodeId });
|
|
37987
38020
|
continue;
|
|
37988
38021
|
}
|
|
37989
|
-
if (nodeHasActiveAssignment(meshId, nodeId)) {
|
|
38022
|
+
if (task.taskMode !== "live_debug_readonly" && nodeHasActiveAssignment(meshId, nodeId)) {
|
|
37990
38023
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "node_has_active_assignment", nodeId });
|
|
37991
38024
|
continue;
|
|
37992
38025
|
}
|