adhdev 0.9.82-rc.23 → 0.9.82-rc.24
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 +332 -205
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +332 -205
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +5 -5
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -3810,6 +3810,36 @@ function getQueuePath(meshId) {
|
|
|
3810
3810
|
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3811
3811
|
return (0, import_path4.join)(getLedgerDir(), `${safe}.queue.json`);
|
|
3812
3812
|
}
|
|
3813
|
+
function getLockPath(meshId) {
|
|
3814
|
+
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3815
|
+
return (0, import_path4.join)(getLedgerDir(), `${safe}.queue.lock`);
|
|
3816
|
+
}
|
|
3817
|
+
function withQueueLock(meshId, fn) {
|
|
3818
|
+
const lockPath = getLockPath(meshId);
|
|
3819
|
+
let fd = -1;
|
|
3820
|
+
for (let i = 0; i < 10; i++) {
|
|
3821
|
+
try {
|
|
3822
|
+
fd = (0, import_fs4.openSync)(lockPath, "wx");
|
|
3823
|
+
break;
|
|
3824
|
+
} catch {
|
|
3825
|
+
const deadline = Date.now() + 30;
|
|
3826
|
+
while (Date.now() < deadline) {
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
try {
|
|
3831
|
+
return fn();
|
|
3832
|
+
} finally {
|
|
3833
|
+
if (fd !== -1) try {
|
|
3834
|
+
(0, import_fs4.closeSync)(fd);
|
|
3835
|
+
} catch {
|
|
3836
|
+
}
|
|
3837
|
+
try {
|
|
3838
|
+
(0, import_fs4.unlinkSync)(lockPath);
|
|
3839
|
+
} catch {
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3813
3843
|
function readQueue(meshId) {
|
|
3814
3844
|
const path42 = getQueuePath(meshId);
|
|
3815
3845
|
if (!(0, import_fs4.existsSync)(path42)) return [];
|
|
@@ -3825,20 +3855,22 @@ function writeQueue(meshId, queue) {
|
|
|
3825
3855
|
(0, import_fs4.writeFileSync)(path42, JSON.stringify(queue, null, 2), "utf-8");
|
|
3826
3856
|
}
|
|
3827
3857
|
function enqueueTask(meshId, message, opts) {
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3858
|
+
return withQueueLock(meshId, () => {
|
|
3859
|
+
const queue = readQueue(meshId);
|
|
3860
|
+
const entry = {
|
|
3861
|
+
id: (0, import_crypto5.randomUUID)(),
|
|
3862
|
+
meshId,
|
|
3863
|
+
message,
|
|
3864
|
+
status: "pending",
|
|
3865
|
+
targetNodeId: opts?.targetNodeId,
|
|
3866
|
+
targetSessionId: opts?.targetSessionId,
|
|
3867
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3868
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3869
|
+
};
|
|
3870
|
+
queue.push(entry);
|
|
3871
|
+
writeQueue(meshId, queue);
|
|
3872
|
+
return entry;
|
|
3873
|
+
});
|
|
3842
3874
|
}
|
|
3843
3875
|
function getQueue(meshId, opts) {
|
|
3844
3876
|
let queue = readQueue(meshId);
|
|
@@ -3849,100 +3881,109 @@ function getQueue(meshId, opts) {
|
|
|
3849
3881
|
return queue;
|
|
3850
3882
|
}
|
|
3851
3883
|
function claimNextTask(meshId, nodeId, sessionId) {
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3884
|
+
return withQueueLock(meshId, () => {
|
|
3885
|
+
const queue = readQueue(meshId);
|
|
3886
|
+
const hasActiveAssignment = queue.some((q) => q.status === "assigned" && (q.assignedSessionId === sessionId || q.assignedNodeId === nodeId));
|
|
3887
|
+
if (hasActiveAssignment) return null;
|
|
3888
|
+
let targetIdx = queue.findIndex((q) => q.status === "pending" && q.targetSessionId === sessionId);
|
|
3889
|
+
if (targetIdx === -1) {
|
|
3890
|
+
targetIdx = queue.findIndex((q) => q.status === "pending" && q.targetNodeId === nodeId && !q.targetSessionId);
|
|
3891
|
+
}
|
|
3892
|
+
if (targetIdx === -1) {
|
|
3893
|
+
targetIdx = queue.findIndex((q) => q.status === "pending" && !q.targetNodeId && !q.targetSessionId);
|
|
3894
|
+
}
|
|
3895
|
+
if (targetIdx === -1) return null;
|
|
3896
|
+
const entry = queue[targetIdx];
|
|
3897
|
+
entry.status = "assigned";
|
|
3898
|
+
entry.assignedNodeId = nodeId;
|
|
3899
|
+
entry.assignedSessionId = sessionId;
|
|
3900
|
+
entry.dispatchTimestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
3901
|
+
entry.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3902
|
+
writeQueue(meshId, queue);
|
|
3903
|
+
return entry;
|
|
3904
|
+
});
|
|
3871
3905
|
}
|
|
3872
3906
|
function updateTaskStatus(meshId, taskId, status) {
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3907
|
+
return withQueueLock(meshId, () => {
|
|
3908
|
+
const queue = readQueue(meshId);
|
|
3909
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
3910
|
+
if (idx === -1) return null;
|
|
3911
|
+
queue[idx].status = status;
|
|
3912
|
+
queue[idx].updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3913
|
+
writeQueue(meshId, queue);
|
|
3914
|
+
return queue[idx];
|
|
3915
|
+
});
|
|
3880
3916
|
}
|
|
3881
3917
|
function recordTaskAutoLaunch(meshId, taskId, autoLaunch) {
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
...autoLaunch,
|
|
3888
|
-
updatedAt
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
return queue[idx];
|
|
3918
|
+
return withQueueLock(meshId, () => {
|
|
3919
|
+
const queue = readQueue(meshId);
|
|
3920
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
3921
|
+
if (idx === -1) return null;
|
|
3922
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3923
|
+
queue[idx].autoLaunch = { ...autoLaunch, updatedAt: now };
|
|
3924
|
+
queue[idx].updatedAt = now;
|
|
3925
|
+
writeQueue(meshId, queue);
|
|
3926
|
+
return queue[idx];
|
|
3927
|
+
});
|
|
3893
3928
|
}
|
|
3894
3929
|
function cancelTask(meshId, taskId, opts) {
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3930
|
+
return withQueueLock(meshId, () => {
|
|
3931
|
+
const queue = readQueue(meshId);
|
|
3932
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
3933
|
+
if (idx === -1) return null;
|
|
3934
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3935
|
+
queue[idx].status = "cancelled";
|
|
3936
|
+
queue[idx].updatedAt = now;
|
|
3937
|
+
queue[idx].cancelledAt = now;
|
|
3938
|
+
if (opts?.reason) queue[idx].cancelReason = opts.reason;
|
|
3939
|
+
writeQueue(meshId, queue);
|
|
3940
|
+
return queue[idx];
|
|
3941
|
+
});
|
|
3905
3942
|
}
|
|
3906
3943
|
function requeueTask(meshId, taskId, opts) {
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3944
|
+
return withQueueLock(meshId, () => {
|
|
3945
|
+
const queue = readQueue(meshId);
|
|
3946
|
+
const idx = queue.findIndex((q) => q.id === taskId);
|
|
3947
|
+
if (idx === -1) return null;
|
|
3948
|
+
const entry = queue[idx];
|
|
3949
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3950
|
+
entry.status = "pending";
|
|
3951
|
+
delete entry.assignedNodeId;
|
|
3952
|
+
delete entry.assignedSessionId;
|
|
3953
|
+
delete entry.cancelledAt;
|
|
3954
|
+
delete entry.cancelReason;
|
|
3955
|
+
if (opts?.clearTargetNode) delete entry.targetNodeId;
|
|
3956
|
+
if (typeof opts?.targetNodeId === "string") entry.targetNodeId = opts.targetNodeId;
|
|
3957
|
+
if (opts?.clearTargetSession !== false) delete entry.targetSessionId;
|
|
3958
|
+
if (typeof opts?.targetSessionId === "string") entry.targetSessionId = opts.targetSessionId;
|
|
3959
|
+
entry.updatedAt = now;
|
|
3960
|
+
entry.requeuedAt = now;
|
|
3961
|
+
entry.requeueCount = (entry.requeueCount || 0) + 1;
|
|
3962
|
+
if (opts?.reason) entry.requeueReason = opts.reason;
|
|
3963
|
+
writeQueue(meshId, queue);
|
|
3964
|
+
return entry;
|
|
3965
|
+
});
|
|
3927
3966
|
}
|
|
3928
3967
|
function updateSessionTaskStatus(meshId, sessionId, status) {
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
bestTime
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3968
|
+
return withQueueLock(meshId, () => {
|
|
3969
|
+
const queue = readQueue(meshId);
|
|
3970
|
+
let bestIdx = -1;
|
|
3971
|
+
let bestTime = 0;
|
|
3972
|
+
for (let i = queue.length - 1; i >= 0; i--) {
|
|
3973
|
+
if (queue[i].assignedSessionId === sessionId && queue[i].status === "assigned") {
|
|
3974
|
+
const time3 = new Date(queue[i].dispatchTimestamp || queue[i].updatedAt).getTime();
|
|
3975
|
+
if (time3 > bestTime) {
|
|
3976
|
+
bestTime = time3;
|
|
3977
|
+
bestIdx = i;
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
}
|
|
3981
|
+
if (bestIdx === -1) return null;
|
|
3982
|
+
queue[bestIdx].status = status;
|
|
3983
|
+
queue[bestIdx].updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3984
|
+
writeQueue(meshId, queue);
|
|
3985
|
+
return queue[bestIdx];
|
|
3986
|
+
});
|
|
3946
3987
|
}
|
|
3947
3988
|
function getMeshQueueStats(meshId) {
|
|
3948
3989
|
const queue = readQueue(meshId);
|
|
@@ -4351,21 +4392,70 @@ __export(mesh_events_exports, {
|
|
|
4351
4392
|
triggerMeshQueue: () => triggerMeshQueue,
|
|
4352
4393
|
tryAssignQueueTask: () => tryAssignQueueTask
|
|
4353
4394
|
});
|
|
4395
|
+
function sweepExpiredRemoteIdleSessions() {
|
|
4396
|
+
const now = Date.now();
|
|
4397
|
+
for (const [key, session] of remoteIdleSessions) {
|
|
4398
|
+
if (session.expiresAt <= now) remoteIdleSessions.delete(key);
|
|
4399
|
+
}
|
|
4400
|
+
}
|
|
4401
|
+
function getPendingEventsPath(meshId) {
|
|
4402
|
+
const safe = meshId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
4403
|
+
return (0, import_path5.join)(getLedgerDir(), `${safe}.pending-events.jsonl`);
|
|
4404
|
+
}
|
|
4354
4405
|
function queuePendingMeshCoordinatorEvent(event) {
|
|
4355
|
-
|
|
4406
|
+
try {
|
|
4407
|
+
(0, import_fs6.appendFileSync)(getPendingEventsPath(event.meshId), JSON.stringify(event) + "\n", "utf-8");
|
|
4408
|
+
return true;
|
|
4409
|
+
} catch (e) {
|
|
4410
|
+
LOG.warn("MeshEvents", `Failed to persist pending coordinator event: ${e?.message || e}`);
|
|
4356
4411
|
return false;
|
|
4357
4412
|
}
|
|
4358
|
-
pendingMeshCoordinatorEvents.push(event);
|
|
4359
|
-
return true;
|
|
4360
4413
|
}
|
|
4361
|
-
function drainPendingMeshCoordinatorEvents() {
|
|
4362
|
-
|
|
4414
|
+
function drainPendingMeshCoordinatorEvents(meshId) {
|
|
4415
|
+
if (!meshId) return [];
|
|
4416
|
+
const path42 = getPendingEventsPath(meshId);
|
|
4417
|
+
if (!(0, import_fs6.existsSync)(path42)) return [];
|
|
4418
|
+
try {
|
|
4419
|
+
const raw = (0, import_fs6.readFileSync)(path42, "utf-8");
|
|
4420
|
+
try {
|
|
4421
|
+
(0, import_fs6.unlinkSync)(path42);
|
|
4422
|
+
} catch {
|
|
4423
|
+
}
|
|
4424
|
+
return raw.split("\n").filter(Boolean).flatMap((line) => {
|
|
4425
|
+
try {
|
|
4426
|
+
return [JSON.parse(line)];
|
|
4427
|
+
} catch {
|
|
4428
|
+
return [];
|
|
4429
|
+
}
|
|
4430
|
+
});
|
|
4431
|
+
} catch {
|
|
4432
|
+
return [];
|
|
4433
|
+
}
|
|
4363
4434
|
}
|
|
4364
|
-
function getPendingMeshCoordinatorEvents() {
|
|
4365
|
-
|
|
4435
|
+
function getPendingMeshCoordinatorEvents(meshId) {
|
|
4436
|
+
if (!meshId) return [];
|
|
4437
|
+
const path42 = getPendingEventsPath(meshId);
|
|
4438
|
+
if (!(0, import_fs6.existsSync)(path42)) return [];
|
|
4439
|
+
try {
|
|
4440
|
+
const raw = (0, import_fs6.readFileSync)(path42, "utf-8");
|
|
4441
|
+
return raw.split("\n").filter(Boolean).flatMap((line) => {
|
|
4442
|
+
try {
|
|
4443
|
+
return [JSON.parse(line)];
|
|
4444
|
+
} catch {
|
|
4445
|
+
return [];
|
|
4446
|
+
}
|
|
4447
|
+
});
|
|
4448
|
+
} catch {
|
|
4449
|
+
return [];
|
|
4450
|
+
}
|
|
4366
4451
|
}
|
|
4367
|
-
function clearPendingMeshCoordinatorEvents() {
|
|
4368
|
-
|
|
4452
|
+
function clearPendingMeshCoordinatorEvents(meshId) {
|
|
4453
|
+
if (!meshId) return;
|
|
4454
|
+
const path42 = getPendingEventsPath(meshId);
|
|
4455
|
+
if ((0, import_fs6.existsSync)(path42)) try {
|
|
4456
|
+
(0, import_fs6.unlinkSync)(path42);
|
|
4457
|
+
} catch {
|
|
4458
|
+
}
|
|
4369
4459
|
}
|
|
4370
4460
|
function readNonEmptyString(value) {
|
|
4371
4461
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
@@ -4429,7 +4519,16 @@ function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType)
|
|
|
4429
4519
|
message: task.message
|
|
4430
4520
|
}).catch((e) => {
|
|
4431
4521
|
LOG.error("MeshQueue", `Failed to dispatch task via P2P to remote node ${nodeId}: ${e?.message}`);
|
|
4432
|
-
updateTaskStatus(meshId, task.id, "
|
|
4522
|
+
updateTaskStatus(meshId, task.id, "pending");
|
|
4523
|
+
try {
|
|
4524
|
+
appendLedgerEntry(meshId, {
|
|
4525
|
+
kind: "dispatch_failed",
|
|
4526
|
+
nodeId,
|
|
4527
|
+
sessionId,
|
|
4528
|
+
payload: { taskId: task.id, error: e?.message, retryable: true }
|
|
4529
|
+
});
|
|
4530
|
+
} catch {
|
|
4531
|
+
}
|
|
4433
4532
|
});
|
|
4434
4533
|
return true;
|
|
4435
4534
|
}
|
|
@@ -4772,9 +4871,9 @@ function injectMeshSystemMessage(components, args) {
|
|
|
4772
4871
|
const completedTask = updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
4773
4872
|
completedTaskForLedger = completedTask ? { id: completedTask.id } : null;
|
|
4774
4873
|
if (nodeId && providerType) {
|
|
4775
|
-
|
|
4874
|
+
setImmediate(() => {
|
|
4776
4875
|
tryAssignQueueTask(components, args.meshId, nodeId, sessionId, providerType);
|
|
4777
|
-
}
|
|
4876
|
+
});
|
|
4778
4877
|
}
|
|
4779
4878
|
}
|
|
4780
4879
|
} else if (args.event === "agent:ready") {
|
|
@@ -4812,13 +4911,17 @@ function injectMeshSystemMessage(components, args) {
|
|
|
4812
4911
|
}
|
|
4813
4912
|
}
|
|
4814
4913
|
if (sessionId && nodeId && providerType) {
|
|
4815
|
-
|
|
4816
|
-
|
|
4914
|
+
sweepExpiredRemoteIdleSessions();
|
|
4915
|
+
remoteIdleSessions.set(`${nodeId}:${sessionId}`, {
|
|
4916
|
+
nodeId,
|
|
4917
|
+
sessionId,
|
|
4918
|
+
providerType,
|
|
4919
|
+
expiresAt: Date.now() + REMOTE_IDLE_SESSION_TTL_MS
|
|
4920
|
+
});
|
|
4921
|
+
setImmediate(() => {
|
|
4817
4922
|
const assigned = tryAssignQueueTask(components, args.meshId, nodeId, sessionId, providerType);
|
|
4818
|
-
if (assigned) {
|
|
4819
|
-
|
|
4820
|
-
}
|
|
4821
|
-
}, 500);
|
|
4923
|
+
if (assigned) remoteIdleSessions.delete(`${nodeId}:${sessionId}`);
|
|
4924
|
+
});
|
|
4822
4925
|
}
|
|
4823
4926
|
} else if (args.event === "agent:generating_started") {
|
|
4824
4927
|
const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
|
|
@@ -5021,19 +5124,20 @@ function setupMeshEventForwarding(components) {
|
|
|
5021
5124
|
});
|
|
5022
5125
|
});
|
|
5023
5126
|
}
|
|
5024
|
-
var
|
|
5127
|
+
var import_fs6, import_path5, REMOTE_IDLE_SESSION_TTL_MS, remoteIdleSessions, MESH_COORDINATOR_EVENTS, EVENT_TO_LEDGER_KIND, INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS, autoLaunchInProgress, autoLaunchCooldownUntil, AUTO_LAUNCH_COOLDOWN_MS;
|
|
5025
5128
|
var init_mesh_events = __esm({
|
|
5026
5129
|
"../../oss/packages/daemon-core/src/mesh/mesh-events.ts"() {
|
|
5027
5130
|
"use strict";
|
|
5131
|
+
import_fs6 = require("fs");
|
|
5132
|
+
import_path5 = require("path");
|
|
5028
5133
|
init_config();
|
|
5029
5134
|
init_mesh_config();
|
|
5030
5135
|
init_cli_detector();
|
|
5031
5136
|
init_logger();
|
|
5032
5137
|
init_mesh_ledger();
|
|
5033
5138
|
init_mesh_work_queue();
|
|
5139
|
+
REMOTE_IDLE_SESSION_TTL_MS = 5 * 60 * 1e3;
|
|
5034
5140
|
remoteIdleSessions = /* @__PURE__ */ new Map();
|
|
5035
|
-
MAX_PENDING_EVENTS = 50;
|
|
5036
|
-
pendingMeshCoordinatorEvents = [];
|
|
5037
5141
|
MESH_COORDINATOR_EVENTS = /* @__PURE__ */ new Set([
|
|
5038
5142
|
"agent:generating_started",
|
|
5039
5143
|
"agent:generating_completed",
|
|
@@ -5176,7 +5280,7 @@ function isPlainObject2(value) {
|
|
|
5176
5280
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
5177
5281
|
}
|
|
5178
5282
|
function getStatePath() {
|
|
5179
|
-
return (0,
|
|
5283
|
+
return (0, import_path6.join)(getConfigDir(), "state.json");
|
|
5180
5284
|
}
|
|
5181
5285
|
function normalizeState(raw) {
|
|
5182
5286
|
const parsed = isPlainObject2(raw) ? raw : {};
|
|
@@ -5212,11 +5316,11 @@ function normalizeState(raw) {
|
|
|
5212
5316
|
}
|
|
5213
5317
|
function loadState() {
|
|
5214
5318
|
const statePath = getStatePath();
|
|
5215
|
-
if (!(0,
|
|
5319
|
+
if (!(0, import_fs7.existsSync)(statePath)) {
|
|
5216
5320
|
return { ...DEFAULT_STATE };
|
|
5217
5321
|
}
|
|
5218
5322
|
try {
|
|
5219
|
-
const raw = (0,
|
|
5323
|
+
const raw = (0, import_fs7.readFileSync)(statePath, "utf-8");
|
|
5220
5324
|
return normalizeState(JSON.parse(raw));
|
|
5221
5325
|
} catch {
|
|
5222
5326
|
return { ...DEFAULT_STATE };
|
|
@@ -5225,17 +5329,17 @@ function loadState() {
|
|
|
5225
5329
|
function saveState(state) {
|
|
5226
5330
|
const statePath = getStatePath();
|
|
5227
5331
|
const normalized = normalizeState(state);
|
|
5228
|
-
(0,
|
|
5332
|
+
(0, import_fs7.writeFileSync)(statePath, JSON.stringify(normalized, null, 2), { encoding: "utf-8", mode: 384 });
|
|
5229
5333
|
}
|
|
5230
5334
|
function resetState() {
|
|
5231
5335
|
saveState({ ...DEFAULT_STATE });
|
|
5232
5336
|
}
|
|
5233
|
-
var
|
|
5337
|
+
var import_fs7, import_path6, DEFAULT_STATE;
|
|
5234
5338
|
var init_state_store = __esm({
|
|
5235
5339
|
"../../oss/packages/daemon-core/src/config/state-store.ts"() {
|
|
5236
5340
|
"use strict";
|
|
5237
|
-
|
|
5238
|
-
|
|
5341
|
+
import_fs7 = require("fs");
|
|
5342
|
+
import_path6 = require("path");
|
|
5239
5343
|
init_config();
|
|
5240
5344
|
DEFAULT_STATE = {
|
|
5241
5345
|
recentActivity: [],
|
|
@@ -5268,7 +5372,7 @@ function findCliCommand(command) {
|
|
|
5268
5372
|
if (path10.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~")) {
|
|
5269
5373
|
const candidate = trimmed.startsWith("~") ? path10.join((0, import_os2.homedir)(), trimmed.slice(1)) : trimmed;
|
|
5270
5374
|
const resolved = path10.isAbsolute(candidate) ? candidate : path10.resolve(candidate);
|
|
5271
|
-
return (0,
|
|
5375
|
+
return (0, import_fs8.existsSync)(resolved) ? resolved : null;
|
|
5272
5376
|
}
|
|
5273
5377
|
try {
|
|
5274
5378
|
const result = (0, import_child_process2.execSync)(
|
|
@@ -5299,9 +5403,9 @@ function checkPathExists(paths) {
|
|
|
5299
5403
|
if (normalized.includes("*")) {
|
|
5300
5404
|
const username = home.split(/[\\/]/).pop() || "";
|
|
5301
5405
|
const resolved = normalized.replace("*", username);
|
|
5302
|
-
if ((0,
|
|
5406
|
+
if ((0, import_fs8.existsSync)(resolved)) return resolved;
|
|
5303
5407
|
} else {
|
|
5304
|
-
if ((0,
|
|
5408
|
+
if ((0, import_fs8.existsSync)(normalized)) return normalized;
|
|
5305
5409
|
}
|
|
5306
5410
|
}
|
|
5307
5411
|
return null;
|
|
@@ -5315,7 +5419,7 @@ async function detectIDEs(providerLoader) {
|
|
|
5315
5419
|
let resolvedCli = cliPath;
|
|
5316
5420
|
if (!resolvedCli && appPath && os32 === "darwin") {
|
|
5317
5421
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
5318
|
-
if ((0,
|
|
5422
|
+
if ((0, import_fs8.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
5319
5423
|
}
|
|
5320
5424
|
if (!resolvedCli && appPath && os32 === "win32") {
|
|
5321
5425
|
const { dirname: dirname13 } = await import("path");
|
|
@@ -5328,7 +5432,7 @@ async function detectIDEs(providerLoader) {
|
|
|
5328
5432
|
`${appDir}\\\\resources\\\\app\\\\bin\\\\${def.cli}.cmd`
|
|
5329
5433
|
];
|
|
5330
5434
|
for (const c of candidates) {
|
|
5331
|
-
if ((0,
|
|
5435
|
+
if ((0, import_fs8.existsSync)(c)) {
|
|
5332
5436
|
resolvedCli = c;
|
|
5333
5437
|
break;
|
|
5334
5438
|
}
|
|
@@ -5349,12 +5453,12 @@ async function detectIDEs(providerLoader) {
|
|
|
5349
5453
|
}
|
|
5350
5454
|
return results;
|
|
5351
5455
|
}
|
|
5352
|
-
var import_child_process2,
|
|
5456
|
+
var import_child_process2, import_fs8, import_os2, path10, BUILTIN_IDE_DEFINITIONS, registeredIDEs;
|
|
5353
5457
|
var init_ide_detector = __esm({
|
|
5354
5458
|
"../../oss/packages/daemon-core/src/detection/ide-detector.ts"() {
|
|
5355
5459
|
"use strict";
|
|
5356
5460
|
import_child_process2 = require("child_process");
|
|
5357
|
-
|
|
5461
|
+
import_fs8 = require("fs");
|
|
5358
5462
|
import_os2 = require("os");
|
|
5359
5463
|
path10 = __toESM(require("path"));
|
|
5360
5464
|
BUILTIN_IDE_DEFINITIONS = [];
|
|
@@ -37802,7 +37906,7 @@ function commandExists(command) {
|
|
|
37802
37906
|
const trimmed = command.trim();
|
|
37803
37907
|
if (!trimmed) return false;
|
|
37804
37908
|
if (isExplicitCommand(trimmed)) {
|
|
37805
|
-
return (0,
|
|
37909
|
+
return (0, import_fs9.existsSync)(expandExecutable(trimmed));
|
|
37806
37910
|
}
|
|
37807
37911
|
try {
|
|
37808
37912
|
(0, import_child_process6.execFileSync)(process.platform === "win32" ? "where" : "which", [trimmed], {
|
|
@@ -37823,10 +37927,10 @@ function hasCliArg(args, flag) {
|
|
|
37823
37927
|
}
|
|
37824
37928
|
function ensureEmptyDelegatedMcpConfig(workspace) {
|
|
37825
37929
|
const baseDir = path19.join(os16.tmpdir(), "adhdev-delegated-agent-empty-mcp");
|
|
37826
|
-
(0,
|
|
37930
|
+
(0, import_fs9.mkdirSync)(baseDir, { recursive: true });
|
|
37827
37931
|
const workspaceHash = crypto4.createHash("sha256").update(path19.resolve(workspace || os16.tmpdir())).digest("hex").slice(0, 16);
|
|
37828
37932
|
const filePath = path19.join(baseDir, `${workspaceHash}.json`);
|
|
37829
|
-
(0,
|
|
37933
|
+
(0, import_fs9.writeFileSync)(filePath, JSON.stringify({ mcpServers: {} }, null, 2), "utf-8");
|
|
37830
37934
|
return filePath;
|
|
37831
37935
|
}
|
|
37832
37936
|
function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
@@ -37953,14 +38057,14 @@ function resolveCliSessionBinding(provider, normalizedType, cliArgs, requestedRe
|
|
|
37953
38057
|
launchMode: "new"
|
|
37954
38058
|
};
|
|
37955
38059
|
}
|
|
37956
|
-
var os16, path19, crypto4,
|
|
38060
|
+
var os16, path19, crypto4, import_fs9, import_child_process6, chalkModule, chalkApi, COORDINATOR_DELEGATED_ENV_UNSETS, DaemonCliManager;
|
|
37957
38061
|
var init_cli_manager = __esm({
|
|
37958
38062
|
"../../oss/packages/daemon-core/src/commands/cli-manager.ts"() {
|
|
37959
38063
|
"use strict";
|
|
37960
38064
|
os16 = __toESM(require("os"));
|
|
37961
38065
|
path19 = __toESM(require("path"));
|
|
37962
38066
|
crypto4 = __toESM(require("crypto"));
|
|
37963
|
-
|
|
38067
|
+
import_fs9 = require("fs");
|
|
37964
38068
|
import_child_process6 = require("child_process");
|
|
37965
38069
|
init_source2();
|
|
37966
38070
|
init_provider_cli_adapter();
|
|
@@ -38874,7 +38978,7 @@ function createFsWatchInstance(path42, options, listener, errHandler, emitRaw) {
|
|
|
38874
38978
|
}
|
|
38875
38979
|
};
|
|
38876
38980
|
try {
|
|
38877
|
-
return (0,
|
|
38981
|
+
return (0, import_fs10.watch)(path42, {
|
|
38878
38982
|
persistent: options.persistent
|
|
38879
38983
|
}, handleEvent);
|
|
38880
38984
|
} catch (error48) {
|
|
@@ -38882,11 +38986,11 @@ function createFsWatchInstance(path42, options, listener, errHandler, emitRaw) {
|
|
|
38882
38986
|
return void 0;
|
|
38883
38987
|
}
|
|
38884
38988
|
}
|
|
38885
|
-
var
|
|
38989
|
+
var import_fs10, import_promises5, sysPath, import_os3, STR_DATA, STR_END, STR_CLOSE, EMPTY_FN, pl, isWindows, isMacos, isLinux, isFreeBSD, isIBMi, EVENTS, EV, THROTTLE_MODE_WATCH, statMethods, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, binaryExtensions, isBinaryPath, foreach, addAndConvert, clearItem, delFromSet, isEmptySet, FsWatchInstances, fsWatchBroadcast, setFsWatchListener, FsWatchFileInstances, setFsWatchFileListener, NodeFsHandler;
|
|
38886
38990
|
var init_handler2 = __esm({
|
|
38887
38991
|
"../../oss/node_modules/chokidar/esm/handler.js"() {
|
|
38888
38992
|
"use strict";
|
|
38889
|
-
|
|
38993
|
+
import_fs10 = require("fs");
|
|
38890
38994
|
import_promises5 = require("fs/promises");
|
|
38891
38995
|
sysPath = __toESM(require("path"), 1);
|
|
38892
38996
|
import_os3 = require("os");
|
|
@@ -39290,7 +39394,7 @@ var init_handler2 = __esm({
|
|
|
39290
39394
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
39291
39395
|
const copts = cont && cont.options;
|
|
39292
39396
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
39293
|
-
(0,
|
|
39397
|
+
(0, import_fs10.unwatchFile)(fullPath);
|
|
39294
39398
|
cont = void 0;
|
|
39295
39399
|
}
|
|
39296
39400
|
if (cont) {
|
|
@@ -39301,7 +39405,7 @@ var init_handler2 = __esm({
|
|
|
39301
39405
|
listeners: listener,
|
|
39302
39406
|
rawEmitters: rawEmitter,
|
|
39303
39407
|
options,
|
|
39304
|
-
watcher: (0,
|
|
39408
|
+
watcher: (0, import_fs10.watchFile)(fullPath, options, (curr, prev) => {
|
|
39305
39409
|
foreach(cont.rawEmitters, (rawEmitter2) => {
|
|
39306
39410
|
rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
|
|
39307
39411
|
});
|
|
@@ -39318,7 +39422,7 @@ var init_handler2 = __esm({
|
|
|
39318
39422
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
39319
39423
|
if (isEmptySet(cont.listeners)) {
|
|
39320
39424
|
FsWatchFileInstances.delete(fullPath);
|
|
39321
|
-
(0,
|
|
39425
|
+
(0, import_fs10.unwatchFile)(fullPath);
|
|
39322
39426
|
cont.options = cont.watcher = void 0;
|
|
39323
39427
|
Object.freeze(cont);
|
|
39324
39428
|
}
|
|
@@ -39696,11 +39800,11 @@ function watch(paths, options = {}) {
|
|
|
39696
39800
|
watcher.add(paths);
|
|
39697
39801
|
return watcher;
|
|
39698
39802
|
}
|
|
39699
|
-
var
|
|
39803
|
+
var import_fs11, import_promises6, import_events2, sysPath2, SLASH, SLASH_SLASH, ONE_DOT, TWO_DOTS, STRING_TYPE, BACK_SLASH_RE, DOUBLE_SLASH_RE, DOT_RE, REPLACER_RE, isMatcherObject, unifyPaths, toUnix, normalizePathToUnix, normalizeIgnored, getAbsolutePath, EMPTY_SET, DirEntry, STAT_METHOD_F, STAT_METHOD_L, WatchHelper, FSWatcher;
|
|
39700
39804
|
var init_esm2 = __esm({
|
|
39701
39805
|
"../../oss/node_modules/chokidar/esm/index.js"() {
|
|
39702
39806
|
"use strict";
|
|
39703
|
-
|
|
39807
|
+
import_fs11 = require("fs");
|
|
39704
39808
|
import_promises6 = require("fs/promises");
|
|
39705
39809
|
import_events2 = require("events");
|
|
39706
39810
|
sysPath2 = __toESM(require("path"), 1);
|
|
@@ -40178,7 +40282,7 @@ var init_esm2 = __esm({
|
|
|
40178
40282
|
const now = /* @__PURE__ */ new Date();
|
|
40179
40283
|
const writes = this._pendingWrites;
|
|
40180
40284
|
function awaitWriteFinishFn(prevStat) {
|
|
40181
|
-
(0,
|
|
40285
|
+
(0, import_fs11.stat)(fullPath, (err, curStat) => {
|
|
40182
40286
|
if (err || !writes.has(path42)) {
|
|
40183
40287
|
if (err && err.code !== "ENOENT")
|
|
40184
40288
|
awfEmit(err);
|
|
@@ -46855,7 +46959,7 @@ function truncateValidationOutput(value) {
|
|
|
46855
46959
|
}
|
|
46856
46960
|
function readPackageScripts(workspace) {
|
|
46857
46961
|
try {
|
|
46858
|
-
const packageJsonPath = (0,
|
|
46962
|
+
const packageJsonPath = (0, import_path7.join)(workspace, "package.json");
|
|
46859
46963
|
const parsed = JSON.parse(fs10.readFileSync(packageJsonPath, "utf-8"));
|
|
46860
46964
|
return parsed?.scripts && typeof parsed.scripts === "object" && !Array.isArray(parsed.scripts) ? parsed.scripts : {};
|
|
46861
46965
|
} catch {
|
|
@@ -47063,13 +47167,13 @@ function serializeMeshCoordinatorMcpConfig(config2, format) {
|
|
|
47063
47167
|
}
|
|
47064
47168
|
function resolveHermesUserHome() {
|
|
47065
47169
|
const explicitHome = process.env.HERMES_HOME?.trim();
|
|
47066
|
-
return explicitHome || (0,
|
|
47170
|
+
return explicitHome || (0, import_path7.join)((0, import_os4.homedir)(), ".hermes");
|
|
47067
47171
|
}
|
|
47068
47172
|
function loadHermesCoordinatorBaseConfig(targetConfigPath) {
|
|
47069
47173
|
const sourceHome = resolveHermesUserHome();
|
|
47070
|
-
const sourceConfigPath = (0,
|
|
47174
|
+
const sourceConfigPath = (0, import_path7.join)(sourceHome, "config.yaml");
|
|
47071
47175
|
if (!fs10.existsSync(sourceConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
|
|
47072
|
-
if ((0,
|
|
47176
|
+
if ((0, import_path7.resolve)(sourceConfigPath) === (0, import_path7.resolve)(targetConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
|
|
47073
47177
|
const parsed = parseMeshCoordinatorMcpConfig(fs10.readFileSync(sourceConfigPath, "utf-8"), "hermes_config_yaml");
|
|
47074
47178
|
const { mcp_servers: _mcpServers, ...baseConfig } = parsed;
|
|
47075
47179
|
return { config: baseConfig, sourceHome, sourceConfigPath };
|
|
@@ -47103,10 +47207,10 @@ function stripHermesCoordinatorTempModelProviderOverrides(config2) {
|
|
|
47103
47207
|
return sanitized;
|
|
47104
47208
|
}
|
|
47105
47209
|
function copyHermesCoordinatorCredentialFiles(sourceHome, targetHome) {
|
|
47106
|
-
if ((0,
|
|
47210
|
+
if ((0, import_path7.resolve)(sourceHome) === (0, import_path7.resolve)(targetHome)) return;
|
|
47107
47211
|
for (const fileName of [".env", "auth.json"]) {
|
|
47108
|
-
const sourcePath = (0,
|
|
47109
|
-
const targetPath = (0,
|
|
47212
|
+
const sourcePath = (0, import_path7.join)(sourceHome, fileName);
|
|
47213
|
+
const targetPath = (0, import_path7.join)(targetHome, fileName);
|
|
47110
47214
|
if (!fs10.existsSync(sourcePath)) continue;
|
|
47111
47215
|
try {
|
|
47112
47216
|
fs10.copyFileSync(sourcePath, targetPath);
|
|
@@ -47196,7 +47300,7 @@ function summarizeSessionHostPruneResult(result) {
|
|
|
47196
47300
|
keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
|
|
47197
47301
|
};
|
|
47198
47302
|
}
|
|
47199
|
-
var import_os4,
|
|
47303
|
+
var import_os4, import_path7, fs10, CHANNEL_NPM_TAG, CHANNEL_SERVER_URL, REFINE_VALIDATION_CATEGORIES, REFINE_VALIDATION_TIMEOUT_MS, REFINE_VALIDATION_OUTPUT_LIMIT_BYTES, REFINE_VALIDATION_SUMMARY_CHARS, REFINE_VALIDATION_MAX_COMMANDS, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
|
|
47200
47304
|
var init_router = __esm({
|
|
47201
47305
|
"../../oss/packages/daemon-core/src/commands/router.ts"() {
|
|
47202
47306
|
"use strict";
|
|
@@ -47226,7 +47330,7 @@ var init_router = __esm({
|
|
|
47226
47330
|
init_snapshot();
|
|
47227
47331
|
init_upgrade_helper();
|
|
47228
47332
|
import_os4 = require("os");
|
|
47229
|
-
|
|
47333
|
+
import_path7 = require("path");
|
|
47230
47334
|
fs10 = __toESM(require("fs"));
|
|
47231
47335
|
CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
|
|
47232
47336
|
CHANNEL_SERVER_URL = {
|
|
@@ -47355,7 +47459,7 @@ var init_router = __esm({
|
|
|
47355
47459
|
}
|
|
47356
47460
|
const { resolveWorktreePath: resolveWorktreePath2, listWorktrees: listWorktrees2, removeWorktree: removeWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
|
|
47357
47461
|
const normalizePath3 = (value) => {
|
|
47358
|
-
const resolved = (0,
|
|
47462
|
+
const resolved = (0, import_path7.resolve)(value);
|
|
47359
47463
|
try {
|
|
47360
47464
|
return fs10.realpathSync(resolved);
|
|
47361
47465
|
} catch {
|
|
@@ -47756,7 +47860,8 @@ var init_router = __esm({
|
|
|
47756
47860
|
return handleMeshForwardEvent({ instanceManager: this.deps.instanceManager }, args);
|
|
47757
47861
|
}
|
|
47758
47862
|
case "get_pending_mesh_events": {
|
|
47759
|
-
const
|
|
47863
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
47864
|
+
const events = drainPendingMeshCoordinatorEvents(meshId || void 0);
|
|
47760
47865
|
return { success: true, events };
|
|
47761
47866
|
}
|
|
47762
47867
|
case "launch_cli":
|
|
@@ -48977,7 +49082,7 @@ ${block}`);
|
|
|
48977
49082
|
workspace
|
|
48978
49083
|
};
|
|
48979
49084
|
}
|
|
48980
|
-
const { existsSync:
|
|
49085
|
+
const { existsSync: existsSync33, readFileSync: readFileSync24, writeFileSync: writeFileSync18, copyFileSync: copyFileSync5, mkdirSync: mkdirSync22 } = await import("fs");
|
|
48981
49086
|
const { dirname: dirname13 } = await import("path");
|
|
48982
49087
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
48983
49088
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -49020,14 +49125,14 @@ ${block}`);
|
|
|
49020
49125
|
if (hermesManualFallback) return returnManualFallback(message);
|
|
49021
49126
|
return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
|
|
49022
49127
|
}
|
|
49023
|
-
const hadExistingMcpConfig =
|
|
49128
|
+
const hadExistingMcpConfig = existsSync33(mcpConfigPath);
|
|
49024
49129
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
49025
49130
|
if (hermesBaseConfig) {
|
|
49026
49131
|
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname13(mcpConfigPath));
|
|
49027
49132
|
}
|
|
49028
49133
|
if (hadExistingMcpConfig) {
|
|
49029
49134
|
try {
|
|
49030
|
-
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(
|
|
49135
|
+
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync24(mcpConfigPath, "utf-8"), configFormat);
|
|
49031
49136
|
const existingCoordinatorConfig = hermesManualFallback ? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig) : parsedExistingMcpConfig;
|
|
49032
49137
|
existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
|
|
49033
49138
|
copyFileSync5(mcpConfigPath, mcpConfigPath + ".backup");
|
|
@@ -49215,29 +49320,48 @@ ${block}`);
|
|
|
49215
49320
|
}
|
|
49216
49321
|
if (workspace) {
|
|
49217
49322
|
if (!fs10.existsSync(workspace)) {
|
|
49218
|
-
|
|
49219
|
-
|
|
49220
|
-
|
|
49221
|
-
|
|
49222
|
-
|
|
49223
|
-
|
|
49224
|
-
|
|
49225
|
-
|
|
49226
|
-
|
|
49323
|
+
let remoteProbeApplied = false;
|
|
49324
|
+
if (!isSelfNode && daemonId && this.deps.dispatchMeshCommand) {
|
|
49325
|
+
try {
|
|
49326
|
+
const remoteResult = await Promise.race([
|
|
49327
|
+
this.deps.dispatchMeshCommand(daemonId, "git_status", { workspace }),
|
|
49328
|
+
new Promise((_2, reject) => setTimeout(() => reject(new Error("timeout")), 8e3))
|
|
49329
|
+
]);
|
|
49330
|
+
const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
|
|
49331
|
+
if (remoteGit && typeof remoteGit === "object" && typeof remoteGit.isGitRepo === "boolean") {
|
|
49332
|
+
status.git = remoteGit;
|
|
49333
|
+
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
49334
|
+
remoteProbeApplied = true;
|
|
49335
|
+
}
|
|
49336
|
+
} catch {
|
|
49337
|
+
}
|
|
49227
49338
|
}
|
|
49228
|
-
|
|
49229
|
-
|
|
49230
|
-
|
|
49231
|
-
|
|
49232
|
-
|
|
49233
|
-
|
|
49234
|
-
|
|
49235
|
-
|
|
49236
|
-
|
|
49339
|
+
if (!remoteProbeApplied) {
|
|
49340
|
+
if (applyCachedInlineMeshNodeStatus(status, node)) {
|
|
49341
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
49342
|
+
nodeStatuses.push(status);
|
|
49343
|
+
continue;
|
|
49344
|
+
}
|
|
49345
|
+
if (meshRecord?.source === "inline_cache" && !isSelfNode) {
|
|
49346
|
+
status.launchReady = !!daemonId && (readStringValue(status.machineStatus) === "online" || isSelfNode);
|
|
49347
|
+
nodeStatuses.push(status);
|
|
49348
|
+
continue;
|
|
49349
|
+
}
|
|
49237
49350
|
}
|
|
49238
|
-
}
|
|
49239
|
-
|
|
49240
|
-
|
|
49351
|
+
} else {
|
|
49352
|
+
try {
|
|
49353
|
+
const gitStatus = await getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
|
|
49354
|
+
status.git = gitStatus;
|
|
49355
|
+
if (gitStatus.isGitRepo) {
|
|
49356
|
+
status.health = deriveMeshNodeHealthFromGit(gitStatus);
|
|
49357
|
+
} else {
|
|
49358
|
+
status.health = "degraded";
|
|
49359
|
+
if (gitStatus.error && !status.error) status.error = gitStatus.error;
|
|
49360
|
+
}
|
|
49361
|
+
} catch {
|
|
49362
|
+
if (!applyCachedInlineMeshNodeStatus(status, node)) {
|
|
49363
|
+
status.health = "degraded";
|
|
49364
|
+
}
|
|
49241
49365
|
}
|
|
49242
49366
|
}
|
|
49243
49367
|
} else {
|
|
@@ -58095,7 +58219,7 @@ var require_yoctocolors_cjs = __commonJS({
|
|
|
58095
58219
|
}
|
|
58096
58220
|
});
|
|
58097
58221
|
|
|
58098
|
-
// ../../node_modules/@inquirer/figures/dist/esm/index.
|
|
58222
|
+
// ../../node_modules/@inquirer/figures/dist/esm/index.js
|
|
58099
58223
|
function isUnicodeSupported() {
|
|
58100
58224
|
if (import_node_process3.default.platform !== "win32") {
|
|
58101
58225
|
return import_node_process3.default.env["TERM"] !== "linux";
|
|
@@ -58107,7 +58231,7 @@ function isUnicodeSupported() {
|
|
|
58107
58231
|
}
|
|
58108
58232
|
var import_node_process3, common2, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
|
|
58109
58233
|
var init_esm3 = __esm({
|
|
58110
|
-
"../../node_modules/@inquirer/figures/dist/esm/index.
|
|
58234
|
+
"../../node_modules/@inquirer/figures/dist/esm/index.js"() {
|
|
58111
58235
|
"use strict";
|
|
58112
58236
|
import_node_process3 = __toESM(require("process"), 1);
|
|
58113
58237
|
common2 = {
|
|
@@ -58378,7 +58502,10 @@ var init_esm3 = __esm({
|
|
|
58378
58502
|
oneNinth: "1/9",
|
|
58379
58503
|
oneTenth: "1/10"
|
|
58380
58504
|
};
|
|
58381
|
-
mainSymbols = {
|
|
58505
|
+
mainSymbols = {
|
|
58506
|
+
...common2,
|
|
58507
|
+
...specialMainSymbols
|
|
58508
|
+
};
|
|
58382
58509
|
fallbackSymbols = {
|
|
58383
58510
|
...common2,
|
|
58384
58511
|
...specialFallbackSymbols
|
|
@@ -72538,7 +72665,7 @@ var require_buffer_list = __commonJS({
|
|
|
72538
72665
|
}
|
|
72539
72666
|
}, {
|
|
72540
72667
|
key: "join",
|
|
72541
|
-
value: function
|
|
72668
|
+
value: function join40(s) {
|
|
72542
72669
|
if (this.length === 0) return "";
|
|
72543
72670
|
var p = this.head;
|
|
72544
72671
|
var ret = "" + p.data;
|
|
@@ -86597,13 +86724,13 @@ function splitStringBySpace(str2) {
|
|
|
86597
86724
|
}
|
|
86598
86725
|
return pieces;
|
|
86599
86726
|
}
|
|
86600
|
-
var import_chardet, import_child_process12,
|
|
86727
|
+
var import_chardet, import_child_process12, import_fs12, import_node_path3, import_node_os3, import_node_crypto3, import_iconv_lite, ExternalEditor;
|
|
86601
86728
|
var init_esm4 = __esm({
|
|
86602
86729
|
"../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
|
|
86603
86730
|
"use strict";
|
|
86604
86731
|
import_chardet = __toESM(require_lib(), 1);
|
|
86605
86732
|
import_child_process12 = require("child_process");
|
|
86606
|
-
|
|
86733
|
+
import_fs12 = require("fs");
|
|
86607
86734
|
import_node_path3 = __toESM(require("path"), 1);
|
|
86608
86735
|
import_node_os3 = __toESM(require("os"), 1);
|
|
86609
86736
|
import_node_crypto3 = require("crypto");
|
|
@@ -86679,14 +86806,14 @@ var init_esm4 = __esm({
|
|
|
86679
86806
|
if (Object.prototype.hasOwnProperty.call(this.fileOptions, "mode")) {
|
|
86680
86807
|
opt.mode = this.fileOptions.mode;
|
|
86681
86808
|
}
|
|
86682
|
-
(0,
|
|
86809
|
+
(0, import_fs12.writeFileSync)(this.tempFile, this.text, opt);
|
|
86683
86810
|
} catch (createFileError) {
|
|
86684
86811
|
throw new CreateFileError(createFileError);
|
|
86685
86812
|
}
|
|
86686
86813
|
}
|
|
86687
86814
|
readTemporaryFile() {
|
|
86688
86815
|
try {
|
|
86689
|
-
const tempFileBuffer = (0,
|
|
86816
|
+
const tempFileBuffer = (0, import_fs12.readFileSync)(this.tempFile);
|
|
86690
86817
|
if (tempFileBuffer.length === 0) {
|
|
86691
86818
|
this.text = "";
|
|
86692
86819
|
} else {
|
|
@@ -86702,7 +86829,7 @@ var init_esm4 = __esm({
|
|
|
86702
86829
|
}
|
|
86703
86830
|
removeTemporaryFile() {
|
|
86704
86831
|
try {
|
|
86705
|
-
(0,
|
|
86832
|
+
(0, import_fs12.unlinkSync)(this.tempFile);
|
|
86706
86833
|
} catch (removeFileError) {
|
|
86707
86834
|
throw new RemoveFileError(removeFileError);
|
|
86708
86835
|
}
|
|
@@ -88404,25 +88531,25 @@ function resolvePackageVersion(options) {
|
|
|
88404
88531
|
const injectedVersion = options?.injectedVersion || "unknown";
|
|
88405
88532
|
const dir = options?.dirname || __dirname;
|
|
88406
88533
|
const possiblePaths = [
|
|
88407
|
-
(0,
|
|
88408
|
-
(0,
|
|
88409
|
-
(0,
|
|
88534
|
+
(0, import_path8.join)(dir, "..", "..", "package.json"),
|
|
88535
|
+
(0, import_path8.join)(dir, "..", "package.json"),
|
|
88536
|
+
(0, import_path8.join)(dir, "package.json")
|
|
88410
88537
|
];
|
|
88411
88538
|
for (const p of possiblePaths) {
|
|
88412
88539
|
try {
|
|
88413
|
-
const data = JSON.parse((0,
|
|
88540
|
+
const data = JSON.parse((0, import_fs13.readFileSync)(p, "utf-8"));
|
|
88414
88541
|
if (data.version) return data.version;
|
|
88415
88542
|
} catch {
|
|
88416
88543
|
}
|
|
88417
88544
|
}
|
|
88418
88545
|
return injectedVersion;
|
|
88419
88546
|
}
|
|
88420
|
-
var
|
|
88547
|
+
var import_fs13, import_path8;
|
|
88421
88548
|
var init_version = __esm({
|
|
88422
88549
|
"src/version.ts"() {
|
|
88423
88550
|
"use strict";
|
|
88424
|
-
|
|
88425
|
-
|
|
88551
|
+
import_fs13 = require("fs");
|
|
88552
|
+
import_path8 = require("path");
|
|
88426
88553
|
}
|
|
88427
88554
|
});
|
|
88428
88555
|
|
|
@@ -90358,7 +90485,7 @@ var require_filesystem = __commonJS({
|
|
|
90358
90485
|
var LDD_PATH = "/usr/bin/ldd";
|
|
90359
90486
|
var SELF_PATH = "/proc/self/exe";
|
|
90360
90487
|
var MAX_LENGTH = 2048;
|
|
90361
|
-
var
|
|
90488
|
+
var readFileSync24 = (path42) => {
|
|
90362
90489
|
const fd = fs24.openSync(path42, "r");
|
|
90363
90490
|
const buffer = Buffer.alloc(MAX_LENGTH);
|
|
90364
90491
|
const bytesRead = fs24.readSync(fd, buffer, 0, MAX_LENGTH, 0);
|
|
@@ -90383,7 +90510,7 @@ var require_filesystem = __commonJS({
|
|
|
90383
90510
|
module2.exports = {
|
|
90384
90511
|
LDD_PATH,
|
|
90385
90512
|
SELF_PATH,
|
|
90386
|
-
readFileSync:
|
|
90513
|
+
readFileSync: readFileSync24,
|
|
90387
90514
|
readFile: readFile2
|
|
90388
90515
|
};
|
|
90389
90516
|
}
|
|
@@ -90432,7 +90559,7 @@ var require_detect_libc = __commonJS({
|
|
|
90432
90559
|
"use strict";
|
|
90433
90560
|
var childProcess = require("child_process");
|
|
90434
90561
|
var { isLinux: isLinux2, getReport } = require_process();
|
|
90435
|
-
var { LDD_PATH, SELF_PATH, readFile: readFile2, readFileSync:
|
|
90562
|
+
var { LDD_PATH, SELF_PATH, readFile: readFile2, readFileSync: readFileSync24 } = require_filesystem();
|
|
90436
90563
|
var { interpreterPath } = require_elf();
|
|
90437
90564
|
var cachedFamilyInterpreter;
|
|
90438
90565
|
var cachedFamilyFilesystem;
|
|
@@ -90524,7 +90651,7 @@ var require_detect_libc = __commonJS({
|
|
|
90524
90651
|
}
|
|
90525
90652
|
cachedFamilyFilesystem = null;
|
|
90526
90653
|
try {
|
|
90527
|
-
const lddContent =
|
|
90654
|
+
const lddContent = readFileSync24(LDD_PATH);
|
|
90528
90655
|
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
90529
90656
|
} catch (e) {
|
|
90530
90657
|
}
|
|
@@ -90549,7 +90676,7 @@ var require_detect_libc = __commonJS({
|
|
|
90549
90676
|
}
|
|
90550
90677
|
cachedFamilyInterpreter = null;
|
|
90551
90678
|
try {
|
|
90552
|
-
const selfContent =
|
|
90679
|
+
const selfContent = readFileSync24(SELF_PATH);
|
|
90553
90680
|
const path42 = interpreterPath(selfContent);
|
|
90554
90681
|
cachedFamilyInterpreter = familyFromInterpreterPath(path42);
|
|
90555
90682
|
} catch (e) {
|
|
@@ -90613,7 +90740,7 @@ var require_detect_libc = __commonJS({
|
|
|
90613
90740
|
}
|
|
90614
90741
|
cachedVersionFilesystem = null;
|
|
90615
90742
|
try {
|
|
90616
|
-
const lddContent =
|
|
90743
|
+
const lddContent = readFileSync24(LDD_PATH);
|
|
90617
90744
|
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
90618
90745
|
if (versionMatch) {
|
|
90619
90746
|
cachedVersionFilesystem = versionMatch[1];
|
|
@@ -98283,7 +98410,7 @@ var init_adhdev_daemon = __esm({
|
|
|
98283
98410
|
init_version();
|
|
98284
98411
|
init_src();
|
|
98285
98412
|
init_runtime_defaults();
|
|
98286
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
98413
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.24" });
|
|
98287
98414
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
98288
98415
|
localHttpServer = null;
|
|
98289
98416
|
localWss = null;
|