@ai-development-environment/control-agent 0.0.73 → 0.0.74
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/control-agent.js +39 -6
- package/package.json +1 -1
package/dist/control-agent.js
CHANGED
|
@@ -12497,16 +12497,44 @@ async function sharedCapacityId(canonicalPath, volumeId, signal) {
|
|
|
12497
12497
|
return volumeId;
|
|
12498
12498
|
}
|
|
12499
12499
|
}
|
|
12500
|
-
async function inspectVolume(configuredPath, role, signal) {
|
|
12500
|
+
async function inspectVolume(configuredPath, role, signal, allowMissing) {
|
|
12501
12501
|
signal.throwIfAborted();
|
|
12502
|
-
|
|
12502
|
+
let canonicalPath;
|
|
12503
|
+
let inspectionPath;
|
|
12504
|
+
try {
|
|
12505
|
+
canonicalPath = await realpath4(configuredPath);
|
|
12506
|
+
inspectionPath = canonicalPath;
|
|
12507
|
+
} catch (error) {
|
|
12508
|
+
if (!allowMissing || error.code !== "ENOENT") {
|
|
12509
|
+
throw error;
|
|
12510
|
+
}
|
|
12511
|
+
const missingSegments = [];
|
|
12512
|
+
let candidate = resolve4(configuredPath);
|
|
12513
|
+
for (; ; ) {
|
|
12514
|
+
signal.throwIfAborted();
|
|
12515
|
+
const parent = dirname3(candidate);
|
|
12516
|
+
if (parent === candidate) throw error;
|
|
12517
|
+
missingSegments.unshift(basename4(candidate));
|
|
12518
|
+
candidate = parent;
|
|
12519
|
+
try {
|
|
12520
|
+
inspectionPath = await realpath4(candidate);
|
|
12521
|
+
canonicalPath = join6(inspectionPath, ...missingSegments);
|
|
12522
|
+
break;
|
|
12523
|
+
} catch (parentError) {
|
|
12524
|
+
if (parentError.code !== "ENOENT") {
|
|
12525
|
+
throw parentError;
|
|
12526
|
+
}
|
|
12527
|
+
}
|
|
12528
|
+
}
|
|
12529
|
+
}
|
|
12503
12530
|
const [information, filesystem] = await Promise.all([
|
|
12504
|
-
stat5(
|
|
12505
|
-
statfs(
|
|
12531
|
+
stat5(inspectionPath),
|
|
12532
|
+
statfs(inspectionPath, { bigint: true })
|
|
12506
12533
|
]);
|
|
12507
12534
|
const id2 = String(information.dev);
|
|
12508
12535
|
return {
|
|
12509
12536
|
canonicalPath,
|
|
12537
|
+
inspectionPath,
|
|
12510
12538
|
volume: {
|
|
12511
12539
|
id: id2,
|
|
12512
12540
|
capacityId: id2,
|
|
@@ -12534,7 +12562,12 @@ async function collectAgentDiskSpace(configuration, signal) {
|
|
|
12534
12562
|
for (const request of requested) {
|
|
12535
12563
|
signal.throwIfAborted();
|
|
12536
12564
|
try {
|
|
12537
|
-
const inspected = await inspectVolume(
|
|
12565
|
+
const inspected = await inspectVolume(
|
|
12566
|
+
request.path,
|
|
12567
|
+
request.role,
|
|
12568
|
+
signal,
|
|
12569
|
+
request.role === "DERIVED_DATA"
|
|
12570
|
+
);
|
|
12538
12571
|
const existing = volumes.get(inspected.volume.id);
|
|
12539
12572
|
if (existing) {
|
|
12540
12573
|
existing.roles.add(request.role);
|
|
@@ -12543,7 +12576,7 @@ async function collectAgentDiskSpace(configuration, signal) {
|
|
|
12543
12576
|
existing.freeBytes = inspected.volume.freeBytes;
|
|
12544
12577
|
} else {
|
|
12545
12578
|
inspected.volume.capacityId = await sharedCapacityId(
|
|
12546
|
-
inspected.
|
|
12579
|
+
inspected.inspectionPath,
|
|
12547
12580
|
inspected.volume.id,
|
|
12548
12581
|
signal
|
|
12549
12582
|
);
|