@adhdev/daemon-core 0.9.82-rc.452 → 0.9.82-rc.454
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.d.ts +1 -1
- package/dist/index.js +60 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -42
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +19 -1
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/mesh/mesh-active-work.ts +7 -5
- package/src/mesh/mesh-event-forwarding.ts +9 -10
- package/src/mesh/mesh-events-stale.ts +7 -7
- package/src/mesh/mesh-ledger.ts +4 -3
- package/src/mesh/mesh-node-identity.ts +9 -6
- package/src/mesh/mesh-queue-assignment.ts +19 -5
- package/src/mesh/mesh-reconcile-loop.ts +5 -6
- package/src/mesh/mesh-review-inbox.ts +4 -3
- package/src/mesh/mesh-routing.ts +2 -2
- package/src/mesh/mesh-runtime-store.ts +12 -14
- package/src/mesh/mesh-work-queue.ts +30 -3
package/dist/index.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export { fastForwardMeshNode } from './mesh/mesh-fast-forward.js';
|
|
|
55
55
|
export type { MeshFastForwardNodeArgs, MeshFastForwardPlannedStep, MeshFastForwardResult } from './mesh/mesh-fast-forward.js';
|
|
56
56
|
export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
|
|
57
57
|
export type { AnyLedgerSlice, MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
|
|
58
|
-
export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, isTaskReadonly, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, resolveConvergeRequiredTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, deleteDirectDispatchesByTaskId, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
|
|
58
|
+
export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, isTaskReadonly, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, resolveConvergeRequiredTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, deleteDirectDispatchesByTaskId, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState, taskDependenciesSatisfied } from './mesh/mesh-work-queue.js';
|
|
59
59
|
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord, MeshToolCallRateResult } from './mesh/mesh-work-queue.js';
|
|
60
60
|
export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary, classifyStaleDirectForPrune, pruneStaleDirectDispatches, PRUNABLE_ORPHAN_STALE_REASONS } from './mesh/mesh-active-work.js';
|
|
61
61
|
export type { StaleDirectPruneClassification, StaleDirectPruneResult, PruneStaleDirectDispatchesOptions } from './mesh/mesh-active-work.js';
|
package/dist/index.js
CHANGED
|
@@ -409,10 +409,10 @@ function readInjected(value) {
|
|
|
409
409
|
}
|
|
410
410
|
function getDaemonBuildInfo() {
|
|
411
411
|
if (cached) return cached;
|
|
412
|
-
const commit = readInjected(true ? "
|
|
413
|
-
const commitShort = readInjected(true ? "
|
|
414
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
415
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
412
|
+
const commit = readInjected(true ? "e0af973026c31d89cf9254dcbb0a57b1d56686b3" : void 0) ?? "unknown";
|
|
413
|
+
const commitShort = readInjected(true ? "e0af9730" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
414
|
+
const version = readInjected(true ? "0.9.82-rc.454" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
415
|
+
const builtAt = readInjected(true ? "2026-07-04T02:29:44.388Z" : void 0);
|
|
416
416
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
417
417
|
return cached;
|
|
418
418
|
}
|
|
@@ -2668,6 +2668,12 @@ function pickBestTransitGitStatus(node, options) {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
return best?.git;
|
|
2670
2670
|
}
|
|
2671
|
+
function sessionIdsEquivalent(a, b) {
|
|
2672
|
+
const idA = readString2(a);
|
|
2673
|
+
const idB = readString2(b);
|
|
2674
|
+
if (!idA || !idB) return false;
|
|
2675
|
+
return idA === idB;
|
|
2676
|
+
}
|
|
2671
2677
|
function normalizeMeshNodeId(node) {
|
|
2672
2678
|
const record = node && typeof node === "object" ? node : {};
|
|
2673
2679
|
return readString2(record.id, record.nodeId, record.node_id);
|
|
@@ -4821,7 +4827,7 @@ function getSessionRecoveryContext(meshId, opts) {
|
|
|
4821
4827
|
if (!failureCountDone) {
|
|
4822
4828
|
if (ts2 < recentWindow) {
|
|
4823
4829
|
failureCountDone = true;
|
|
4824
|
-
} else if (opts.nodeId && e.nodeId
|
|
4830
|
+
} else if (opts.nodeId && !daemonIdsEquivalent(e.nodeId, opts.nodeId)) {
|
|
4825
4831
|
} else if (e.kind === "task_failed") {
|
|
4826
4832
|
if (!isIntentionalCleanupStopEntry(e)) consecutiveNodeFailures++;
|
|
4827
4833
|
} else if (e.kind === "task_completed" || e.kind === "task_dispatched") {
|
|
@@ -4829,9 +4835,9 @@ function getSessionRecoveryContext(meshId, opts) {
|
|
|
4829
4835
|
}
|
|
4830
4836
|
}
|
|
4831
4837
|
if (lastDispatch === null && e.kind === "task_dispatched") {
|
|
4832
|
-
if (opts.sessionId && e.sessionId
|
|
4838
|
+
if (opts.sessionId && sessionIdsEquivalent(e.sessionId, opts.sessionId)) {
|
|
4833
4839
|
lastDispatch = e;
|
|
4834
|
-
} else if (!opts.sessionId && opts.nodeId && e.nodeId
|
|
4840
|
+
} else if (!opts.sessionId && opts.nodeId && daemonIdsEquivalent(e.nodeId, opts.nodeId)) {
|
|
4835
4841
|
lastDispatch = e;
|
|
4836
4842
|
}
|
|
4837
4843
|
}
|
|
@@ -4898,6 +4904,7 @@ var init_mesh_ledger = __esm({
|
|
|
4898
4904
|
import_path4 = require("path");
|
|
4899
4905
|
import_crypto4 = require("crypto");
|
|
4900
4906
|
init_config();
|
|
4907
|
+
init_dist();
|
|
4901
4908
|
import_events = require("events");
|
|
4902
4909
|
init_mesh_runtime_store();
|
|
4903
4910
|
LEDGER_DIR_NAME = "mesh-ledger";
|
|
@@ -5156,6 +5163,7 @@ __export(mesh_work_queue_exports, {
|
|
|
5156
5163
|
recordTaskAutoLaunch: () => recordTaskAutoLaunch,
|
|
5157
5164
|
requeueTask: () => requeueTask,
|
|
5158
5165
|
resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
|
|
5166
|
+
taskDependenciesSatisfied: () => taskDependenciesSatisfied,
|
|
5159
5167
|
updateDirectDispatchStatus: () => updateDirectDispatchStatus,
|
|
5160
5168
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
5161
5169
|
updateTaskStatus: () => updateTaskStatus,
|
|
@@ -5735,7 +5743,7 @@ function updateSessionTaskStatus(meshId, sessionId, status, opts) {
|
|
|
5735
5743
|
const occurredAtIso = opts?.occurredAt ? new Date(opts.occurredAt).toISOString() : void 0;
|
|
5736
5744
|
const entry = store.findAssignedBySession(meshId, sessionId, occurredAtIso, opts?.taskId);
|
|
5737
5745
|
if (!entry) {
|
|
5738
|
-
const assignedRows = store.getActiveAssignmentDetails(meshId).filter((r) => r.sessionId
|
|
5746
|
+
const assignedRows = store.getActiveAssignmentDetails(meshId).filter((r) => sessionIdsEquivalent(r.sessionId, sessionId));
|
|
5739
5747
|
if (assignedRows.length > 0) {
|
|
5740
5748
|
LOG.warn("MeshQueue", `No assigned queue row matched completion for mesh ${meshId} session ${sessionId} (taskId=${opts?.taskId ?? "none"}, occurredAt=${occurredAtIso ?? "none"}); ${assignedRows.length} assigned row(s) exist: ${assignedRows.map((r) => r.id).join(",")}`);
|
|
5741
5749
|
}
|
|
@@ -5751,12 +5759,17 @@ function updateSessionTaskStatus(meshId, sessionId, status, opts) {
|
|
|
5751
5759
|
function hasPendingDependents(meshId, taskId) {
|
|
5752
5760
|
return MeshRuntimeStore.getInstance().getQueueEntries(meshId, ["pending"]).some((entry) => Array.isArray(entry.dependsOn) && entry.dependsOn.includes(taskId));
|
|
5753
5761
|
}
|
|
5762
|
+
function taskDependenciesSatisfied(entry, statusById) {
|
|
5763
|
+
if (entry.blockedReason) return false;
|
|
5764
|
+
const deps = Array.isArray(entry.dependsOn) ? entry.dependsOn : [];
|
|
5765
|
+
return deps.every((depId) => statusById.get(depId) === "completed");
|
|
5766
|
+
}
|
|
5754
5767
|
function describeTaskDependencyState(entry, statusById) {
|
|
5755
5768
|
const deps = Array.isArray(entry.dependsOn) ? entry.dependsOn : [];
|
|
5756
5769
|
const waitingOn = deps.filter((depId) => statusById.get(depId) !== "completed");
|
|
5757
5770
|
return {
|
|
5758
5771
|
waitingOn,
|
|
5759
|
-
dependenciesSatisfied:
|
|
5772
|
+
dependenciesSatisfied: taskDependenciesSatisfied(entry, statusById)
|
|
5760
5773
|
};
|
|
5761
5774
|
}
|
|
5762
5775
|
function getMeshQueueStats(meshId) {
|
|
@@ -5859,6 +5872,7 @@ var init_mesh_work_queue = __esm({
|
|
|
5859
5872
|
init_mesh_ledger();
|
|
5860
5873
|
init_mesh_delivery_policy();
|
|
5861
5874
|
init_mesh_task_inflight();
|
|
5875
|
+
init_dist();
|
|
5862
5876
|
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
5863
5877
|
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
5864
5878
|
MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
@@ -6533,11 +6547,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
6533
6547
|
).all(meshId, ...depIds);
|
|
6534
6548
|
for (const r of depRows) depStatus.set(r.id, r.status);
|
|
6535
6549
|
}
|
|
6536
|
-
const dependenciesSatisfied = (candidate) =>
|
|
6537
|
-
if (candidate.blockedReason) return false;
|
|
6538
|
-
const deps = Array.isArray(candidate.dependsOn) ? candidate.dependsOn : [];
|
|
6539
|
-
return deps.every((depId) => depStatus.get(depId) === "completed");
|
|
6540
|
-
};
|
|
6550
|
+
const dependenciesSatisfied = (candidate) => taskDependenciesSatisfied(candidate, depStatus);
|
|
6541
6551
|
const nodeConflictAllows = (candidate) => {
|
|
6542
6552
|
if (isTaskReadonly(candidate)) return true;
|
|
6543
6553
|
return !nodeBusy;
|
|
@@ -6545,7 +6555,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
6545
6555
|
const nodeIsWorktree = opts?.nodeIsWorktree === true;
|
|
6546
6556
|
const convergenceAllows = (candidate) => candidate.taskMode !== "convergence" || !nodeIsWorktree;
|
|
6547
6557
|
const targetMatches = (candidate) => {
|
|
6548
|
-
if (candidate.targetSessionId && candidate.targetSessionId
|
|
6558
|
+
if (candidate.targetSessionId && !sessionIdsEquivalent(candidate.targetSessionId, sessionId)) return false;
|
|
6549
6559
|
if (candidate.targetNodeId && !daemonIdsEquivalent(candidate.targetNodeId, nodeId) && !meshNodeIdMatches({ id: candidate.targetNodeId }, nodeId)) {
|
|
6550
6560
|
return false;
|
|
6551
6561
|
}
|
|
@@ -7930,7 +7940,7 @@ function resolveNodeEvidence(nodeId, ledgerEntries) {
|
|
|
7930
7940
|
let transcriptHandle = null;
|
|
7931
7941
|
for (let i = ledgerEntries.length - 1; i >= 0; i--) {
|
|
7932
7942
|
const entry = ledgerEntries[i];
|
|
7933
|
-
if (entry.nodeId
|
|
7943
|
+
if (!daemonIdsEquivalent(entry.nodeId, nodeId) || !isTerminalLedgerKind(entry.kind)) continue;
|
|
7934
7944
|
const payload = readRecord3(entry.payload) ?? {};
|
|
7935
7945
|
if (!evidence.available) {
|
|
7936
7946
|
if (payload.source === "refine_mesh_node_async_job") {
|
|
@@ -7976,7 +7986,7 @@ function resolveNodeEvidence(nodeId, ledgerEntries) {
|
|
|
7976
7986
|
function hasBlockedReviewRefineResult(nodeId, ledgerEntries) {
|
|
7977
7987
|
for (let i = ledgerEntries.length - 1; i >= 0; i--) {
|
|
7978
7988
|
const entry = ledgerEntries[i];
|
|
7979
|
-
if (entry.nodeId
|
|
7989
|
+
if (!daemonIdsEquivalent(entry.nodeId, nodeId) || !isTerminalLedgerKind(entry.kind)) continue;
|
|
7980
7990
|
const payload = readRecord3(entry.payload) ?? {};
|
|
7981
7991
|
if (payload.source !== "refine_mesh_node_async_job") continue;
|
|
7982
7992
|
const result = readRecord3(payload.result);
|
|
@@ -8008,7 +8018,7 @@ function deriveMeshReviewInboxItems(args) {
|
|
|
8008
8018
|
if (!reviewReason) continue;
|
|
8009
8019
|
const { evidence, transcriptHandle } = resolveNodeEvidence(nodeId, args.ledgerEntries);
|
|
8010
8020
|
const activeRefineJob = [...refineJobs].reverse().find(
|
|
8011
|
-
(job) => (job.nodeId
|
|
8021
|
+
(job) => (daemonIdsEquivalent(job.nodeId, nodeId) || daemonIdsEquivalent(job.targetNodeId, nodeId)) && (job.status === "accepted" || job.status === "running")
|
|
8012
8022
|
) ?? null;
|
|
8013
8023
|
items.push({
|
|
8014
8024
|
nodeId,
|
|
@@ -8040,6 +8050,7 @@ var init_mesh_review_inbox = __esm({
|
|
|
8040
8050
|
"src/mesh/mesh-review-inbox.ts"() {
|
|
8041
8051
|
"use strict";
|
|
8042
8052
|
init_mesh_refine_status();
|
|
8053
|
+
init_dist();
|
|
8043
8054
|
MAX_CHANGED_FILES = 100;
|
|
8044
8055
|
}
|
|
8045
8056
|
});
|
|
@@ -10156,9 +10167,9 @@ function sessionStatusFromNodes(nodes, nodeId, sessionId) {
|
|
|
10156
10167
|
if (value && typeof value === "object") candidates.push(value);
|
|
10157
10168
|
}
|
|
10158
10169
|
const session = candidates.find((item) => {
|
|
10159
|
-
if (typeof item === "string") return item
|
|
10170
|
+
if (typeof item === "string") return sessionIdsEquivalent(item, sessionId);
|
|
10160
10171
|
const id = readString6(item?.id) || readString6(item?.sessionId) || readString6(item?.session_id) || readString6(item?.runtimeSessionId) || readString6(item?.instanceId);
|
|
10161
|
-
return id
|
|
10172
|
+
return sessionIdsEquivalent(id, sessionId);
|
|
10162
10173
|
});
|
|
10163
10174
|
if (!session) return { staleReason: "direct task session is not present in live session records" };
|
|
10164
10175
|
if (typeof session === "string") return {};
|
|
@@ -10183,8 +10194,8 @@ function terminalMatchesDispatch(terminal, dispatch, taskId) {
|
|
|
10183
10194
|
const terminalTaskId = readString6(terminal.payload?.taskId);
|
|
10184
10195
|
if (terminalTaskId && terminalTaskId === taskId) return true;
|
|
10185
10196
|
if (terminalTaskId && terminalTaskId !== taskId) return false;
|
|
10186
|
-
if (dispatch.sessionId && terminal.sessionId
|
|
10187
|
-
return Boolean(dispatch.nodeId && terminal.nodeId
|
|
10197
|
+
if (dispatch.sessionId && sessionIdsEquivalent(terminal.sessionId, dispatch.sessionId)) return true;
|
|
10198
|
+
return Boolean(dispatch.nodeId && daemonIdsEquivalent(terminal.nodeId, dispatch.nodeId) && !dispatch.sessionId);
|
|
10188
10199
|
}
|
|
10189
10200
|
function statusFromTerminal(entry) {
|
|
10190
10201
|
if (entry.kind === "task_approval_needed") return "awaiting_approval";
|
|
@@ -11443,7 +11454,7 @@ function findRecentTerminalLedgerEvidence(args) {
|
|
|
11443
11454
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
11444
11455
|
const entry = entries[i];
|
|
11445
11456
|
if (entry.kind !== "task_completed" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") continue;
|
|
11446
|
-
if (args.sessionId && entry.sessionId
|
|
11457
|
+
if (args.sessionId && sessionIdsEquivalent(entry.sessionId, args.sessionId)) {
|
|
11447
11458
|
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
11448
11459
|
}
|
|
11449
11460
|
if (!args.sessionId && args.nodeId && meshNodeIdMatches(entry, args.nodeId)) {
|
|
@@ -11460,7 +11471,7 @@ function hasDispatchAfterTerminal(meshId, sessionId, terminalId) {
|
|
|
11460
11471
|
if (entry.id === terminalId) pastTerminal = true;
|
|
11461
11472
|
continue;
|
|
11462
11473
|
}
|
|
11463
|
-
if (entry.kind === "task_dispatched" && entry.sessionId
|
|
11474
|
+
if (entry.kind === "task_dispatched" && sessionIdsEquivalent(entry.sessionId, sessionId)) return true;
|
|
11464
11475
|
}
|
|
11465
11476
|
return false;
|
|
11466
11477
|
}
|
|
@@ -11468,7 +11479,7 @@ function hasUnterminalDirectDispatchLedgerEntry(meshId, sessionId) {
|
|
|
11468
11479
|
const entries = readLedgerEntries(meshId, { tail: 200 });
|
|
11469
11480
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
11470
11481
|
const entry = entries[i];
|
|
11471
|
-
if (entry.sessionId
|
|
11482
|
+
if (!sessionIdsEquivalent(entry.sessionId, sessionId)) continue;
|
|
11472
11483
|
if (entry.kind === "task_completed" || entry.kind === "task_failed" || entry.kind === "task_stalled") {
|
|
11473
11484
|
return false;
|
|
11474
11485
|
}
|
|
@@ -11488,7 +11499,7 @@ function findTerminalLedgerEvidenceForTask(args) {
|
|
|
11488
11499
|
const terminalTaskId = readNonEmptyString2(entry.payload?.taskId);
|
|
11489
11500
|
if (terminalTaskId !== taskId) continue;
|
|
11490
11501
|
if (entry.kind === "task_completed" && isWeakCompletionEvidence(entry.payload)) continue;
|
|
11491
|
-
if (args.sessionId && entry.sessionId && entry.sessionId
|
|
11502
|
+
if (args.sessionId && entry.sessionId && !sessionIdsEquivalent(entry.sessionId, args.sessionId)) continue;
|
|
11492
11503
|
if (!args.sessionId && args.nodeId && entry.nodeId && !meshNodeIdMatches(entry, args.nodeId)) continue;
|
|
11493
11504
|
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
11494
11505
|
}
|
|
@@ -11501,7 +11512,7 @@ function findDirectDispatchLedgerEntry(args) {
|
|
|
11501
11512
|
if (entry.kind !== "task_dispatched") continue;
|
|
11502
11513
|
const payloadTaskId = readNonEmptyString2(entry.payload?.taskId);
|
|
11503
11514
|
if (payloadTaskId !== args.taskId) continue;
|
|
11504
|
-
if (args.sessionId && entry.sessionId && entry.sessionId
|
|
11515
|
+
if (args.sessionId && entry.sessionId && !sessionIdsEquivalent(entry.sessionId, args.sessionId)) continue;
|
|
11505
11516
|
return {
|
|
11506
11517
|
id: entry.id,
|
|
11507
11518
|
timestamp: entry.timestamp,
|
|
@@ -11534,7 +11545,7 @@ function hasTerminalLedgerAfterDispatch(args) {
|
|
|
11534
11545
|
const terminalTaskId = readNonEmptyString2(entry.payload?.taskId);
|
|
11535
11546
|
if (terminalTaskId && terminalTaskId === args.taskId) return true;
|
|
11536
11547
|
if (terminalTaskId && terminalTaskId !== args.taskId) continue;
|
|
11537
|
-
if (args.sessionId && entry.sessionId
|
|
11548
|
+
if (args.sessionId && sessionIdsEquivalent(entry.sessionId, args.sessionId)) return true;
|
|
11538
11549
|
}
|
|
11539
11550
|
return false;
|
|
11540
11551
|
}
|
|
@@ -12860,7 +12871,7 @@ function nodeHasActiveMeshWork(components, meshId, nodeId, currentSessionId) {
|
|
|
12860
12871
|
const instNodeId = readNonEmptyString2(settings.meshNodeId) || readNonEmptyString2(settings.nodeId);
|
|
12861
12872
|
if (!daemonIdsEquivalent(instNodeId, nodeId)) return false;
|
|
12862
12873
|
const sessionId = readNonEmptyString2(state.instanceId);
|
|
12863
|
-
if (currentSessionId && sessionId
|
|
12874
|
+
if (currentSessionId && sessionIdsEquivalent(sessionId, currentSessionId) && isIdleSessionState(state)) return false;
|
|
12864
12875
|
return sessionStateLooksActive(state);
|
|
12865
12876
|
});
|
|
12866
12877
|
}
|
|
@@ -12934,11 +12945,11 @@ function activeProviderAssignedCount(meshId, nodeId, providerType) {
|
|
|
12934
12945
|
return getQueue(meshId, { status: ["assigned"] }).filter((task) => daemonIdsEquivalent(task.assignedNodeId, nodeId) && task.assignedProviderType === providerType).length;
|
|
12935
12946
|
}
|
|
12936
12947
|
function sessionHasActiveAssignment(meshId, sessionId) {
|
|
12937
|
-
if (getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedSessionId
|
|
12948
|
+
if (getQueue(meshId, { status: ["assigned"] }).some((task) => sessionIdsEquivalent(task.assignedSessionId, sessionId))) {
|
|
12938
12949
|
return true;
|
|
12939
12950
|
}
|
|
12940
12951
|
try {
|
|
12941
|
-
if (getActiveDirectDispatches(meshId).some((d) => d.sessionId
|
|
12952
|
+
if (getActiveDirectDispatches(meshId).some((d) => sessionIdsEquivalent(d.sessionId, sessionId))) return true;
|
|
12942
12953
|
if (hasUnterminalDirectDispatchLedgerEntry(meshId, sessionId)) return true;
|
|
12943
12954
|
} catch {
|
|
12944
12955
|
}
|
|
@@ -13074,11 +13085,16 @@ function readMeshNodeId(node) {
|
|
|
13074
13085
|
}
|
|
13075
13086
|
async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
13076
13087
|
const queue = getQueue(meshId);
|
|
13088
|
+
const statusById = new Map(queue.map((task) => [task.id, task.status]));
|
|
13077
13089
|
const pending = queue.filter((task) => task.status === "pending");
|
|
13078
13090
|
if (!pending.length) return false;
|
|
13079
13091
|
const maxParallelTasks = resolveMaxParallelTasks(mesh?.policy?.maxParallelTasks);
|
|
13080
13092
|
const maxReadonlyParallelTasks = resolveMaxReadonlyParallelTasks(maxParallelTasks);
|
|
13081
13093
|
for (const task of pending) {
|
|
13094
|
+
if (!taskDependenciesSatisfied(task, statusById)) {
|
|
13095
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "dependencies_unsatisfied" });
|
|
13096
|
+
continue;
|
|
13097
|
+
}
|
|
13082
13098
|
const isReadonly = isTaskReadonly(task);
|
|
13083
13099
|
if (isReadonly) {
|
|
13084
13100
|
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
@@ -13571,7 +13587,7 @@ function resolveWorkerDelegateRouting(components, instanceId, deps) {
|
|
|
13571
13587
|
if (coordinatorMeshId) {
|
|
13572
13588
|
let hasActiveDispatch = false;
|
|
13573
13589
|
try {
|
|
13574
|
-
hasActiveDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => d.sessionId
|
|
13590
|
+
hasActiveDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => sessionIdsEquivalent(d.sessionId, instanceId)) || hasUnterminalDirectDispatchLedgerEntry(coordinatorMeshId, instanceId);
|
|
13575
13591
|
} catch {
|
|
13576
13592
|
}
|
|
13577
13593
|
if (!hasActiveDispatch) return reject("coordinator_not_dispatch_target");
|
|
@@ -16145,7 +16161,7 @@ function hasRecentIntentionalCleanupStop(meshId, sessionId, nodeId) {
|
|
|
16145
16161
|
const timestamp = new Date(entry.timestamp).getTime();
|
|
16146
16162
|
if (!Number.isNaN(timestamp) && timestamp < cutoff) break;
|
|
16147
16163
|
if (!isIntentionalCleanupStopEntry(entry)) continue;
|
|
16148
|
-
if (sessionId && entry.sessionId
|
|
16164
|
+
if (sessionId && sessionIdsEquivalent(entry.sessionId, sessionId)) return true;
|
|
16149
16165
|
if (!sessionId && nodeId && meshNodeIdMatches(entry, nodeId)) return true;
|
|
16150
16166
|
}
|
|
16151
16167
|
return false;
|
|
@@ -16265,7 +16281,7 @@ function supersedesTruncatedTerminalSummary(args) {
|
|
|
16265
16281
|
}
|
|
16266
16282
|
function resolveActiveDirectDispatchTaskId(meshId, sessionId) {
|
|
16267
16283
|
try {
|
|
16268
|
-
const matches = getActiveDirectDispatches(meshId).filter((d) => d.sessionId
|
|
16284
|
+
const matches = getActiveDirectDispatches(meshId).filter((d) => sessionIdsEquivalent(d.sessionId, sessionId));
|
|
16269
16285
|
if (!matches.length) return void 0;
|
|
16270
16286
|
return readNonEmptyString2(matches[matches.length - 1].taskId) || void 0;
|
|
16271
16287
|
} catch {
|
|
@@ -17059,7 +17075,7 @@ function flushPendingForMeshIdleCoordinators(components, meshId) {
|
|
|
17059
17075
|
let delivered = 0;
|
|
17060
17076
|
for (const pending of pendingEvents) {
|
|
17061
17077
|
const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
|
|
17062
|
-
const targets = wantSession ? idleCoordinators.filter((c) => c.sessionId
|
|
17078
|
+
const targets = wantSession ? idleCoordinators.filter((c) => sessionIdsEquivalent(c.sessionId, wantSession)) : idleCoordinators;
|
|
17063
17079
|
if (targets.length === 0 || !pending.coordinatorMessage) {
|
|
17064
17080
|
try {
|
|
17065
17081
|
queuePendingMeshCoordinatorEvent(pending);
|
|
@@ -17114,7 +17130,7 @@ function setupMeshEventForwarding(components) {
|
|
|
17114
17130
|
}
|
|
17115
17131
|
let hasDirectDispatch = false;
|
|
17116
17132
|
try {
|
|
17117
|
-
hasDirectDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => d.sessionId
|
|
17133
|
+
hasDirectDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => sessionIdsEquivalent(d.sessionId, flushInstanceId)) || hasUnterminalDirectDispatchLedgerEntry(coordinatorMeshId, flushInstanceId);
|
|
17118
17134
|
} catch {
|
|
17119
17135
|
}
|
|
17120
17136
|
if (!hasDirectDispatch) return;
|
|
@@ -17449,7 +17465,7 @@ function drainAndInjectIntoTargets(meshId, drainDaemonIds, localDaemonId, target
|
|
|
17449
17465
|
for (const pending of pendingEvents) {
|
|
17450
17466
|
const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
|
|
17451
17467
|
if (wantSession) {
|
|
17452
|
-
const matched = targetCoordinators.filter((c) => c.sessionId
|
|
17468
|
+
const matched = targetCoordinators.filter((c) => sessionIdsEquivalent(c.sessionId, wantSession));
|
|
17453
17469
|
if (matched.length === 0) {
|
|
17454
17470
|
holdOrExpireStrictUnmatchedEvent(pending, wantSession, meshId);
|
|
17455
17471
|
continue;
|
|
@@ -24265,6 +24281,7 @@ __export(index_exports, {
|
|
|
24265
24281
|
summarizeMeshMagiActivity: () => summarizeMeshMagiActivity,
|
|
24266
24282
|
summarizeMeshMission: () => summarizeMeshMission,
|
|
24267
24283
|
summarizeMissionTasks: () => summarizeMissionTasks,
|
|
24284
|
+
taskDependenciesSatisfied: () => taskDependenciesSatisfied,
|
|
24268
24285
|
tombstoneOperatingNote: () => tombstoneOperatingNote,
|
|
24269
24286
|
triggerMeshQueue: () => triggerMeshQueue,
|
|
24270
24287
|
unregisterMeshCoordinator: () => unregisterMeshCoordinator,
|
|
@@ -54243,7 +54260,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
54243
54260
|
const workspace = readStringValue(node?.workspace);
|
|
54244
54261
|
const daemonId = readStringValue(node?.daemonId);
|
|
54245
54262
|
const isSelfNode = Boolean(
|
|
54246
|
-
nodeId && selectedCoordinatorNodeId && nodeId
|
|
54263
|
+
nodeId && selectedCoordinatorNodeId && daemonIdsEquivalent(nodeId, selectedCoordinatorNodeId)
|
|
54247
54264
|
) || Boolean(
|
|
54248
54265
|
daemonId && (daemonIdsEquivalent(daemonId, args.localMachineId) || daemonIdsEquivalent(daemonId, args.statusInstanceId))
|
|
54249
54266
|
) || Boolean(args.meshSource !== "local_config" && nodeIndex === 0);
|
|
@@ -54305,7 +54322,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
54305
54322
|
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
54306
54323
|
const daemonId = readStringValue(node?.daemonId);
|
|
54307
54324
|
const isSelfNode = Boolean(
|
|
54308
|
-
nodeId && selectedCoordinatorNodeId && nodeId
|
|
54325
|
+
nodeId && selectedCoordinatorNodeId && daemonIdsEquivalent(nodeId, selectedCoordinatorNodeId)
|
|
54309
54326
|
) || Boolean(
|
|
54310
54327
|
daemonId && (daemonIdsEquivalent(daemonId, args.localMachineId) || daemonIdsEquivalent(daemonId, args.statusInstanceId))
|
|
54311
54328
|
);
|
|
@@ -54374,7 +54391,7 @@ function summarizeMeshSessionRecord(record) {
|
|
|
54374
54391
|
}
|
|
54375
54392
|
function liveSessionRecordMatchesMeshNode(record, meshId, nodeId, nodeWorkspace = "", nodeIsMissingLocalWorktree = false) {
|
|
54376
54393
|
const recordNodeId = readStringValue(record?.meta?.meshNodeId);
|
|
54377
|
-
if (!recordNodeId || recordNodeId
|
|
54394
|
+
if (!recordNodeId || !daemonIdsEquivalent(recordNodeId, nodeId)) return false;
|
|
54378
54395
|
if (nodeIsMissingLocalWorktree) return false;
|
|
54379
54396
|
const recordWorkspace = readStringValue(record?.workspace);
|
|
54380
54397
|
if (nodeWorkspace && recordWorkspace && !meshWorkspacesEquivalent(recordWorkspace, nodeWorkspace)) return false;
|
|
@@ -54406,7 +54423,7 @@ function collectLiveMeshSessionRecords(args) {
|
|
|
54406
54423
|
const nodeIsMissingLocalWorktree = args.node?.isLocalWorktree === true && !!nodeWorkspace && !fs29.existsSync(nodeWorkspace);
|
|
54407
54424
|
const matches = args.liveSessionRecords.filter((record) => {
|
|
54408
54425
|
const recordNodeId = readStringValue(record?.meta?.meshNodeId);
|
|
54409
|
-
if (recordNodeId && recordNodeId
|
|
54426
|
+
if (recordNodeId && !daemonIdsEquivalent(recordNodeId, args.nodeId)) return false;
|
|
54410
54427
|
if (liveSessionRecordMatchesMeshNode(record, args.meshId, args.nodeId, nodeWorkspace || "", nodeIsMissingLocalWorktree)) return true;
|
|
54411
54428
|
if (nodeIsMissingLocalWorktree) return false;
|
|
54412
54429
|
return !!nodeWorkspace && liveSessionRecordMatchesMeshWorkspace(record, args.meshId, nodeWorkspace);
|
|
@@ -54415,7 +54432,7 @@ function collectLiveMeshSessionRecords(args) {
|
|
|
54415
54432
|
for (const record of args.liveSessionRecords) {
|
|
54416
54433
|
if (readStringValue(record?.meta?.meshCoordinatorFor) !== args.meshId) continue;
|
|
54417
54434
|
const sessionId = readStringValue(record?.sessionId);
|
|
54418
|
-
if (sessionId && matches.some((entry) => readStringValue(entry?.sessionId)
|
|
54435
|
+
if (sessionId && matches.some((entry) => sessionIdsEquivalent(readStringValue(entry?.sessionId), sessionId))) continue;
|
|
54419
54436
|
matches.push(record);
|
|
54420
54437
|
}
|
|
54421
54438
|
}
|
|
@@ -67029,6 +67046,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
67029
67046
|
summarizeMeshMagiActivity,
|
|
67030
67047
|
summarizeMeshMission,
|
|
67031
67048
|
summarizeMissionTasks,
|
|
67049
|
+
taskDependenciesSatisfied,
|
|
67032
67050
|
tombstoneOperatingNote,
|
|
67033
67051
|
triggerMeshQueue,
|
|
67034
67052
|
unregisterMeshCoordinator,
|