@adhdev/daemon-standalone 1.0.49-rc.2 → 1.0.49-rc.4
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 +72 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/index-BiHPbQCY.css +1 -0
- package/public/assets/index-Dj0jcA3L.js +116 -0
- package/public/index.html +2 -2
- package/vendor/mcp-server/index.js.map +1 -1
- package/public/assets/index-B4B4DlD2.css +0 -1
- package/public/assets/index-Cm29rNCu.js +0 -116
package/dist/index.js
CHANGED
|
@@ -37056,10 +37056,10 @@ var require_dist3 = __commonJS({
|
|
|
37056
37056
|
}
|
|
37057
37057
|
function getDaemonBuildInfo() {
|
|
37058
37058
|
if (cached2) return cached2;
|
|
37059
|
-
const commit = readInjected(true ? "
|
|
37060
|
-
const commitShort = readInjected(true ? "
|
|
37061
|
-
const version2 = readInjected(true ? "1.0.49-rc.
|
|
37062
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
37059
|
+
const commit = readInjected(true ? "9884122c80eb621bb1e4da9f0269c9bb2e8421fe" : void 0) ?? "unknown";
|
|
37060
|
+
const commitShort = readInjected(true ? "9884122c" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
37061
|
+
const version2 = readInjected(true ? "1.0.49-rc.4" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
37062
|
+
const builtAt = readInjected(true ? "2026-08-14T10:06:01.458Z" : void 0);
|
|
37063
37063
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
37064
37064
|
return cached2;
|
|
37065
37065
|
}
|
|
@@ -42270,6 +42270,8 @@ ${error48.message || ""}`;
|
|
|
42270
42270
|
interpolateArgs: () => interpolateArgs,
|
|
42271
42271
|
interpolateString: () => interpolateString,
|
|
42272
42272
|
isMeshTaskDifficulty: () => isMeshTaskDifficulty,
|
|
42273
|
+
isPhantomDaemonEntry: () => isPhantomDaemonEntry,
|
|
42274
|
+
isRawDaemonDoId: () => isRawDaemonDoId,
|
|
42273
42275
|
joinRepoPath: () => joinRepoPath,
|
|
42274
42276
|
machineCoreFromDaemonId: () => machineCoreFromDaemonId,
|
|
42275
42277
|
meshNodeIdMatches: () => meshNodeIdMatches,
|
|
@@ -42565,6 +42567,18 @@ ${error48.message || ""}`;
|
|
|
42565
42567
|
if (!left || !right) return false;
|
|
42566
42568
|
return left === right;
|
|
42567
42569
|
}
|
|
42570
|
+
function isRawDaemonDoId(id) {
|
|
42571
|
+
const trimmed = readString2(id);
|
|
42572
|
+
return !!trimmed && /^[0-9a-f]{64}$/i.test(trimmed);
|
|
42573
|
+
}
|
|
42574
|
+
function isPhantomDaemonEntry(entry) {
|
|
42575
|
+
if (!entry) return false;
|
|
42576
|
+
if (!isRawDaemonDoId(entry.id)) return false;
|
|
42577
|
+
const hasMachineEvidence = Boolean(
|
|
42578
|
+
readString2(entry.machineNickname) || readString2(entry.nickname) || readString2(entry.hostname) || readString2(entry.platform) || readString2(entry.machine?.hostname) || readString2(entry.machine?.platform) || readString2(entry.machineId) || Array.isArray(entry.sessions) && entry.sessions.length > 0
|
|
42579
|
+
);
|
|
42580
|
+
return !hasMachineEvidence;
|
|
42581
|
+
}
|
|
42568
42582
|
function machineCoreFromDaemonId(id) {
|
|
42569
42583
|
const trimmed = readString2(id);
|
|
42570
42584
|
if (!trimmed) return void 0;
|
|
@@ -55444,6 +55458,8 @@ ${rendered}`, "utf-8");
|
|
|
55444
55458
|
});
|
|
55445
55459
|
function readProviderPriorityFromPolicy(policy) {
|
|
55446
55460
|
const record2 = policy && typeof policy === "object" && !Array.isArray(policy) ? policy : {};
|
|
55461
|
+
const derived = deriveProviderPriorityFromSlots(record2.slots);
|
|
55462
|
+
if (derived.length) return derived;
|
|
55447
55463
|
const raw = record2.providerPriority;
|
|
55448
55464
|
if (Array.isArray(raw)) {
|
|
55449
55465
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -55454,7 +55470,7 @@ ${rendered}`, "utf-8");
|
|
|
55454
55470
|
});
|
|
55455
55471
|
if (explicit.length) return explicit;
|
|
55456
55472
|
}
|
|
55457
|
-
return
|
|
55473
|
+
return [];
|
|
55458
55474
|
}
|
|
55459
55475
|
function normalizeProviderRoles(value) {
|
|
55460
55476
|
if (!Array.isArray(value)) return [];
|
|
@@ -55536,7 +55552,7 @@ ${rendered}`, "utf-8");
|
|
|
55536
55552
|
const workspace = readStringValue(node.workspace, node.repoRoot, node.repo_root);
|
|
55537
55553
|
const workspaceName = workspace ? workingDirBasename(workspace) : void 0;
|
|
55538
55554
|
const host = readStringValue(node.machineName, node.machine_name, node.hostname, node.host, node.daemonId, node.daemon_id, node.machineId, node.machine_id);
|
|
55539
|
-
const provider = providerPriority[0] || (Array.isArray(node.providers) ? readStringValue(...node.providers) : void 0);
|
|
55555
|
+
const provider = readProviderPriorityFromPolicy(node.policy)[0] || providerPriority[0] || (Array.isArray(node.providers) ? readStringValue(...node.providers) : void 0);
|
|
55540
55556
|
const parts = [workspaceName, host, provider].filter(Boolean);
|
|
55541
55557
|
if (parts.length > 0) return parts.join(" \xB7 ");
|
|
55542
55558
|
return nodeId || "unidentified mesh node";
|
|
@@ -110583,7 +110599,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
110583
110599
|
...slots.length ? { slots } : {}
|
|
110584
110600
|
};
|
|
110585
110601
|
if (providerRoles.length) migrateProviderRolesToSlots2(policy);
|
|
110586
|
-
|
|
110602
|
+
syncProviderPriorityFromSlots(policy);
|
|
110587
110603
|
const role = normalizeMeshDaemonRole(args?.role);
|
|
110588
110604
|
const daemonId = typeof args?.daemonId === "string" && args.daemonId.trim() ? args.daemonId.trim() : void 0;
|
|
110589
110605
|
const machineId = typeof args?.machineId === "string" && args.machineId.trim() ? args.machineId.trim() : void 0;
|
|
@@ -110635,10 +110651,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
110635
110651
|
else delete policy.providerRoles;
|
|
110636
110652
|
}
|
|
110637
110653
|
migrateProviderRolesToSlots2(policy);
|
|
110638
|
-
|
|
110639
|
-
|
|
110640
|
-
syncProviderPriorityFromSlots(policy, finalSlots);
|
|
110641
|
-
}
|
|
110654
|
+
const finalSlots = Object.prototype.hasOwnProperty.call(policy, "slots") ? policy.slots : getMesh2(meshId)?.nodes.find((n) => n.id === nodeId)?.policy?.slots;
|
|
110655
|
+
syncProviderPriorityFromSlots(policy, finalSlots);
|
|
110642
110656
|
const patch = { policy };
|
|
110643
110657
|
if (typeof args?.systemPrompt === "string") {
|
|
110644
110658
|
const trimmed = args.systemPrompt.trim();
|
|
@@ -110663,9 +110677,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
110663
110677
|
...inlineNode.policy && typeof inlineNode.policy === "object" && !Array.isArray(inlineNode.policy) ? inlineNode.policy : {},
|
|
110664
110678
|
...patch.policy
|
|
110665
110679
|
};
|
|
110666
|
-
|
|
110667
|
-
syncProviderPriorityFromSlots(inlineNode.policy);
|
|
110668
|
-
}
|
|
110680
|
+
syncProviderPriorityFromSlots(inlineNode.policy);
|
|
110669
110681
|
if (Object.prototype.hasOwnProperty.call(patch, "systemPrompt")) {
|
|
110670
110682
|
const sp = patch.systemPrompt;
|
|
110671
110683
|
if (typeof sp === "string" && sp.trim()) inlineNode.systemPrompt = sp;
|
|
@@ -113669,6 +113681,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
113669
113681
|
init_dist();
|
|
113670
113682
|
init_mesh_events();
|
|
113671
113683
|
init_mesh_reconcile_identity();
|
|
113684
|
+
init_mesh_reconcile_acked_hold();
|
|
113672
113685
|
init_mesh_fast_forward();
|
|
113673
113686
|
var import_node_child_process7 = require("child_process");
|
|
113674
113687
|
var import_node_util5 = require("util");
|
|
@@ -115671,11 +115684,20 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
115671
115684
|
LOG2.warn("Mesh", `[Refinery] Failed to append async refine ledger entry: ${e?.message || e}`);
|
|
115672
115685
|
}
|
|
115673
115686
|
}
|
|
115687
|
+
function resolveRefineResumeDispatchGraceMs() {
|
|
115688
|
+
return resolveTunedReconcileMs("MESH_REFINE_RESUME_DISPATCH_GRACE_MS", 6e4, 0, 10 * 6e4);
|
|
115689
|
+
}
|
|
115690
|
+
function resolveRefineResumeZombieCutoffMs() {
|
|
115691
|
+
return resolveTunedReconcileMs("MESH_REFINE_RESUME_ZOMBIE_CUTOFF_MS", 24 * 60 * 6e4, 5 * 6e4, 30 * 24 * 60 * 6e4);
|
|
115692
|
+
}
|
|
115674
115693
|
async function resumePendingRefineJobsOnStartup(self) {
|
|
115675
115694
|
try {
|
|
115676
115695
|
const { listMeshes: listMeshes2 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
115677
115696
|
const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
115678
115697
|
const meshIds = listMeshes2().map((m) => m.id).filter(Boolean);
|
|
115698
|
+
const nowMs = Date.now();
|
|
115699
|
+
const dispatchGraceMs = resolveRefineResumeDispatchGraceMs();
|
|
115700
|
+
const zombieCutoffMs = resolveRefineResumeZombieCutoffMs();
|
|
115679
115701
|
for (const meshId of meshIds) {
|
|
115680
115702
|
const entries = readLedgerEntries2(meshId, { kind: ["task_dispatched", "task_completed", "task_failed"] });
|
|
115681
115703
|
const terminal = /* @__PURE__ */ new Set();
|
|
@@ -115693,10 +115715,44 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
115693
115715
|
if (!jobId || terminal.has(`${e.nodeId}:${jobId}`)) continue;
|
|
115694
115716
|
const key2 = buildRefineJobKey(self, meshId, e.nodeId);
|
|
115695
115717
|
if (self.runningRefineJobs.has(key2)) continue;
|
|
115718
|
+
const dispatchedAtMs = new Date(e.timestamp).getTime();
|
|
115719
|
+
const ageMs2 = Number.isFinite(dispatchedAtMs) ? nowMs - dispatchedAtMs : void 0;
|
|
115720
|
+
if (ageMs2 !== void 0 && ageMs2 >= 0 && ageMs2 < dispatchGraceMs) {
|
|
115721
|
+
LOG2.info("Mesh", `[Refinery] Deferring resume of refine job for node ${e.nodeId} (jobId=${jobId}) \u2014 dispatched ${ageMs2}ms ago, within the ${dispatchGraceMs}ms grace window; may still be running.`);
|
|
115722
|
+
continue;
|
|
115723
|
+
}
|
|
115724
|
+
if (ageMs2 !== void 0 && ageMs2 >= zombieCutoffMs) {
|
|
115725
|
+
const node = e.payload?.refineJob;
|
|
115726
|
+
const coordinatorDaemonId2 = node?.targetCoordinatorDaemonId;
|
|
115727
|
+
const coordinatorSessionId2 = node?.targetCoordinatorSessionId;
|
|
115728
|
+
const zombieHandle = buildRefineJobHandle(self, {
|
|
115729
|
+
meshId,
|
|
115730
|
+
nodeId: e.nodeId,
|
|
115731
|
+
jobId,
|
|
115732
|
+
interactionId: typeof node?.interactionId === "string" ? node.interactionId : void 0,
|
|
115733
|
+
status: "failed",
|
|
115734
|
+
startedAt: typeof node?.startedAt === "string" ? node.startedAt : e.timestamp,
|
|
115735
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
115736
|
+
coordinatorDaemonId: coordinatorDaemonId2,
|
|
115737
|
+
coordinatorSessionId: coordinatorSessionId2
|
|
115738
|
+
});
|
|
115739
|
+
LOG2.warn("Mesh", `[Refinery] Closing out stale refine job for node ${e.nodeId} (jobId=${jobId}) as failed \u2014 dispatched ${ageMs2}ms ago, past the ${zombieCutoffMs}ms zombie cutoff with no terminal entry; not resuming.`);
|
|
115740
|
+
const zombieResult = {
|
|
115741
|
+
success: false,
|
|
115742
|
+
code: "resume_abandoned_stale_dispatch",
|
|
115743
|
+
error: `Refine job dispatched at ${e.timestamp} never reached a terminal state and exceeded the ${zombieCutoffMs}ms zombie cutoff on daemon restart; closed out without resuming.`
|
|
115744
|
+
};
|
|
115745
|
+
await appendRefineJobLedger(self, "task_failed", zombieHandle, zombieResult);
|
|
115746
|
+
queueRefineJobEvent(self, "refine:failed", zombieHandle, zombieResult);
|
|
115747
|
+
continue;
|
|
115748
|
+
}
|
|
115696
115749
|
const coordinatorDaemonId = e.payload?.refineJob?.targetCoordinatorDaemonId;
|
|
115750
|
+
const coordinatorSessionId = e.payload?.refineJob?.targetCoordinatorSessionId;
|
|
115697
115751
|
LOG2.info("Mesh", `[Refinery] Auto-resuming interrupted refine job for node ${e.nodeId} (jobId=${jobId})`);
|
|
115698
115752
|
void startMeshRefineJob(self, meshId, e.nodeId, {
|
|
115699
|
-
|
|
115753
|
+
jobId,
|
|
115754
|
+
coordinatorDaemonId,
|
|
115755
|
+
coordinatorSessionId
|
|
115700
115756
|
});
|
|
115701
115757
|
}
|
|
115702
115758
|
}
|
|
@@ -117420,7 +117476,7 @@ ${e?.stderr || ""}`;
|
|
|
117420
117476
|
const terminal = self.terminalRefineJobs.get(key2);
|
|
117421
117477
|
const alreadyRunning = self.runningRefineJobs.get(key2);
|
|
117422
117478
|
if (alreadyRunning) return { ...alreadyRunning, duplicate: true };
|
|
117423
|
-
const jobId = `refine_${createInteractionId()}`;
|
|
117479
|
+
const jobId = typeof args?.jobId === "string" && args.jobId.trim() ? args.jobId.trim() : `refine_${createInteractionId()}`;
|
|
117424
117480
|
const interactionId = createInteractionId();
|
|
117425
117481
|
const placeholder = buildRefineJobHandle(self, { meshId, nodeId, jobId, interactionId, retryOfJobId: terminal?.jobId });
|
|
117426
117482
|
self.runningRefineJobs.set(key2, placeholder);
|