adhdev 0.9.82-rc.61 → 0.9.82-rc.63
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/cli/index.js +78 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +78 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +8 -0
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -8184,12 +8184,34 @@ function sweepExpiredRemoteIdleSessions() {
|
|
|
8184
8184
|
if (session.expiresAt <= now) remoteIdleSessions.delete(key);
|
|
8185
8185
|
}
|
|
8186
8186
|
}
|
|
8187
|
+
function readRefineJobId(event) {
|
|
8188
|
+
const metadata = readRecord(event.metadataEvent) || event;
|
|
8189
|
+
const result = readRecord(metadata.result);
|
|
8190
|
+
const refineJob = readRecord(result?.refineJob);
|
|
8191
|
+
return readNonEmptyString2(metadata.jobId) || readNonEmptyString2(refineJob?.jobId);
|
|
8192
|
+
}
|
|
8193
|
+
function buildRefineTerminalEventFingerprint(meshId, eventName, metadataEvent) {
|
|
8194
|
+
const jobId = readRefineJobId({ metadataEvent });
|
|
8195
|
+
return jobId && REFINE_TERMINAL_EVENTS.has(eventName) ? `${meshId}::${eventName}::${jobId}` : "";
|
|
8196
|
+
}
|
|
8197
|
+
function hasPendingRefineTerminalEventDuplicate(event) {
|
|
8198
|
+
if (!REFINE_TERMINAL_EVENTS.has(event.event)) return false;
|
|
8199
|
+
const jobId = readRefineJobId(event);
|
|
8200
|
+
if (!jobId) return false;
|
|
8201
|
+
return getPendingMeshCoordinatorEvents(event.meshId).some(
|
|
8202
|
+
(pending) => pending.event === event.event && readRefineJobId(pending) === jobId
|
|
8203
|
+
);
|
|
8204
|
+
}
|
|
8187
8205
|
function getPendingEventsPath(meshId) {
|
|
8188
8206
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
8189
8207
|
return (0, import_path6.join)(getLedgerDir(), `${safe}.pending-events.jsonl`);
|
|
8190
8208
|
}
|
|
8191
8209
|
function queuePendingMeshCoordinatorEvent(event) {
|
|
8192
8210
|
try {
|
|
8211
|
+
if (hasPendingRefineTerminalEventDuplicate(event)) {
|
|
8212
|
+
LOG.info("MeshEvents", `Suppressed duplicate pending ${event.event} for refine job ${readRefineJobId(event)}`);
|
|
8213
|
+
return true;
|
|
8214
|
+
}
|
|
8193
8215
|
(0, import_fs7.appendFileSync)(getPendingEventsPath(event.meshId), JSON.stringify(event) + "\n", "utf-8");
|
|
8194
8216
|
return true;
|
|
8195
8217
|
} catch (e) {
|
|
@@ -8327,6 +8349,17 @@ function isDuplicateMeshCompletionEvent(args) {
|
|
|
8327
8349
|
recentCompletionFingerprints.set(fingerprint, now);
|
|
8328
8350
|
return false;
|
|
8329
8351
|
}
|
|
8352
|
+
function isDuplicateRefineTerminalEvent(meshId, eventName, metadataEvent) {
|
|
8353
|
+
const fingerprint = buildRefineTerminalEventFingerprint(meshId, eventName, metadataEvent);
|
|
8354
|
+
if (!fingerprint) return false;
|
|
8355
|
+
const now = Date.now();
|
|
8356
|
+
for (const [key, seenAt] of recentCompletionFingerprints.entries()) {
|
|
8357
|
+
if (now - seenAt > RECENT_COMPLETION_FINGERPRINT_TTL_MS) recentCompletionFingerprints.delete(key);
|
|
8358
|
+
}
|
|
8359
|
+
if (recentCompletionFingerprints.has(fingerprint)) return true;
|
|
8360
|
+
recentCompletionFingerprints.set(fingerprint, now);
|
|
8361
|
+
return false;
|
|
8362
|
+
}
|
|
8330
8363
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
8331
8364
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
8332
8365
|
if (!task) {
|
|
@@ -8669,6 +8702,32 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
8669
8702
|
if (args.event === "monitor:long_generating") {
|
|
8670
8703
|
return `[System] ${args.nodeLabel} has been generating for a long time${metadata}. Use mesh_read_chat once for a status check, but do not poll repeatedly.`;
|
|
8671
8704
|
}
|
|
8705
|
+
if (args.event === "refine:accepted") {
|
|
8706
|
+
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
8707
|
+
return `[System] Refinery accepted async job${jobId ? ` ${jobId}` : ""} for ${args.nodeLabel}. Completion/failure will be delivered as a terminal refine event; do not poll repeatedly.`;
|
|
8708
|
+
}
|
|
8709
|
+
if (args.event === "refine:completed") {
|
|
8710
|
+
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
8711
|
+
const result = readRecord(args.metadataEvent.result);
|
|
8712
|
+
const validationSummary = readRecord(result?.validationSummary);
|
|
8713
|
+
const validationStatus = readNonEmptyString2(validationSummary?.status);
|
|
8714
|
+
const into = readNonEmptyString2(result?.into);
|
|
8715
|
+
const branch = readNonEmptyString2(result?.branch);
|
|
8716
|
+
const details = [
|
|
8717
|
+
jobId ? `job_id=${jobId}` : "",
|
|
8718
|
+
branch && into ? `${branch}\u2192${into}` : "",
|
|
8719
|
+
validationStatus ? `validation=${validationStatus}` : ""
|
|
8720
|
+
].filter(Boolean).join("; ");
|
|
8721
|
+
return `[System] Refinery async job for ${args.nodeLabel} completed successfully${details ? ` (${details})` : ""}. The worktree was merged and cleanup completed; continue from the updated mesh state.`;
|
|
8722
|
+
}
|
|
8723
|
+
if (args.event === "refine:failed") {
|
|
8724
|
+
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
8725
|
+
const result = readRecord(args.metadataEvent.result);
|
|
8726
|
+
const code = readNonEmptyString2(result?.code);
|
|
8727
|
+
const error48 = readNonEmptyString2(result?.error);
|
|
8728
|
+
const details = [jobId ? `job_id=${jobId}` : "", code ? `code=${code}` : ""].filter(Boolean).join("; ");
|
|
8729
|
+
return `[System] Refinery async job for ${args.nodeLabel} failed${details ? ` (${details})` : ""}${error48 ? `: ${error48}` : "."} Review the terminal refine event/ledger before retrying.`;
|
|
8730
|
+
}
|
|
8672
8731
|
return "";
|
|
8673
8732
|
}
|
|
8674
8733
|
function injectMeshSystemMessage(components, args) {
|
|
@@ -8688,6 +8747,10 @@ function injectMeshSystemMessage(components, args) {
|
|
|
8688
8747
|
LOG.info("MeshEvents", `Suppressed ${args.event} for intentionally cleanup-stopped session ${eventSessionId || "(unknown session)"}`);
|
|
8689
8748
|
return { success: true, forwarded: 0, suppressed: true, intentionalCleanupStop: true };
|
|
8690
8749
|
}
|
|
8750
|
+
if (isDuplicateRefineTerminalEvent(args.meshId, args.event, args.metadataEvent)) {
|
|
8751
|
+
LOG.info("MeshEvents", `Suppressed duplicate ${args.event} for refine job ${readRefineJobId({ metadataEvent: args.metadataEvent })}`);
|
|
8752
|
+
return { success: true, forwarded: 0, suppressed: true, duplicateRefineTerminalEvent: true };
|
|
8753
|
+
}
|
|
8691
8754
|
const eventTimestamp = readEventTimestamp(args.metadataEvent.timestamp);
|
|
8692
8755
|
if (args.event === "agent:generating_completed" && eventSessionId) {
|
|
8693
8756
|
const duplicateCompletion = isDuplicateMeshCompletionEvent({
|
|
@@ -8937,6 +9000,14 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
8937
9000
|
providerType: readNonEmptyString2(payload.providerType),
|
|
8938
9001
|
providerSessionId: readNonEmptyString2(payload.providerSessionId),
|
|
8939
9002
|
finalSummary: readNonEmptyString2(payload.finalSummary) || readNonEmptyString2(payload.summary),
|
|
9003
|
+
jobId: readNonEmptyString2(payload.jobId),
|
|
9004
|
+
interactionId: readNonEmptyString2(payload.interactionId),
|
|
9005
|
+
status: readNonEmptyString2(payload.status),
|
|
9006
|
+
targetDaemonId: readNonEmptyString2(payload.targetDaemonId),
|
|
9007
|
+
startedAt: readNonEmptyString2(payload.startedAt),
|
|
9008
|
+
completedAt: readNonEmptyString2(payload.completedAt),
|
|
9009
|
+
retryOfJobId: readNonEmptyString2(payload.retryOfJobId),
|
|
9010
|
+
...payload.result && typeof payload.result === "object" && !Array.isArray(payload.result) ? { result: payload.result } : {},
|
|
8940
9011
|
...payload.timestamp !== void 0 ? { timestamp: payload.timestamp } : {},
|
|
8941
9012
|
intentional: payload.intentional === true,
|
|
8942
9013
|
intentionalStop: payload.intentionalStop === true,
|
|
@@ -8980,7 +9051,7 @@ function setupMeshEventForwarding(components) {
|
|
|
8980
9051
|
});
|
|
8981
9052
|
});
|
|
8982
9053
|
}
|
|
8983
|
-
var import_fs7, import_path6, REMOTE_IDLE_SESSION_TTL_MS, remoteIdleSessions, MESH_COORDINATOR_EVENTS, EVENT_TO_LEDGER_KIND, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, RECENT_COMPLETION_FINGERPRINT_TTL_MS, recentCompletionFingerprints, autoLaunchInProgress, autoLaunchCooldownUntil, AUTO_LAUNCH_COOLDOWN_MS;
|
|
9054
|
+
var import_fs7, import_path6, REMOTE_IDLE_SESSION_TTL_MS, remoteIdleSessions, REFINE_TERMINAL_EVENTS, MESH_COORDINATOR_EVENTS, EVENT_TO_LEDGER_KIND, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, RECENT_COMPLETION_FINGERPRINT_TTL_MS, recentCompletionFingerprints, autoLaunchInProgress, autoLaunchCooldownUntil, AUTO_LAUNCH_COOLDOWN_MS;
|
|
8984
9055
|
var init_mesh_events = __esm({
|
|
8985
9056
|
"../../oss/packages/daemon-core/src/mesh/mesh-events.ts"() {
|
|
8986
9057
|
"use strict";
|
|
@@ -8994,13 +9065,17 @@ var init_mesh_events = __esm({
|
|
|
8994
9065
|
init_mesh_work_queue();
|
|
8995
9066
|
REMOTE_IDLE_SESSION_TTL_MS = 5 * 60 * 1e3;
|
|
8996
9067
|
remoteIdleSessions = /* @__PURE__ */ new Map();
|
|
9068
|
+
REFINE_TERMINAL_EVENTS = /* @__PURE__ */ new Set(["refine:completed", "refine:failed"]);
|
|
8997
9069
|
MESH_COORDINATOR_EVENTS = /* @__PURE__ */ new Set([
|
|
8998
9070
|
"agent:generating_started",
|
|
8999
9071
|
"agent:generating_completed",
|
|
9000
9072
|
"agent:waiting_approval",
|
|
9001
9073
|
"agent:stopped",
|
|
9002
9074
|
"agent:ready",
|
|
9003
|
-
"monitor:long_generating"
|
|
9075
|
+
"monitor:long_generating",
|
|
9076
|
+
"refine:accepted",
|
|
9077
|
+
"refine:completed",
|
|
9078
|
+
"refine:failed"
|
|
9004
9079
|
]);
|
|
9005
9080
|
EVENT_TO_LEDGER_KIND = {
|
|
9006
9081
|
"agent:generating_completed": "task_completed",
|
|
@@ -101013,7 +101088,7 @@ var init_adhdev_daemon = __esm({
|
|
|
101013
101088
|
init_version();
|
|
101014
101089
|
init_src();
|
|
101015
101090
|
init_runtime_defaults();
|
|
101016
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
101091
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.63" });
|
|
101017
101092
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
101018
101093
|
localHttpServer = null;
|
|
101019
101094
|
localWss = null;
|