@adhdev/daemon-core 0.9.82-rc.379 → 0.9.82-rc.380
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 +50 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/mesh/mesh-event-forwarding.ts +59 -2
- package/src/mesh/mesh-events-stale.ts +42 -0
- package/src/mesh/mesh-reconcile-loop.ts +11 -0
package/dist/index.js
CHANGED
|
@@ -316,10 +316,10 @@ function readInjected(value) {
|
|
|
316
316
|
}
|
|
317
317
|
function getDaemonBuildInfo() {
|
|
318
318
|
if (cached) return cached;
|
|
319
|
-
const commit = readInjected(true ? "
|
|
320
|
-
const commitShort = readInjected(true ? "
|
|
321
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
322
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
319
|
+
const commit = readInjected(true ? "5fff0bee3f6a8e8f00989177c53d1d2a1cf607ad" : void 0) ?? "unknown";
|
|
320
|
+
const commitShort = readInjected(true ? "5fff0bee" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
321
|
+
const version = readInjected(true ? "0.9.82-rc.380" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
322
|
+
const builtAt = readInjected(true ? "2026-06-25T10:07:36.562Z" : void 0);
|
|
323
323
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
324
324
|
return cached;
|
|
325
325
|
}
|
|
@@ -9507,6 +9507,13 @@ function reconcileDirectDispatchCompletionFromTranscript(args) {
|
|
|
9507
9507
|
if (workerResult.source !== "final_summary_json" && !transcriptAfterDispatch) {
|
|
9508
9508
|
return { reconciled: false, reason: "transcript_not_proven_after_dispatch" };
|
|
9509
9509
|
}
|
|
9510
|
+
if (Number.isFinite(dispatchTime) && workerResult.source !== "final_summary_json") {
|
|
9511
|
+
const dispatchedToIdleSession = dispatch?.payload?.dispatchedToIdleSession === true;
|
|
9512
|
+
const graceMs = dispatchedToIdleSession ? DIRECT_DISPATCH_IDLE_SESSION_RECONCILE_GRACE_MS : DIRECT_DISPATCH_RECONCILE_GRACE_MS;
|
|
9513
|
+
if (Date.now() - dispatchTime < graceMs) {
|
|
9514
|
+
return { reconciled: false, reason: "direct_dispatch_grace_period" };
|
|
9515
|
+
}
|
|
9516
|
+
}
|
|
9510
9517
|
const workerFailed = workerResult.status === "failed" || workerResult.status !== "completed" && workerResult.errors.length > 0;
|
|
9511
9518
|
const kind = workerFailed ? "task_failed" : "task_completed";
|
|
9512
9519
|
const entry = appendLedgerEntry(args.meshId, {
|
|
@@ -9599,6 +9606,7 @@ function buildNoProgressCompletionReconciliation(args) {
|
|
|
9599
9606
|
terminalLedgerAt: terminal.timestamp
|
|
9600
9607
|
};
|
|
9601
9608
|
}
|
|
9609
|
+
var DIRECT_DISPATCH_RECONCILE_GRACE_MS, DIRECT_DISPATCH_IDLE_SESSION_RECONCILE_GRACE_MS;
|
|
9602
9610
|
var init_mesh_events_stale = __esm({
|
|
9603
9611
|
"src/mesh/mesh-events-stale.ts"() {
|
|
9604
9612
|
"use strict";
|
|
@@ -9608,6 +9616,8 @@ var init_mesh_events_stale = __esm({
|
|
|
9608
9616
|
init_mesh_events_pending();
|
|
9609
9617
|
init_mesh_events_utils();
|
|
9610
9618
|
init_dist();
|
|
9619
|
+
DIRECT_DISPATCH_RECONCILE_GRACE_MS = 6e4;
|
|
9620
|
+
DIRECT_DISPATCH_IDLE_SESSION_RECONCILE_GRACE_MS = 12e4;
|
|
9611
9621
|
}
|
|
9612
9622
|
});
|
|
9613
9623
|
|
|
@@ -13892,6 +13902,20 @@ function isDuplicateRefineTerminalEvent(meshId, eventName, metadataEvent) {
|
|
|
13892
13902
|
recordFingerprintSeen(fingerprint);
|
|
13893
13903
|
return false;
|
|
13894
13904
|
}
|
|
13905
|
+
function isSynthesizedReconciledTerminal(terminalPayload) {
|
|
13906
|
+
const source = readNonEmptyString2(terminalPayload.source);
|
|
13907
|
+
if (source && RECONCILED_COMPLETION_SOURCES.has(source)) return true;
|
|
13908
|
+
const diagnostic = terminalPayload.completionDiagnostic;
|
|
13909
|
+
if (diagnostic && typeof diagnostic === "object" && !Array.isArray(diagnostic)) {
|
|
13910
|
+
const reason = readNonEmptyString2(diagnostic.reason);
|
|
13911
|
+
if (reason && RECONCILED_COMPLETION_SOURCES.has(reason)) return true;
|
|
13912
|
+
}
|
|
13913
|
+
return false;
|
|
13914
|
+
}
|
|
13915
|
+
function isRealProviderCompletionEvent(metadataEvent) {
|
|
13916
|
+
const source = readNonEmptyString2(metadataEvent.source);
|
|
13917
|
+
return !source || !RECONCILED_COMPLETION_SOURCES.has(source);
|
|
13918
|
+
}
|
|
13895
13919
|
function isGenuineCompletionEvidence(metadataEvent) {
|
|
13896
13920
|
if (isFalseIdleCompletion(metadataEvent)) return false;
|
|
13897
13921
|
return !!readWorkerResultMetadata(metadataEvent) || !!readNonEmptyString2(metadataEvent.finalSummary);
|
|
@@ -14002,7 +14026,8 @@ function evaluateMeshEventSuppression(args, ctx) {
|
|
|
14002
14026
|
terminalTaskId,
|
|
14003
14027
|
eventTaskId
|
|
14004
14028
|
});
|
|
14005
|
-
|
|
14029
|
+
const supersedesSynthesizedTerminal = isSynthesizedReconciledTerminal(terminal.payload) && isRealProviderCompletionEvent(args.metadataEvent) && isGenuineCompletionEvidence(args.metadataEvent);
|
|
14030
|
+
if (!newDispatchAfterTerminal && !supersedesWeakTerminal && !distinctTaskCompletion && !supersedesTruncatedTerminal && !supersedesSynthesizedTerminal) {
|
|
14006
14031
|
const terminalProviderSessionId = readNonEmptyString2(terminal.payload.providerSessionId);
|
|
14007
14032
|
const terminalFinalSummary = readNonEmptyString2(terminal.payload.finalSummary);
|
|
14008
14033
|
const eventProviderSessionId = readNonEmptyString2(args.metadataEvent.providerSessionId);
|
|
@@ -14489,7 +14514,7 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
14489
14514
|
return { success: false, error: "meshId required" };
|
|
14490
14515
|
}
|
|
14491
14516
|
traceMeshEventStage("received", {
|
|
14492
|
-
taskId: payload.taskId,
|
|
14517
|
+
taskId: readNonEmptyString2(payload.taskId) || readNonEmptyString2(payload.meshActiveTaskId),
|
|
14493
14518
|
sessionId: readNonEmptyString2(payload.targetSessionId) || readNonEmptyString2(payload.sessionId),
|
|
14494
14519
|
nodeId,
|
|
14495
14520
|
meshId,
|
|
@@ -14649,7 +14674,7 @@ function setupMeshEventForwarding(components) {
|
|
|
14649
14674
|
});
|
|
14650
14675
|
});
|
|
14651
14676
|
}
|
|
14652
|
-
var REMOTE_IDLE_SESSION_TTL_MS, meshByWorkspaceCache, MESH_WORKSPACE_CACHE_TTL_MS, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, RECENT_COMPLETION_FINGERPRINT_TTL_MS, coordinatorForwardLanes;
|
|
14677
|
+
var REMOTE_IDLE_SESSION_TTL_MS, meshByWorkspaceCache, MESH_WORKSPACE_CACHE_TTL_MS, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, RECENT_COMPLETION_FINGERPRINT_TTL_MS, RECONCILED_COMPLETION_SOURCES, coordinatorForwardLanes;
|
|
14653
14678
|
var init_mesh_event_forwarding = __esm({
|
|
14654
14679
|
"src/mesh/mesh-event-forwarding.ts"() {
|
|
14655
14680
|
"use strict";
|
|
@@ -14676,6 +14701,12 @@ var init_mesh_event_forwarding = __esm({
|
|
|
14676
14701
|
MESH_WORKSPACE_CACHE_TTL_MS = 5e3;
|
|
14677
14702
|
INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS = 30 * 60 * 1e3;
|
|
14678
14703
|
RECENT_COMPLETION_FINGERPRINT_TTL_MS = 10 * 60 * 1e3;
|
|
14704
|
+
RECONCILED_COMPLETION_SOURCES = /* @__PURE__ */ new Set([
|
|
14705
|
+
"direct_task_transcript_reconciliation",
|
|
14706
|
+
"daemon_reconcile_transcript_completion",
|
|
14707
|
+
"mcp_mesh_status_transcript_reconciliation",
|
|
14708
|
+
"no_progress_reconciliation"
|
|
14709
|
+
]);
|
|
14679
14710
|
coordinatorForwardLanes = /* @__PURE__ */ new Map();
|
|
14680
14711
|
}
|
|
14681
14712
|
});
|
|
@@ -15388,7 +15419,18 @@ function buildForwardPayloadFromPending(event) {
|
|
|
15388
15419
|
// top-level field through explicitly too so the handleMeshForwardEvent whitelist
|
|
15389
15420
|
// recovers it regardless of which carrier the producing daemon used.
|
|
15390
15421
|
...readNonEmptyString2(event?.targetCoordinatorSessionId) ? { targetCoordinatorSessionId: readNonEmptyString2(event.targetCoordinatorSessionId) } : {},
|
|
15391
|
-
...metadata
|
|
15422
|
+
...metadata,
|
|
15423
|
+
// NOTIF-MISS (FIX 3): surface the dispatch task id at the TOP LEVEL so the relay's
|
|
15424
|
+
// received-stage trace (and buildRelayMetadataEvent) recovers it regardless of which
|
|
15425
|
+
// carrier the producing daemon used. The metadata spread above may carry the id only as
|
|
15426
|
+
// `meshActiveTaskId` (a worker provider event), leaving top-level `taskId` unset and the
|
|
15427
|
+
// received stage rendering `task=-`. Resolve both carriers into an explicit `taskId` so
|
|
15428
|
+
// dedup stays task-scoped end-to-end. Only set when a non-empty id exists (no clobber to
|
|
15429
|
+
// undefined when neither is present).
|
|
15430
|
+
...(() => {
|
|
15431
|
+
const tid = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(metadata.meshActiveTaskId);
|
|
15432
|
+
return tid ? { taskId: tid } : {};
|
|
15433
|
+
})()
|
|
15392
15434
|
};
|
|
15393
15435
|
}
|
|
15394
15436
|
function setupMeshReconcileLoop(components) {
|