@adhdev/daemon-core 0.9.82-rc.78 → 0.9.82-rc.79
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 +74 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -39
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events.d.ts +1 -0
- package/package.json +1 -1
- package/src/commands/router.ts +44 -28
- package/src/mesh/mesh-events.ts +40 -11
package/dist/index.js
CHANGED
|
@@ -3068,27 +3068,46 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
3068
3068
|
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
3069
3069
|
const result = readRecord(args.metadataEvent.result);
|
|
3070
3070
|
const validationSummary = readRecord(result?.validationSummary);
|
|
3071
|
+
const patchEquivalence = readRecord(result?.patchEquivalence);
|
|
3072
|
+
const finalConvergence = readRecord(result?.finalBranchConvergenceState);
|
|
3071
3073
|
const validationStatus = readNonEmptyString2(validationSummary?.status);
|
|
3074
|
+
const patchStatus = readNonEmptyString2(patchEquivalence?.status) || (patchEquivalence?.equivalent === true ? "passed" : "");
|
|
3072
3075
|
const into = readNonEmptyString2(result?.into);
|
|
3073
3076
|
const branch = readNonEmptyString2(result?.branch);
|
|
3077
|
+
const mergeStatus = result?.merged === true ? "merged" : readNonEmptyString2(finalConvergence?.status);
|
|
3078
|
+
const convergenceStatus = readNonEmptyString2(finalConvergence?.status);
|
|
3079
|
+
const nextStep = readNonEmptyString2(result?.nextStep) || readNonEmptyString2(finalConvergence?.nextStep) || "Continue from the updated mesh state.";
|
|
3074
3080
|
const details = [
|
|
3075
3081
|
jobId ? `job_id=${jobId}` : "",
|
|
3076
3082
|
branch && into ? `${branch}\u2192${into}` : "",
|
|
3077
|
-
validationStatus ? `validation=${validationStatus}` : ""
|
|
3083
|
+
validationStatus ? `validation=${validationStatus}` : "",
|
|
3084
|
+
patchStatus ? `patch_equivalence=${patchStatus}` : "",
|
|
3085
|
+
mergeStatus ? `merge=${mergeStatus}` : "",
|
|
3086
|
+
convergenceStatus ? `final_convergence=${convergenceStatus}` : ""
|
|
3078
3087
|
].filter(Boolean).join("; ");
|
|
3079
|
-
return `[System] Refinery async job for ${args.nodeLabel} completed successfully${details ? ` (${details})` : ""}.
|
|
3088
|
+
return `[System] Refinery async job for ${args.nodeLabel} completed successfully${details ? ` (${details})` : ""}.
|
|
3089
|
+
Next step: ${nextStep}`;
|
|
3080
3090
|
}
|
|
3081
3091
|
if (args.event === "refine:failed") {
|
|
3082
3092
|
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
3083
3093
|
const result = readRecord(args.metadataEvent.result);
|
|
3094
|
+
const validationSummary = readRecord(result?.validationSummary);
|
|
3095
|
+
const patchEquivalence = readRecord(result?.patchEquivalence);
|
|
3096
|
+
const finalConvergence = readRecord(result?.finalBranchConvergenceState);
|
|
3084
3097
|
const code = readNonEmptyString2(result?.code);
|
|
3085
3098
|
const error = readNonEmptyString2(result?.error);
|
|
3086
|
-
const
|
|
3099
|
+
const validationStatus = readNonEmptyString2(validationSummary?.status);
|
|
3100
|
+
const patchStatus = readNonEmptyString2(patchEquivalence?.status) || (patchEquivalence?.equivalent === true ? "passed" : "");
|
|
3101
|
+
const mergeStatus = result?.merged === true ? "merged" : finalConvergence?.merged === false ? "not_merged" : "";
|
|
3102
|
+
const convergenceStatus = readNonEmptyString2(result?.convergenceStatus) || readNonEmptyString2(finalConvergence?.status);
|
|
3087
3103
|
const blockedReason = readNonEmptyString2(result?.blockedReason);
|
|
3088
|
-
const nextStep = readNonEmptyString2(result?.nextStep) || readNonEmptyString2(
|
|
3104
|
+
const nextStep = readNonEmptyString2(result?.nextStep) || readNonEmptyString2(finalConvergence?.nextStep);
|
|
3089
3105
|
const details = [
|
|
3090
3106
|
jobId ? `job_id=${jobId}` : "",
|
|
3091
3107
|
code ? `code=${code}` : "",
|
|
3108
|
+
validationStatus ? `validation=${validationStatus}` : "",
|
|
3109
|
+
patchStatus ? `patch_equivalence=${patchStatus}` : "",
|
|
3110
|
+
mergeStatus ? `merge=${mergeStatus}` : "",
|
|
3092
3111
|
convergenceStatus ? `convergence=${convergenceStatus}` : "",
|
|
3093
3112
|
blockedReason ? `reason=${blockedReason}` : ""
|
|
3094
3113
|
].filter(Boolean).join("; ");
|
|
@@ -3314,6 +3333,13 @@ function injectMeshSystemMessage(components, args) {
|
|
|
3314
3333
|
LOG.warn("MeshRecovery", `Failed to build recovery context: ${e?.message || e}`);
|
|
3315
3334
|
}
|
|
3316
3335
|
}
|
|
3336
|
+
const messageText = buildMeshSystemMessage({
|
|
3337
|
+
event: args.event,
|
|
3338
|
+
nodeLabel: args.nodeLabel,
|
|
3339
|
+
metadataEvent: args.metadataEvent,
|
|
3340
|
+
recoveryContext
|
|
3341
|
+
});
|
|
3342
|
+
if (!messageText) return { success: false, error: "unsupported mesh event" };
|
|
3317
3343
|
const coordinatorInstances = components.instanceManager.getByCategory("cli").filter((inst) => {
|
|
3318
3344
|
const instState = inst.getState();
|
|
3319
3345
|
if (instState.settings?.meshCoordinatorFor !== args.meshId) return false;
|
|
@@ -3331,19 +3357,13 @@ function injectMeshSystemMessage(components, args) {
|
|
|
3331
3357
|
...args.metadataEvent,
|
|
3332
3358
|
...recoveryContext ? { recoveryContext } : {}
|
|
3333
3359
|
},
|
|
3360
|
+
coordinatorMessage: messageText,
|
|
3334
3361
|
queuedAt: Date.now()
|
|
3335
3362
|
})) {
|
|
3336
3363
|
LOG.info("MeshEvents", `Queued ${args.event} for MCP coordinator (mesh ${args.meshId})`);
|
|
3337
3364
|
}
|
|
3338
3365
|
return { success: true, forwarded: 0 };
|
|
3339
3366
|
}
|
|
3340
|
-
const messageText = buildMeshSystemMessage({
|
|
3341
|
-
event: args.event,
|
|
3342
|
-
nodeLabel: args.nodeLabel,
|
|
3343
|
-
metadataEvent: args.metadataEvent,
|
|
3344
|
-
recoveryContext
|
|
3345
|
-
});
|
|
3346
|
-
if (!messageText) return { success: false, error: "unsupported mesh event" };
|
|
3347
3367
|
for (const coord of coordinatorInstances) {
|
|
3348
3368
|
const coordState = coord.getState();
|
|
3349
3369
|
LOG.info("MeshEvents", `Forwarding mesh event to coordinator ${coordState.instanceId}`);
|
|
@@ -26719,16 +26739,9 @@ async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree) {
|
|
|
26719
26739
|
});
|
|
26720
26740
|
return String(stdout || "");
|
|
26721
26741
|
};
|
|
26722
|
-
const verifyRemoteMainContainsCommit = async (
|
|
26723
|
-
|
|
26724
|
-
|
|
26725
|
-
await runGit2(probeDir, ["init", "-q"]);
|
|
26726
|
-
await runGit2(probeDir, ["-c", "protocol.file.allow=always", "fetch", "--depth=1", remoteUrl, `refs/heads/${branch}:refs/remotes/origin/${branch}`]);
|
|
26727
|
-
await runGit2(probeDir, ["cat-file", "-e", `${commit}^{commit}`]);
|
|
26728
|
-
await runGit2(probeDir, ["merge-base", "--is-ancestor", commit, `refs/remotes/origin/${branch}`]);
|
|
26729
|
-
} finally {
|
|
26730
|
-
fs11.rmSync(probeDir, { recursive: true, force: true });
|
|
26731
|
-
}
|
|
26742
|
+
const verifyRemoteMainContainsCommit = async (submodulePath, commit, branch = "main") => {
|
|
26743
|
+
await runGit2(submodulePath, ["-c", "protocol.file.allow=always", "fetch", "origin", `refs/heads/${branch}:refs/remotes/origin/${branch}`]);
|
|
26744
|
+
await runGit2(submodulePath, ["merge-base", "--is-ancestor", commit, `refs/remotes/origin/${branch}`]);
|
|
26732
26745
|
};
|
|
26733
26746
|
const treeOutput = await runGit2(repoRoot, ["ls-tree", "-r", "-z", mergedTree]);
|
|
26734
26747
|
const gitlinks = treeOutput.split("\0").filter(Boolean).map((record) => {
|
|
@@ -26770,7 +26783,7 @@ async function runMeshRefineSubmoduleReachabilityGate(repoRoot, mergedTree) {
|
|
|
26770
26783
|
continue;
|
|
26771
26784
|
}
|
|
26772
26785
|
entry.remoteMainBranch = "main";
|
|
26773
|
-
await verifyRemoteMainContainsCommit(
|
|
26786
|
+
await verifyRemoteMainContainsCommit(submodulePath, gitlink.commit, "main");
|
|
26774
26787
|
entry.fetchedFromOrigin = true;
|
|
26775
26788
|
entry.remoteReachable = true;
|
|
26776
26789
|
entry.remoteMainReachable = true;
|
|
@@ -27755,28 +27768,51 @@ var DaemonCommandRouter = class {
|
|
|
27755
27768
|
};
|
|
27756
27769
|
}
|
|
27757
27770
|
queueRefineJobEvent(event, handle, result) {
|
|
27758
|
-
|
|
27771
|
+
const metadataEvent = {
|
|
27772
|
+
source: "refine_mesh_node_async_job",
|
|
27773
|
+
jobId: handle.jobId,
|
|
27774
|
+
interactionId: handle.interactionId,
|
|
27775
|
+
meshId: handle.meshId,
|
|
27776
|
+
nodeId: handle.targetNodeId,
|
|
27777
|
+
targetDaemonId: handle.targetDaemonId,
|
|
27778
|
+
workspace: handle.workspace,
|
|
27779
|
+
status: handle.status,
|
|
27780
|
+
startedAt: handle.startedAt,
|
|
27781
|
+
completedAt: handle.completedAt,
|
|
27782
|
+
retryOfJobId: handle.retryOfJobId,
|
|
27783
|
+
...result ? { result } : {}
|
|
27784
|
+
};
|
|
27785
|
+
const eventPayload = {
|
|
27759
27786
|
event,
|
|
27760
27787
|
meshId: handle.meshId,
|
|
27761
27788
|
nodeLabel: handle.targetNodeId,
|
|
27762
27789
|
nodeId: handle.targetNodeId,
|
|
27763
27790
|
workspace: handle.workspace,
|
|
27764
|
-
metadataEvent
|
|
27765
|
-
source: "refine_mesh_node_async_job",
|
|
27766
|
-
jobId: handle.jobId,
|
|
27767
|
-
interactionId: handle.interactionId,
|
|
27768
|
-
meshId: handle.meshId,
|
|
27769
|
-
nodeId: handle.targetNodeId,
|
|
27770
|
-
targetDaemonId: handle.targetDaemonId,
|
|
27771
|
-
workspace: handle.workspace,
|
|
27772
|
-
status: handle.status,
|
|
27773
|
-
startedAt: handle.startedAt,
|
|
27774
|
-
completedAt: handle.completedAt,
|
|
27775
|
-
retryOfJobId: handle.retryOfJobId,
|
|
27776
|
-
...result ? { result } : {}
|
|
27777
|
-
},
|
|
27791
|
+
metadataEvent,
|
|
27778
27792
|
queuedAt: Date.now()
|
|
27779
|
-
}
|
|
27793
|
+
};
|
|
27794
|
+
if (typeof this.deps.instanceManager?.getByCategory === "function") {
|
|
27795
|
+
const forwarded = handleMeshForwardEvent(
|
|
27796
|
+
{ instanceManager: this.deps.instanceManager },
|
|
27797
|
+
{
|
|
27798
|
+
event,
|
|
27799
|
+
meshId: handle.meshId,
|
|
27800
|
+
nodeId: handle.targetNodeId,
|
|
27801
|
+
workspace: handle.workspace,
|
|
27802
|
+
jobId: handle.jobId,
|
|
27803
|
+
interactionId: handle.interactionId,
|
|
27804
|
+
status: handle.status,
|
|
27805
|
+
targetDaemonId: handle.targetDaemonId,
|
|
27806
|
+
startedAt: handle.startedAt,
|
|
27807
|
+
completedAt: handle.completedAt,
|
|
27808
|
+
retryOfJobId: handle.retryOfJobId,
|
|
27809
|
+
...result ? { result } : {}
|
|
27810
|
+
}
|
|
27811
|
+
);
|
|
27812
|
+
if (forwarded?.success === true) return;
|
|
27813
|
+
LOG.warn("Mesh", `[Refinery] Failed to forward async refine event ${event}: ${forwarded?.error || "unknown error"}`);
|
|
27814
|
+
}
|
|
27815
|
+
queuePendingMeshCoordinatorEvent(eventPayload);
|
|
27780
27816
|
}
|
|
27781
27817
|
async appendRefineJobLedger(kind, handle, result) {
|
|
27782
27818
|
try {
|