@adhdev/daemon-standalone 0.9.82-rc.275 → 0.9.82-rc.276
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 +59 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29983,10 +29983,10 @@ var require_dist3 = __commonJS({
|
|
|
29983
29983
|
}
|
|
29984
29984
|
function getDaemonBuildInfo() {
|
|
29985
29985
|
if (cached2) return cached2;
|
|
29986
|
-
const commit = readInjected(true ? "
|
|
29987
|
-
const commitShort = readInjected(true ? "
|
|
29988
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
29989
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
29986
|
+
const commit = readInjected(true ? "746fc68e4c297b988b76207bb8c63ab6062a38e1" : void 0) ?? "unknown";
|
|
29987
|
+
const commitShort = readInjected(true ? "746fc68e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
29988
|
+
const version2 = readInjected(true ? "0.9.82-rc.276" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
29989
|
+
const builtAt = readInjected(true ? "2026-06-15T09:29:38.830Z" : void 0);
|
|
29990
29990
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
29991
29991
|
return cached2;
|
|
29992
29992
|
}
|
|
@@ -34022,11 +34022,12 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34022
34022
|
const onlyEvents = opts?.onlyEvents;
|
|
34023
34023
|
if (onlyEvents && onlyEvents.size === 0) return [];
|
|
34024
34024
|
const eventList = onlyEvents ? [...onlyEvents] : [];
|
|
34025
|
+
const daemonIds = (Array.isArray(coordinatorDaemonId) ? coordinatorDaemonId : coordinatorDaemonId ? [coordinatorDaemonId] : []).filter((id) => typeof id === "string" && id.length > 0);
|
|
34025
34026
|
const clauses = ["mesh_id = ?", "drained = 0"];
|
|
34026
34027
|
const params = [meshId];
|
|
34027
|
-
if (
|
|
34028
|
-
clauses.push(
|
|
34029
|
-
params.push(
|
|
34028
|
+
if (daemonIds.length > 0) {
|
|
34029
|
+
clauses.push(`(coordinator_daemon_id IS NULL OR coordinator_daemon_id IN (${daemonIds.map(() => "?").join(",")}))`);
|
|
34030
|
+
params.push(...daemonIds);
|
|
34030
34031
|
}
|
|
34031
34032
|
if (eventList.length > 0) {
|
|
34032
34033
|
clauses.push(`event IN (${eventList.map(() => "?").join(",")})`);
|
|
@@ -34056,8 +34057,9 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34056
34057
|
}
|
|
34057
34058
|
/** Non-destructive peek — returns undrained events without marking them drained. */
|
|
34058
34059
|
peekPendingEvents(meshId, coordinatorDaemonId) {
|
|
34059
|
-
const
|
|
34060
|
-
const
|
|
34060
|
+
const daemonIds = (Array.isArray(coordinatorDaemonId) ? coordinatorDaemonId : coordinatorDaemonId ? [coordinatorDaemonId] : []).filter((id) => typeof id === "string" && id.length > 0);
|
|
34061
|
+
const whereClause = daemonIds.length > 0 ? `WHERE mesh_id = ? AND drained = 0 AND (coordinator_daemon_id IS NULL OR coordinator_daemon_id IN (${daemonIds.map(() => "?").join(",")}))` : `WHERE mesh_id = ? AND drained = 0`;
|
|
34062
|
+
const params = daemonIds.length > 0 ? [meshId, ...daemonIds] : [meshId];
|
|
34061
34063
|
const rows = this.db.prepare(
|
|
34062
34064
|
`SELECT id, event, payload FROM mesh_pending_events ${whereClause} ORDER BY queued_at ASC LIMIT 100`
|
|
34063
34065
|
).all(...params);
|
|
@@ -36111,6 +36113,19 @@ Next step: ${nextStep}`;
|
|
|
36111
36113
|
"use strict";
|
|
36112
36114
|
}
|
|
36113
36115
|
});
|
|
36116
|
+
function normalizeCoordinatorDaemonIds(coordinatorDaemonId) {
|
|
36117
|
+
const raw = Array.isArray(coordinatorDaemonId) ? coordinatorDaemonId : coordinatorDaemonId != null ? [coordinatorDaemonId] : [];
|
|
36118
|
+
const seen = /* @__PURE__ */ new Set();
|
|
36119
|
+
const out = [];
|
|
36120
|
+
for (const id of raw) {
|
|
36121
|
+
if (typeof id !== "string") continue;
|
|
36122
|
+
const trimmed = id.trim();
|
|
36123
|
+
if (!trimmed || seen.has(trimmed)) continue;
|
|
36124
|
+
seen.add(trimmed);
|
|
36125
|
+
out.push(trimmed);
|
|
36126
|
+
}
|
|
36127
|
+
return out;
|
|
36128
|
+
}
|
|
36114
36129
|
function readRefineJobId2(event) {
|
|
36115
36130
|
const metadata = readRecord3(event.metadataEvent) || event;
|
|
36116
36131
|
const result = readRecord3(metadata.result);
|
|
@@ -36165,7 +36180,9 @@ Next step: ${nextStep}`;
|
|
|
36165
36180
|
}
|
|
36166
36181
|
function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
36167
36182
|
if (!meshId) return [];
|
|
36168
|
-
const
|
|
36183
|
+
const daemonIds = normalizeCoordinatorDaemonIds(coordinatorDaemonId);
|
|
36184
|
+
const primaryDaemonId = daemonIds[0];
|
|
36185
|
+
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
36169
36186
|
const events = [];
|
|
36170
36187
|
for (const path39 of paths) {
|
|
36171
36188
|
if (!(0, import_fs8.existsSync)(path39)) continue;
|
|
@@ -36178,7 +36195,7 @@ Next step: ${nextStep}`;
|
|
|
36178
36195
|
return [];
|
|
36179
36196
|
}
|
|
36180
36197
|
});
|
|
36181
|
-
const filtered =
|
|
36198
|
+
const filtered = primaryDaemonId && path39 === getPendingEventsPath(meshId) ? parsed.filter((e) => !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId)) : parsed;
|
|
36182
36199
|
events.push(...filtered);
|
|
36183
36200
|
} catch {
|
|
36184
36201
|
}
|
|
@@ -36356,6 +36373,8 @@ Next step: ${nextStep}`;
|
|
|
36356
36373
|
}
|
|
36357
36374
|
function drainPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId, opts) {
|
|
36358
36375
|
if (!meshId) return [];
|
|
36376
|
+
const daemonIds = normalizeCoordinatorDaemonIds(coordinatorDaemonId);
|
|
36377
|
+
const primaryDaemonId = daemonIds[0];
|
|
36359
36378
|
const onlyEvents = opts?.onlyEvents;
|
|
36360
36379
|
const matchesFilter = (eventName) => !onlyEvents || onlyEvents.has(eventName);
|
|
36361
36380
|
const merged = [];
|
|
@@ -36371,17 +36390,17 @@ Next step: ${nextStep}`;
|
|
|
36371
36390
|
try {
|
|
36372
36391
|
const store = MeshRuntimeStore.getInstance();
|
|
36373
36392
|
if (store.pendingEventCount(meshId) > 0) {
|
|
36374
|
-
for (const row of store.drainPendingEvents(meshId,
|
|
36393
|
+
for (const row of store.drainPendingEvents(meshId, daemonIds.length > 0 ? daemonIds : void 0, onlyEvents ? { onlyEvents } : void 0)) {
|
|
36375
36394
|
const event = row.payload;
|
|
36376
36395
|
if (event) pushUnique(event);
|
|
36377
36396
|
}
|
|
36378
36397
|
}
|
|
36379
36398
|
} catch {
|
|
36380
36399
|
}
|
|
36381
|
-
const paths =
|
|
36400
|
+
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
36382
36401
|
for (const path39 of paths) {
|
|
36383
|
-
const isSharedFile =
|
|
36384
|
-
const targets = (e) => !isSharedFile || !e.targetCoordinatorDaemonId || e.targetCoordinatorDaemonId
|
|
36402
|
+
const isSharedFile = !!primaryDaemonId && path39 === getPendingEventsPath(meshId);
|
|
36403
|
+
const targets = (e) => !isSharedFile || !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId);
|
|
36385
36404
|
if (onlyEvents) {
|
|
36386
36405
|
for (const event of selectiveDrainFile(path39, (e) => targets(e) && matchesFilter(e.event))) {
|
|
36387
36406
|
pushUnique(event);
|
|
@@ -36405,6 +36424,7 @@ Next step: ${nextStep}`;
|
|
|
36405
36424
|
}
|
|
36406
36425
|
function getPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId) {
|
|
36407
36426
|
if (!meshId) return [];
|
|
36427
|
+
const daemonIds = normalizeCoordinatorDaemonIds(coordinatorDaemonId);
|
|
36408
36428
|
const merged = [];
|
|
36409
36429
|
const seenFingerprints = /* @__PURE__ */ new Set();
|
|
36410
36430
|
const pushUnique = (event) => {
|
|
@@ -36418,14 +36438,14 @@ Next step: ${nextStep}`;
|
|
|
36418
36438
|
try {
|
|
36419
36439
|
const store = MeshRuntimeStore.getInstance();
|
|
36420
36440
|
if (store.pendingEventCount(meshId) > 0) {
|
|
36421
|
-
for (const row of store.peekPendingEvents(meshId,
|
|
36441
|
+
for (const row of store.peekPendingEvents(meshId, daemonIds.length > 0 ? daemonIds : void 0)) {
|
|
36422
36442
|
const event = row.payload;
|
|
36423
36443
|
if (event) pushUnique(event);
|
|
36424
36444
|
}
|
|
36425
36445
|
}
|
|
36426
36446
|
} catch {
|
|
36427
36447
|
}
|
|
36428
|
-
for (const event of readPendingMeshCoordinatorEventsFromDisk(meshId,
|
|
36448
|
+
for (const event of readPendingMeshCoordinatorEventsFromDisk(meshId, daemonIds)) {
|
|
36429
36449
|
pushUnique(event);
|
|
36430
36450
|
}
|
|
36431
36451
|
return reconcilePendingMeshCoordinatorEvents(meshId, merged);
|
|
@@ -37130,6 +37150,14 @@ Next step: ${nextStep}`;
|
|
|
37130
37150
|
recentUnroutableDiagnostics = /* @__PURE__ */ new Map();
|
|
37131
37151
|
}
|
|
37132
37152
|
});
|
|
37153
|
+
function resolveCoordinatorDrainDaemonIds(components) {
|
|
37154
|
+
const ids = /* @__PURE__ */ new Set();
|
|
37155
|
+
const statusInstanceId = readNonEmptyString2(components.statusInstanceId);
|
|
37156
|
+
if (statusInstanceId) ids.add(statusInstanceId);
|
|
37157
|
+
const machineId = readNonEmptyString2(loadConfig2().machineId);
|
|
37158
|
+
if (machineId) ids.add(machineId);
|
|
37159
|
+
return [...ids];
|
|
37160
|
+
}
|
|
37133
37161
|
function getCachedMeshByWorkspace(workspace) {
|
|
37134
37162
|
const now = Date.now();
|
|
37135
37163
|
const cached22 = meshByWorkspaceCache.get(workspace);
|
|
@@ -38254,8 +38282,8 @@ Next step: ${nextStep}`;
|
|
|
38254
38282
|
const status = readNonEmptyString2(flushState.status).toLowerCase();
|
|
38255
38283
|
if (status === "idle") {
|
|
38256
38284
|
try {
|
|
38257
|
-
const
|
|
38258
|
-
const pendingEvents = drainPendingMeshCoordinatorEvents(coordinatorMeshId,
|
|
38285
|
+
const drainDaemonIds = resolveCoordinatorDrainDaemonIds(components);
|
|
38286
|
+
const pendingEvents = drainPendingMeshCoordinatorEvents(coordinatorMeshId, drainDaemonIds.length > 0 ? drainDaemonIds : void 0);
|
|
38259
38287
|
if (pendingEvents.length > 0) {
|
|
38260
38288
|
LOG2.info("MeshEvents", `Auto-flushing ${pendingEvents.length} pending coordinator event(s) for mesh ${coordinatorMeshId} on coordinator idle`);
|
|
38261
38289
|
for (const pending of pendingEvents) {
|
|
@@ -38382,6 +38410,14 @@ Next step: ${nextStep}`;
|
|
|
38382
38410
|
}
|
|
38383
38411
|
return DEFAULT_RECONCILE_INTERVAL_MS;
|
|
38384
38412
|
}
|
|
38413
|
+
function resolveCoordinatorDaemonIds(components) {
|
|
38414
|
+
const ids = /* @__PURE__ */ new Set();
|
|
38415
|
+
const statusInstanceId = readNonEmptyString2(components.statusInstanceId);
|
|
38416
|
+
if (statusInstanceId) ids.add(statusInstanceId);
|
|
38417
|
+
const machineId = readNonEmptyString2(loadConfig2().machineId);
|
|
38418
|
+
if (machineId) ids.add(machineId);
|
|
38419
|
+
return [...ids];
|
|
38420
|
+
}
|
|
38385
38421
|
function findLiveCoordinators(components) {
|
|
38386
38422
|
const out = [];
|
|
38387
38423
|
for (const inst of components.instanceManager.getByCategory("cli")) {
|
|
@@ -38414,6 +38450,7 @@ Next step: ${nextStep}`;
|
|
|
38414
38450
|
else byMesh.set(c.meshId, [c]);
|
|
38415
38451
|
}
|
|
38416
38452
|
const localDaemonId = readNonEmptyString2(loadConfig2().machineId) || void 0;
|
|
38453
|
+
const drainDaemonIds = resolveCoordinatorDaemonIds(components);
|
|
38417
38454
|
const dispatchMeshCommand = components.dispatchMeshCommand;
|
|
38418
38455
|
const store = (() => {
|
|
38419
38456
|
try {
|
|
@@ -38444,7 +38481,7 @@ Next step: ${nextStep}`;
|
|
|
38444
38481
|
try {
|
|
38445
38482
|
pendingEvents = drainPendingMeshCoordinatorEvents(
|
|
38446
38483
|
meshId,
|
|
38447
|
-
localDaemonId,
|
|
38484
|
+
drainDaemonIds.length > 0 ? drainDaemonIds : localDaemonId,
|
|
38448
38485
|
forceOnly ? { onlyEvents: MESH_FORCE_INJECT_EVENTS } : void 0
|
|
38449
38486
|
);
|
|
38450
38487
|
} catch (e) {
|
|
@@ -85260,7 +85297,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
85260
85297
|
detectedIdes: detectedIdesRef,
|
|
85261
85298
|
refreshProviderAvailability,
|
|
85262
85299
|
dispatchMeshCommand: config2.dispatchMeshCommand,
|
|
85263
|
-
onMeshCoordinatorEventForwarded: config2.onMeshCoordinatorEventForwarded
|
|
85300
|
+
onMeshCoordinatorEventForwarded: config2.onMeshCoordinatorEventForwarded,
|
|
85301
|
+
statusInstanceId: config2.statusInstanceId
|
|
85264
85302
|
};
|
|
85265
85303
|
setupMeshEventForwarding(components);
|
|
85266
85304
|
components.meshReconcileLoop = setupMeshReconcileLoop(components);
|