@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.mjs
CHANGED
|
@@ -404,10 +404,10 @@ function readInjected(value) {
|
|
|
404
404
|
}
|
|
405
405
|
function getDaemonBuildInfo() {
|
|
406
406
|
if (cached) return cached;
|
|
407
|
-
const commit = readInjected(true ? "
|
|
408
|
-
const commitShort = readInjected(true ? "
|
|
409
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
410
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
407
|
+
const commit = readInjected(true ? "e0af973026c31d89cf9254dcbb0a57b1d56686b3" : void 0) ?? "unknown";
|
|
408
|
+
const commitShort = readInjected(true ? "e0af9730" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
409
|
+
const version = readInjected(true ? "0.9.82-rc.454" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
410
|
+
const builtAt = readInjected(true ? "2026-07-04T02:29:44.388Z" : void 0);
|
|
411
411
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
412
412
|
return cached;
|
|
413
413
|
}
|
|
@@ -2662,6 +2662,12 @@ function pickBestTransitGitStatus(node, options) {
|
|
|
2662
2662
|
}
|
|
2663
2663
|
return best?.git;
|
|
2664
2664
|
}
|
|
2665
|
+
function sessionIdsEquivalent(a, b) {
|
|
2666
|
+
const idA = readString2(a);
|
|
2667
|
+
const idB = readString2(b);
|
|
2668
|
+
if (!idA || !idB) return false;
|
|
2669
|
+
return idA === idB;
|
|
2670
|
+
}
|
|
2665
2671
|
function normalizeMeshNodeId(node) {
|
|
2666
2672
|
const record = node && typeof node === "object" ? node : {};
|
|
2667
2673
|
return readString2(record.id, record.nodeId, record.node_id);
|
|
@@ -4818,7 +4824,7 @@ function getSessionRecoveryContext(meshId, opts) {
|
|
|
4818
4824
|
if (!failureCountDone) {
|
|
4819
4825
|
if (ts2 < recentWindow) {
|
|
4820
4826
|
failureCountDone = true;
|
|
4821
|
-
} else if (opts.nodeId && e.nodeId
|
|
4827
|
+
} else if (opts.nodeId && !daemonIdsEquivalent(e.nodeId, opts.nodeId)) {
|
|
4822
4828
|
} else if (e.kind === "task_failed") {
|
|
4823
4829
|
if (!isIntentionalCleanupStopEntry(e)) consecutiveNodeFailures++;
|
|
4824
4830
|
} else if (e.kind === "task_completed" || e.kind === "task_dispatched") {
|
|
@@ -4826,9 +4832,9 @@ function getSessionRecoveryContext(meshId, opts) {
|
|
|
4826
4832
|
}
|
|
4827
4833
|
}
|
|
4828
4834
|
if (lastDispatch === null && e.kind === "task_dispatched") {
|
|
4829
|
-
if (opts.sessionId && e.sessionId
|
|
4835
|
+
if (opts.sessionId && sessionIdsEquivalent(e.sessionId, opts.sessionId)) {
|
|
4830
4836
|
lastDispatch = e;
|
|
4831
|
-
} else if (!opts.sessionId && opts.nodeId && e.nodeId
|
|
4837
|
+
} else if (!opts.sessionId && opts.nodeId && daemonIdsEquivalent(e.nodeId, opts.nodeId)) {
|
|
4832
4838
|
lastDispatch = e;
|
|
4833
4839
|
}
|
|
4834
4840
|
}
|
|
@@ -4892,6 +4898,7 @@ var init_mesh_ledger = __esm({
|
|
|
4892
4898
|
"src/mesh/mesh-ledger.ts"() {
|
|
4893
4899
|
"use strict";
|
|
4894
4900
|
init_config();
|
|
4901
|
+
init_dist();
|
|
4895
4902
|
init_mesh_runtime_store();
|
|
4896
4903
|
LEDGER_DIR_NAME = "mesh-ledger";
|
|
4897
4904
|
MAX_FILE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
@@ -5149,6 +5156,7 @@ __export(mesh_work_queue_exports, {
|
|
|
5149
5156
|
recordTaskAutoLaunch: () => recordTaskAutoLaunch,
|
|
5150
5157
|
requeueTask: () => requeueTask,
|
|
5151
5158
|
resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
|
|
5159
|
+
taskDependenciesSatisfied: () => taskDependenciesSatisfied,
|
|
5152
5160
|
updateDirectDispatchStatus: () => updateDirectDispatchStatus,
|
|
5153
5161
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
5154
5162
|
updateTaskStatus: () => updateTaskStatus,
|
|
@@ -5729,7 +5737,7 @@ function updateSessionTaskStatus(meshId, sessionId, status, opts) {
|
|
|
5729
5737
|
const occurredAtIso = opts?.occurredAt ? new Date(opts.occurredAt).toISOString() : void 0;
|
|
5730
5738
|
const entry = store.findAssignedBySession(meshId, sessionId, occurredAtIso, opts?.taskId);
|
|
5731
5739
|
if (!entry) {
|
|
5732
|
-
const assignedRows = store.getActiveAssignmentDetails(meshId).filter((r) => r.sessionId
|
|
5740
|
+
const assignedRows = store.getActiveAssignmentDetails(meshId).filter((r) => sessionIdsEquivalent(r.sessionId, sessionId));
|
|
5733
5741
|
if (assignedRows.length > 0) {
|
|
5734
5742
|
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(",")}`);
|
|
5735
5743
|
}
|
|
@@ -5745,12 +5753,17 @@ function updateSessionTaskStatus(meshId, sessionId, status, opts) {
|
|
|
5745
5753
|
function hasPendingDependents(meshId, taskId) {
|
|
5746
5754
|
return MeshRuntimeStore.getInstance().getQueueEntries(meshId, ["pending"]).some((entry) => Array.isArray(entry.dependsOn) && entry.dependsOn.includes(taskId));
|
|
5747
5755
|
}
|
|
5756
|
+
function taskDependenciesSatisfied(entry, statusById) {
|
|
5757
|
+
if (entry.blockedReason) return false;
|
|
5758
|
+
const deps = Array.isArray(entry.dependsOn) ? entry.dependsOn : [];
|
|
5759
|
+
return deps.every((depId) => statusById.get(depId) === "completed");
|
|
5760
|
+
}
|
|
5748
5761
|
function describeTaskDependencyState(entry, statusById) {
|
|
5749
5762
|
const deps = Array.isArray(entry.dependsOn) ? entry.dependsOn : [];
|
|
5750
5763
|
const waitingOn = deps.filter((depId) => statusById.get(depId) !== "completed");
|
|
5751
5764
|
return {
|
|
5752
5765
|
waitingOn,
|
|
5753
|
-
dependenciesSatisfied:
|
|
5766
|
+
dependenciesSatisfied: taskDependenciesSatisfied(entry, statusById)
|
|
5754
5767
|
};
|
|
5755
5768
|
}
|
|
5756
5769
|
function getMeshQueueStats(meshId) {
|
|
@@ -5852,6 +5865,7 @@ var init_mesh_work_queue = __esm({
|
|
|
5852
5865
|
init_mesh_ledger();
|
|
5853
5866
|
init_mesh_delivery_policy();
|
|
5854
5867
|
init_mesh_task_inflight();
|
|
5868
|
+
init_dist();
|
|
5855
5869
|
ACTIVE_MESH_QUEUE_STATUSES = ["pending", "assigned"];
|
|
5856
5870
|
HISTORICAL_MESH_QUEUE_STATUSES = ["completed", "failed", "cancelled"];
|
|
5857
5871
|
MESH_TASK_MODES = ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
@@ -6526,11 +6540,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
6526
6540
|
).all(meshId, ...depIds);
|
|
6527
6541
|
for (const r of depRows) depStatus.set(r.id, r.status);
|
|
6528
6542
|
}
|
|
6529
|
-
const dependenciesSatisfied = (candidate) =>
|
|
6530
|
-
if (candidate.blockedReason) return false;
|
|
6531
|
-
const deps = Array.isArray(candidate.dependsOn) ? candidate.dependsOn : [];
|
|
6532
|
-
return deps.every((depId) => depStatus.get(depId) === "completed");
|
|
6533
|
-
};
|
|
6543
|
+
const dependenciesSatisfied = (candidate) => taskDependenciesSatisfied(candidate, depStatus);
|
|
6534
6544
|
const nodeConflictAllows = (candidate) => {
|
|
6535
6545
|
if (isTaskReadonly(candidate)) return true;
|
|
6536
6546
|
return !nodeBusy;
|
|
@@ -6538,7 +6548,7 @@ var init_mesh_runtime_store = __esm({
|
|
|
6538
6548
|
const nodeIsWorktree = opts?.nodeIsWorktree === true;
|
|
6539
6549
|
const convergenceAllows = (candidate) => candidate.taskMode !== "convergence" || !nodeIsWorktree;
|
|
6540
6550
|
const targetMatches = (candidate) => {
|
|
6541
|
-
if (candidate.targetSessionId && candidate.targetSessionId
|
|
6551
|
+
if (candidate.targetSessionId && !sessionIdsEquivalent(candidate.targetSessionId, sessionId)) return false;
|
|
6542
6552
|
if (candidate.targetNodeId && !daemonIdsEquivalent(candidate.targetNodeId, nodeId) && !meshNodeIdMatches({ id: candidate.targetNodeId }, nodeId)) {
|
|
6543
6553
|
return false;
|
|
6544
6554
|
}
|
|
@@ -7923,7 +7933,7 @@ function resolveNodeEvidence(nodeId, ledgerEntries) {
|
|
|
7923
7933
|
let transcriptHandle = null;
|
|
7924
7934
|
for (let i = ledgerEntries.length - 1; i >= 0; i--) {
|
|
7925
7935
|
const entry = ledgerEntries[i];
|
|
7926
|
-
if (entry.nodeId
|
|
7936
|
+
if (!daemonIdsEquivalent(entry.nodeId, nodeId) || !isTerminalLedgerKind(entry.kind)) continue;
|
|
7927
7937
|
const payload = readRecord3(entry.payload) ?? {};
|
|
7928
7938
|
if (!evidence.available) {
|
|
7929
7939
|
if (payload.source === "refine_mesh_node_async_job") {
|
|
@@ -7969,7 +7979,7 @@ function resolveNodeEvidence(nodeId, ledgerEntries) {
|
|
|
7969
7979
|
function hasBlockedReviewRefineResult(nodeId, ledgerEntries) {
|
|
7970
7980
|
for (let i = ledgerEntries.length - 1; i >= 0; i--) {
|
|
7971
7981
|
const entry = ledgerEntries[i];
|
|
7972
|
-
if (entry.nodeId
|
|
7982
|
+
if (!daemonIdsEquivalent(entry.nodeId, nodeId) || !isTerminalLedgerKind(entry.kind)) continue;
|
|
7973
7983
|
const payload = readRecord3(entry.payload) ?? {};
|
|
7974
7984
|
if (payload.source !== "refine_mesh_node_async_job") continue;
|
|
7975
7985
|
const result = readRecord3(payload.result);
|
|
@@ -8001,7 +8011,7 @@ function deriveMeshReviewInboxItems(args) {
|
|
|
8001
8011
|
if (!reviewReason) continue;
|
|
8002
8012
|
const { evidence, transcriptHandle } = resolveNodeEvidence(nodeId, args.ledgerEntries);
|
|
8003
8013
|
const activeRefineJob = [...refineJobs].reverse().find(
|
|
8004
|
-
(job) => (job.nodeId
|
|
8014
|
+
(job) => (daemonIdsEquivalent(job.nodeId, nodeId) || daemonIdsEquivalent(job.targetNodeId, nodeId)) && (job.status === "accepted" || job.status === "running")
|
|
8005
8015
|
) ?? null;
|
|
8006
8016
|
items.push({
|
|
8007
8017
|
nodeId,
|
|
@@ -8033,6 +8043,7 @@ var init_mesh_review_inbox = __esm({
|
|
|
8033
8043
|
"src/mesh/mesh-review-inbox.ts"() {
|
|
8034
8044
|
"use strict";
|
|
8035
8045
|
init_mesh_refine_status();
|
|
8046
|
+
init_dist();
|
|
8036
8047
|
MAX_CHANGED_FILES = 100;
|
|
8037
8048
|
}
|
|
8038
8049
|
});
|
|
@@ -10149,9 +10160,9 @@ function sessionStatusFromNodes(nodes, nodeId, sessionId) {
|
|
|
10149
10160
|
if (value && typeof value === "object") candidates.push(value);
|
|
10150
10161
|
}
|
|
10151
10162
|
const session = candidates.find((item) => {
|
|
10152
|
-
if (typeof item === "string") return item
|
|
10163
|
+
if (typeof item === "string") return sessionIdsEquivalent(item, sessionId);
|
|
10153
10164
|
const id = readString6(item?.id) || readString6(item?.sessionId) || readString6(item?.session_id) || readString6(item?.runtimeSessionId) || readString6(item?.instanceId);
|
|
10154
|
-
return id
|
|
10165
|
+
return sessionIdsEquivalent(id, sessionId);
|
|
10155
10166
|
});
|
|
10156
10167
|
if (!session) return { staleReason: "direct task session is not present in live session records" };
|
|
10157
10168
|
if (typeof session === "string") return {};
|
|
@@ -10176,8 +10187,8 @@ function terminalMatchesDispatch(terminal, dispatch, taskId) {
|
|
|
10176
10187
|
const terminalTaskId = readString6(terminal.payload?.taskId);
|
|
10177
10188
|
if (terminalTaskId && terminalTaskId === taskId) return true;
|
|
10178
10189
|
if (terminalTaskId && terminalTaskId !== taskId) return false;
|
|
10179
|
-
if (dispatch.sessionId && terminal.sessionId
|
|
10180
|
-
return Boolean(dispatch.nodeId && terminal.nodeId
|
|
10190
|
+
if (dispatch.sessionId && sessionIdsEquivalent(terminal.sessionId, dispatch.sessionId)) return true;
|
|
10191
|
+
return Boolean(dispatch.nodeId && daemonIdsEquivalent(terminal.nodeId, dispatch.nodeId) && !dispatch.sessionId);
|
|
10181
10192
|
}
|
|
10182
10193
|
function statusFromTerminal(entry) {
|
|
10183
10194
|
if (entry.kind === "task_approval_needed") return "awaiting_approval";
|
|
@@ -11436,7 +11447,7 @@ function findRecentTerminalLedgerEvidence(args) {
|
|
|
11436
11447
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
11437
11448
|
const entry = entries[i];
|
|
11438
11449
|
if (entry.kind !== "task_completed" && entry.kind !== "task_failed" && entry.kind !== "task_stalled") continue;
|
|
11439
|
-
if (args.sessionId && entry.sessionId
|
|
11450
|
+
if (args.sessionId && sessionIdsEquivalent(entry.sessionId, args.sessionId)) {
|
|
11440
11451
|
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
11441
11452
|
}
|
|
11442
11453
|
if (!args.sessionId && args.nodeId && meshNodeIdMatches(entry, args.nodeId)) {
|
|
@@ -11453,7 +11464,7 @@ function hasDispatchAfterTerminal(meshId, sessionId, terminalId) {
|
|
|
11453
11464
|
if (entry.id === terminalId) pastTerminal = true;
|
|
11454
11465
|
continue;
|
|
11455
11466
|
}
|
|
11456
|
-
if (entry.kind === "task_dispatched" && entry.sessionId
|
|
11467
|
+
if (entry.kind === "task_dispatched" && sessionIdsEquivalent(entry.sessionId, sessionId)) return true;
|
|
11457
11468
|
}
|
|
11458
11469
|
return false;
|
|
11459
11470
|
}
|
|
@@ -11461,7 +11472,7 @@ function hasUnterminalDirectDispatchLedgerEntry(meshId, sessionId) {
|
|
|
11461
11472
|
const entries = readLedgerEntries(meshId, { tail: 200 });
|
|
11462
11473
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
11463
11474
|
const entry = entries[i];
|
|
11464
|
-
if (entry.sessionId
|
|
11475
|
+
if (!sessionIdsEquivalent(entry.sessionId, sessionId)) continue;
|
|
11465
11476
|
if (entry.kind === "task_completed" || entry.kind === "task_failed" || entry.kind === "task_stalled") {
|
|
11466
11477
|
return false;
|
|
11467
11478
|
}
|
|
@@ -11481,7 +11492,7 @@ function findTerminalLedgerEvidenceForTask(args) {
|
|
|
11481
11492
|
const terminalTaskId = readNonEmptyString2(entry.payload?.taskId);
|
|
11482
11493
|
if (terminalTaskId !== taskId) continue;
|
|
11483
11494
|
if (entry.kind === "task_completed" && isWeakCompletionEvidence(entry.payload)) continue;
|
|
11484
|
-
if (args.sessionId && entry.sessionId && entry.sessionId
|
|
11495
|
+
if (args.sessionId && entry.sessionId && !sessionIdsEquivalent(entry.sessionId, args.sessionId)) continue;
|
|
11485
11496
|
if (!args.sessionId && args.nodeId && entry.nodeId && !meshNodeIdMatches(entry, args.nodeId)) continue;
|
|
11486
11497
|
return { id: entry.id, kind: entry.kind, payload: entry.payload || {}, timestamp: entry.timestamp };
|
|
11487
11498
|
}
|
|
@@ -11494,7 +11505,7 @@ function findDirectDispatchLedgerEntry(args) {
|
|
|
11494
11505
|
if (entry.kind !== "task_dispatched") continue;
|
|
11495
11506
|
const payloadTaskId = readNonEmptyString2(entry.payload?.taskId);
|
|
11496
11507
|
if (payloadTaskId !== args.taskId) continue;
|
|
11497
|
-
if (args.sessionId && entry.sessionId && entry.sessionId
|
|
11508
|
+
if (args.sessionId && entry.sessionId && !sessionIdsEquivalent(entry.sessionId, args.sessionId)) continue;
|
|
11498
11509
|
return {
|
|
11499
11510
|
id: entry.id,
|
|
11500
11511
|
timestamp: entry.timestamp,
|
|
@@ -11527,7 +11538,7 @@ function hasTerminalLedgerAfterDispatch(args) {
|
|
|
11527
11538
|
const terminalTaskId = readNonEmptyString2(entry.payload?.taskId);
|
|
11528
11539
|
if (terminalTaskId && terminalTaskId === args.taskId) return true;
|
|
11529
11540
|
if (terminalTaskId && terminalTaskId !== args.taskId) continue;
|
|
11530
|
-
if (args.sessionId && entry.sessionId
|
|
11541
|
+
if (args.sessionId && sessionIdsEquivalent(entry.sessionId, args.sessionId)) return true;
|
|
11531
11542
|
}
|
|
11532
11543
|
return false;
|
|
11533
11544
|
}
|
|
@@ -12856,7 +12867,7 @@ function nodeHasActiveMeshWork(components, meshId, nodeId, currentSessionId) {
|
|
|
12856
12867
|
const instNodeId = readNonEmptyString2(settings.meshNodeId) || readNonEmptyString2(settings.nodeId);
|
|
12857
12868
|
if (!daemonIdsEquivalent(instNodeId, nodeId)) return false;
|
|
12858
12869
|
const sessionId = readNonEmptyString2(state.instanceId);
|
|
12859
|
-
if (currentSessionId && sessionId
|
|
12870
|
+
if (currentSessionId && sessionIdsEquivalent(sessionId, currentSessionId) && isIdleSessionState(state)) return false;
|
|
12860
12871
|
return sessionStateLooksActive(state);
|
|
12861
12872
|
});
|
|
12862
12873
|
}
|
|
@@ -12930,11 +12941,11 @@ function activeProviderAssignedCount(meshId, nodeId, providerType) {
|
|
|
12930
12941
|
return getQueue(meshId, { status: ["assigned"] }).filter((task) => daemonIdsEquivalent(task.assignedNodeId, nodeId) && task.assignedProviderType === providerType).length;
|
|
12931
12942
|
}
|
|
12932
12943
|
function sessionHasActiveAssignment(meshId, sessionId) {
|
|
12933
|
-
if (getQueue(meshId, { status: ["assigned"] }).some((task) => task.assignedSessionId
|
|
12944
|
+
if (getQueue(meshId, { status: ["assigned"] }).some((task) => sessionIdsEquivalent(task.assignedSessionId, sessionId))) {
|
|
12934
12945
|
return true;
|
|
12935
12946
|
}
|
|
12936
12947
|
try {
|
|
12937
|
-
if (getActiveDirectDispatches(meshId).some((d) => d.sessionId
|
|
12948
|
+
if (getActiveDirectDispatches(meshId).some((d) => sessionIdsEquivalent(d.sessionId, sessionId))) return true;
|
|
12938
12949
|
if (hasUnterminalDirectDispatchLedgerEntry(meshId, sessionId)) return true;
|
|
12939
12950
|
} catch {
|
|
12940
12951
|
}
|
|
@@ -13070,11 +13081,16 @@ function readMeshNodeId(node) {
|
|
|
13070
13081
|
}
|
|
13071
13082
|
async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
13072
13083
|
const queue = getQueue(meshId);
|
|
13084
|
+
const statusById = new Map(queue.map((task) => [task.id, task.status]));
|
|
13073
13085
|
const pending = queue.filter((task) => task.status === "pending");
|
|
13074
13086
|
if (!pending.length) return false;
|
|
13075
13087
|
const maxParallelTasks = resolveMaxParallelTasks(mesh?.policy?.maxParallelTasks);
|
|
13076
13088
|
const maxReadonlyParallelTasks = resolveMaxReadonlyParallelTasks(maxParallelTasks);
|
|
13077
13089
|
for (const task of pending) {
|
|
13090
|
+
if (!taskDependenciesSatisfied(task, statusById)) {
|
|
13091
|
+
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "dependencies_unsatisfied" });
|
|
13092
|
+
continue;
|
|
13093
|
+
}
|
|
13078
13094
|
const isReadonly = isTaskReadonly(task);
|
|
13079
13095
|
if (isReadonly) {
|
|
13080
13096
|
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
@@ -13566,7 +13582,7 @@ function resolveWorkerDelegateRouting(components, instanceId, deps) {
|
|
|
13566
13582
|
if (coordinatorMeshId) {
|
|
13567
13583
|
let hasActiveDispatch = false;
|
|
13568
13584
|
try {
|
|
13569
|
-
hasActiveDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => d.sessionId
|
|
13585
|
+
hasActiveDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => sessionIdsEquivalent(d.sessionId, instanceId)) || hasUnterminalDirectDispatchLedgerEntry(coordinatorMeshId, instanceId);
|
|
13570
13586
|
} catch {
|
|
13571
13587
|
}
|
|
13572
13588
|
if (!hasActiveDispatch) return reject("coordinator_not_dispatch_target");
|
|
@@ -16140,7 +16156,7 @@ function hasRecentIntentionalCleanupStop(meshId, sessionId, nodeId) {
|
|
|
16140
16156
|
const timestamp = new Date(entry.timestamp).getTime();
|
|
16141
16157
|
if (!Number.isNaN(timestamp) && timestamp < cutoff) break;
|
|
16142
16158
|
if (!isIntentionalCleanupStopEntry(entry)) continue;
|
|
16143
|
-
if (sessionId && entry.sessionId
|
|
16159
|
+
if (sessionId && sessionIdsEquivalent(entry.sessionId, sessionId)) return true;
|
|
16144
16160
|
if (!sessionId && nodeId && meshNodeIdMatches(entry, nodeId)) return true;
|
|
16145
16161
|
}
|
|
16146
16162
|
return false;
|
|
@@ -16260,7 +16276,7 @@ function supersedesTruncatedTerminalSummary(args) {
|
|
|
16260
16276
|
}
|
|
16261
16277
|
function resolveActiveDirectDispatchTaskId(meshId, sessionId) {
|
|
16262
16278
|
try {
|
|
16263
|
-
const matches = getActiveDirectDispatches(meshId).filter((d) => d.sessionId
|
|
16279
|
+
const matches = getActiveDirectDispatches(meshId).filter((d) => sessionIdsEquivalent(d.sessionId, sessionId));
|
|
16264
16280
|
if (!matches.length) return void 0;
|
|
16265
16281
|
return readNonEmptyString2(matches[matches.length - 1].taskId) || void 0;
|
|
16266
16282
|
} catch {
|
|
@@ -17054,7 +17070,7 @@ function flushPendingForMeshIdleCoordinators(components, meshId) {
|
|
|
17054
17070
|
let delivered = 0;
|
|
17055
17071
|
for (const pending of pendingEvents) {
|
|
17056
17072
|
const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
|
|
17057
|
-
const targets = wantSession ? idleCoordinators.filter((c) => c.sessionId
|
|
17073
|
+
const targets = wantSession ? idleCoordinators.filter((c) => sessionIdsEquivalent(c.sessionId, wantSession)) : idleCoordinators;
|
|
17058
17074
|
if (targets.length === 0 || !pending.coordinatorMessage) {
|
|
17059
17075
|
try {
|
|
17060
17076
|
queuePendingMeshCoordinatorEvent(pending);
|
|
@@ -17109,7 +17125,7 @@ function setupMeshEventForwarding(components) {
|
|
|
17109
17125
|
}
|
|
17110
17126
|
let hasDirectDispatch = false;
|
|
17111
17127
|
try {
|
|
17112
|
-
hasDirectDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => d.sessionId
|
|
17128
|
+
hasDirectDispatch = getActiveDirectDispatches(coordinatorMeshId).some((d) => sessionIdsEquivalent(d.sessionId, flushInstanceId)) || hasUnterminalDirectDispatchLedgerEntry(coordinatorMeshId, flushInstanceId);
|
|
17113
17129
|
} catch {
|
|
17114
17130
|
}
|
|
17115
17131
|
if (!hasDirectDispatch) return;
|
|
@@ -17444,7 +17460,7 @@ function drainAndInjectIntoTargets(meshId, drainDaemonIds, localDaemonId, target
|
|
|
17444
17460
|
for (const pending of pendingEvents) {
|
|
17445
17461
|
const wantSession = readNonEmptyString2(pending.targetCoordinatorSessionId);
|
|
17446
17462
|
if (wantSession) {
|
|
17447
|
-
const matched = targetCoordinators.filter((c) => c.sessionId
|
|
17463
|
+
const matched = targetCoordinators.filter((c) => sessionIdsEquivalent(c.sessionId, wantSession));
|
|
17448
17464
|
if (matched.length === 0) {
|
|
17449
17465
|
holdOrExpireStrictUnmatchedEvent(pending, wantSession, meshId);
|
|
17450
17466
|
continue;
|
|
@@ -53842,7 +53858,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
53842
53858
|
const workspace = readStringValue(node?.workspace);
|
|
53843
53859
|
const daemonId = readStringValue(node?.daemonId);
|
|
53844
53860
|
const isSelfNode = Boolean(
|
|
53845
|
-
nodeId && selectedCoordinatorNodeId && nodeId
|
|
53861
|
+
nodeId && selectedCoordinatorNodeId && daemonIdsEquivalent(nodeId, selectedCoordinatorNodeId)
|
|
53846
53862
|
) || Boolean(
|
|
53847
53863
|
daemonId && (daemonIdsEquivalent(daemonId, args.localMachineId) || daemonIdsEquivalent(daemonId, args.statusInstanceId))
|
|
53848
53864
|
) || Boolean(args.meshSource !== "local_config" && nodeIndex === 0);
|
|
@@ -53904,7 +53920,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
53904
53920
|
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
53905
53921
|
const daemonId = readStringValue(node?.daemonId);
|
|
53906
53922
|
const isSelfNode = Boolean(
|
|
53907
|
-
nodeId && selectedCoordinatorNodeId && nodeId
|
|
53923
|
+
nodeId && selectedCoordinatorNodeId && daemonIdsEquivalent(nodeId, selectedCoordinatorNodeId)
|
|
53908
53924
|
) || Boolean(
|
|
53909
53925
|
daemonId && (daemonIdsEquivalent(daemonId, args.localMachineId) || daemonIdsEquivalent(daemonId, args.statusInstanceId))
|
|
53910
53926
|
);
|
|
@@ -53973,7 +53989,7 @@ function summarizeMeshSessionRecord(record) {
|
|
|
53973
53989
|
}
|
|
53974
53990
|
function liveSessionRecordMatchesMeshNode(record, meshId, nodeId, nodeWorkspace = "", nodeIsMissingLocalWorktree = false) {
|
|
53975
53991
|
const recordNodeId = readStringValue(record?.meta?.meshNodeId);
|
|
53976
|
-
if (!recordNodeId || recordNodeId
|
|
53992
|
+
if (!recordNodeId || !daemonIdsEquivalent(recordNodeId, nodeId)) return false;
|
|
53977
53993
|
if (nodeIsMissingLocalWorktree) return false;
|
|
53978
53994
|
const recordWorkspace = readStringValue(record?.workspace);
|
|
53979
53995
|
if (nodeWorkspace && recordWorkspace && !meshWorkspacesEquivalent(recordWorkspace, nodeWorkspace)) return false;
|
|
@@ -54005,7 +54021,7 @@ function collectLiveMeshSessionRecords(args) {
|
|
|
54005
54021
|
const nodeIsMissingLocalWorktree = args.node?.isLocalWorktree === true && !!nodeWorkspace && !fs29.existsSync(nodeWorkspace);
|
|
54006
54022
|
const matches = args.liveSessionRecords.filter((record) => {
|
|
54007
54023
|
const recordNodeId = readStringValue(record?.meta?.meshNodeId);
|
|
54008
|
-
if (recordNodeId && recordNodeId
|
|
54024
|
+
if (recordNodeId && !daemonIdsEquivalent(recordNodeId, args.nodeId)) return false;
|
|
54009
54025
|
if (liveSessionRecordMatchesMeshNode(record, args.meshId, args.nodeId, nodeWorkspace || "", nodeIsMissingLocalWorktree)) return true;
|
|
54010
54026
|
if (nodeIsMissingLocalWorktree) return false;
|
|
54011
54027
|
return !!nodeWorkspace && liveSessionRecordMatchesMeshWorkspace(record, args.meshId, nodeWorkspace);
|
|
@@ -54014,7 +54030,7 @@ function collectLiveMeshSessionRecords(args) {
|
|
|
54014
54030
|
for (const record of args.liveSessionRecords) {
|
|
54015
54031
|
if (readStringValue(record?.meta?.meshCoordinatorFor) !== args.meshId) continue;
|
|
54016
54032
|
const sessionId = readStringValue(record?.sessionId);
|
|
54017
|
-
if (sessionId && matches.some((entry) => readStringValue(entry?.sessionId)
|
|
54033
|
+
if (sessionId && matches.some((entry) => sessionIdsEquivalent(readStringValue(entry?.sessionId), sessionId))) continue;
|
|
54018
54034
|
matches.push(record);
|
|
54019
54035
|
}
|
|
54020
54036
|
}
|
|
@@ -66637,6 +66653,7 @@ export {
|
|
|
66637
66653
|
summarizeMeshMagiActivity,
|
|
66638
66654
|
summarizeMeshMission,
|
|
66639
66655
|
summarizeMissionTasks,
|
|
66656
|
+
taskDependenciesSatisfied,
|
|
66640
66657
|
tombstoneOperatingNote,
|
|
66641
66658
|
triggerMeshQueue,
|
|
66642
66659
|
unregisterMeshCoordinator,
|