@kendoo.agentdesk/agentdesk 0.25.1 → 0.25.2
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/cli/screenshot.mjs +21 -3
- package/package.json +1 -1
package/cli/screenshot.mjs
CHANGED
|
@@ -31,9 +31,27 @@ async function loadPuppeteer() {
|
|
|
31
31
|
try {
|
|
32
32
|
return await import("puppeteer");
|
|
33
33
|
} catch {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
// AD-50: require explicit consent before installing puppeteer (a ~200 MB
|
|
35
|
+
// dependency that pulls in a Chromium download). Previously this ran
|
|
36
|
+
// silently on first screenshot — surprising, and a supply-chain compromise
|
|
37
|
+
// of puppeteer would have applied transparently.
|
|
38
|
+
if (process.env.AGENTDESK_SCREENSHOT_AUTO_INSTALL === "1") {
|
|
39
|
+
console.log("Installing puppeteer (AGENTDESK_SCREENSHOT_AUTO_INSTALL=1)...");
|
|
40
|
+
} else if (process.stdin.isTTY) {
|
|
41
|
+
const { createInterface } = await import("readline");
|
|
42
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
43
|
+
const answer = await new Promise(resolve =>
|
|
44
|
+
rl.question("Screenshot requires puppeteer (~200 MB). Install now? [y/N] ", resolve)
|
|
45
|
+
);
|
|
46
|
+
rl.close();
|
|
47
|
+
if (!/^y(es)?$/i.test(String(answer).trim())) {
|
|
48
|
+
throw new Error("Puppeteer install declined. Re-run with AGENTDESK_SCREENSHOT_AUTO_INSTALL=1 to skip this prompt.");
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
throw new Error("puppeteer is not installed and no terminal is available to confirm. Set AGENTDESK_SCREENSHOT_AUTO_INSTALL=1 to install non-interactively.");
|
|
52
|
+
}
|
|
53
|
+
const { execFileSync } = await import("child_process");
|
|
54
|
+
execFileSync("npm", ["install", "--no-save", "puppeteer"], { stdio: "inherit" });
|
|
37
55
|
return await import("puppeteer");
|
|
38
56
|
}
|
|
39
57
|
}
|