aglio-worker 0.48.1 → 0.49.0
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/agent.js +9 -11
- package/package.json +1 -1
package/agent.js
CHANGED
|
@@ -28615,19 +28615,17 @@ function dockerAuthFor(image) {
|
|
|
28615
28615
|
if (entry.registrytoken) return { registrytoken: entry.registrytoken };
|
|
28616
28616
|
return void 0;
|
|
28617
28617
|
}
|
|
28618
|
-
var inFlight = /* @__PURE__ */ new
|
|
28618
|
+
var inFlight = /* @__PURE__ */ new Map();
|
|
28619
|
+
async function waitForImagePulls() {
|
|
28620
|
+
await Promise.allSettled([...inFlight.values()]);
|
|
28621
|
+
}
|
|
28619
28622
|
async function pullDockerImage(client, image) {
|
|
28620
28623
|
if (!isRegistryImage(image)) {
|
|
28621
28624
|
throw new Error(
|
|
28622
28625
|
`Runner image ${image} is not registry-qualified. Build it with: pnpm runner:build`
|
|
28623
28626
|
);
|
|
28624
28627
|
}
|
|
28625
|
-
|
|
28626
|
-
if (!pending) {
|
|
28627
|
-
pending = /* @__PURE__ */ new Map();
|
|
28628
|
-
inFlight.set(client, pending);
|
|
28629
|
-
}
|
|
28630
|
-
const existing = pending.get(image);
|
|
28628
|
+
const existing = inFlight.get(image);
|
|
28631
28629
|
if (existing) return existing;
|
|
28632
28630
|
const pull = (async () => {
|
|
28633
28631
|
const stream = await client.pull(image, { authconfig: dockerAuthFor(image) });
|
|
@@ -28637,11 +28635,11 @@ async function pullDockerImage(client, image) {
|
|
|
28637
28635
|
stream.on("error", (error62) => reject(error62));
|
|
28638
28636
|
});
|
|
28639
28637
|
})();
|
|
28640
|
-
|
|
28638
|
+
inFlight.set(image, pull);
|
|
28641
28639
|
try {
|
|
28642
28640
|
await pull;
|
|
28643
28641
|
} finally {
|
|
28644
|
-
|
|
28642
|
+
inFlight.delete(image);
|
|
28645
28643
|
}
|
|
28646
28644
|
}
|
|
28647
28645
|
async function ensureDockerImage(input2) {
|
|
@@ -29302,6 +29300,7 @@ async function cleanupDockerDisk(input2) {
|
|
|
29302
29300
|
return result;
|
|
29303
29301
|
}
|
|
29304
29302
|
}
|
|
29303
|
+
await waitForImagePulls();
|
|
29305
29304
|
try {
|
|
29306
29305
|
const pruned = await client.pruneImages({ filters: { dangling: ["true"] } });
|
|
29307
29306
|
result.danglingImagesRemoved = pruned.ImagesDeleted?.length ?? 0;
|
|
@@ -30728,8 +30727,7 @@ function errorText2(error62) {
|
|
|
30728
30727
|
}
|
|
30729
30728
|
function summarizeToolArgs(value) {
|
|
30730
30729
|
try {
|
|
30731
|
-
|
|
30732
|
-
return json3.length > 2e3 ? `${json3.slice(0, 1999)}\u2026` : json3;
|
|
30730
|
+
return JSON.stringify(value ?? {});
|
|
30733
30731
|
} catch {
|
|
30734
30732
|
return "";
|
|
30735
30733
|
}
|