@qablehq/atto 0.0.26 → 0.0.27

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/bin/atto.js CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  // Opens the built Atto desktop window. Installed as the `atto` command.
3
- // If a silent update was queued on the previous quit, apply it before launch.
4
- const { spawn, spawnSync } = require("node:child_process");
3
+ // If a silent update was queued on the previous quit, kick it off in the
4
+ // background — never block the window on npm install.
5
+ const { spawn } = require("node:child_process");
5
6
  const fs = require("node:fs");
6
7
  const os = require("node:os");
7
8
  const path = require("node:path");
8
9
 
9
10
  const PENDING_FILE = path.join(os.homedir(), ".atto", "pending-npm-update.json");
10
11
 
11
- function applyPendingSilentUpdate() {
12
+ function kickPendingSilentUpdate() {
12
13
  let pending;
13
14
  try {
14
15
  pending = JSON.parse(fs.readFileSync(PENDING_FILE, "utf8"));
@@ -28,22 +29,26 @@ function applyPendingSilentUpdate() {
28
29
  const args = ["install", "-g", `${pending.name}@${pending.version}`, "--silent", "--no-fund", "--no-audit"];
29
30
  if (pending.prefix) args.push("--prefix", pending.prefix);
30
31
 
31
- // Best-effort: if install fails (locked files / offline), keep the pending file for next open.
32
- const result = spawnSync(npm, args, {
33
- stdio: "ignore",
34
- windowsHide: true,
35
- timeout: 120_000,
36
- });
37
- if (result.status === 0) {
32
+ // Fire-and-forget: this session keeps the current build; next `atto` gets the update.
33
+ // Do not wait — spawnSync here used to delay open by minutes on slow networks.
34
+ try {
35
+ const child = spawn(npm, args, {
36
+ detached: true,
37
+ stdio: "ignore",
38
+ windowsHide: true,
39
+ });
40
+ child.unref();
38
41
  try {
39
42
  fs.unlinkSync(PENDING_FILE);
40
43
  } catch {
41
44
  /* ignore */
42
45
  }
46
+ } catch {
47
+ /* keep pending file for next open */
43
48
  }
44
49
  }
45
50
 
46
- applyPendingSilentUpdate();
51
+ kickPendingSilentUpdate();
47
52
 
48
53
  let electronPath;
49
54
  try {
package/out/main/index.js CHANGED
@@ -12699,6 +12699,15 @@ function setupAutoUpdater() {
12699
12699
  });
12700
12700
  }
12701
12701
  registerMediaProtocolScheme();
12702
+ function warmChromiumInBackground() {
12703
+ const check = chromiumExecutable();
12704
+ if (check.available) return;
12705
+ console.log("[atto] Chromium missing — downloading in background");
12706
+ void installChromium().then((result) => {
12707
+ if (result.ok) console.log("[atto] Chromium ready");
12708
+ else console.warn("[atto] Chromium download failed:", result.error);
12709
+ });
12710
+ }
12702
12711
  function createMainWindow() {
12703
12712
  const mainWindow = new electron.BrowserWindow({
12704
12713
  width: 1320,
@@ -12732,6 +12741,8 @@ function createMainWindow() {
12732
12741
  }
12733
12742
  electron.app.whenReady().then(() => {
12734
12743
  registerMediaProtocol();
12744
+ createMainWindow();
12745
+ warmChromiumInBackground();
12735
12746
  const engine = process.env.TAA_ENGINE === "mock" ? new MockFixturePlayer() : new RealEngine();
12736
12747
  registerIpcHandlers(engine);
12737
12748
  electron.app.on("before-quit", () => {
@@ -12743,7 +12754,6 @@ electron.app.whenReady().then(() => {
12743
12754
  registerProjectFilesHandlers();
12744
12755
  registerAppStateHandlers();
12745
12756
  registerTesboHandlers(engine);
12746
- createMainWindow();
12747
12757
  setupAutoUpdater();
12748
12758
  electron.app.on("activate", () => {
12749
12759
  if (electron.BrowserWindow.getAllWindows().length === 0) createMainWindow();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qablehq/atto",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "description": "Atto — AI-assisted desktop test automation",
5
5
  "homepage": "https://github.com/QAbleHQ/Atto",
6
6
  "author": {
@@ -1,25 +1,6 @@
1
1
  #!/usr/bin/env node
2
- // Downloads Playwright's Chromium when a client installs the package globally.
3
- // Skipped inside the Atto monorepo so Jenkins and local pnpm install stay unchanged.
4
- const { spawnSync } = require("node:child_process");
5
- const { createRequire } = require("node:module");
6
- const path = require("node:path");
7
-
8
- if (process.env.npm_config_global !== "true") {
9
- process.exit(0);
10
- }
11
-
12
- const requireFromPackage = createRequire(path.join(__dirname, "..", "package.json"));
13
- let cliPath;
14
- try {
15
- cliPath = requireFromPackage.resolve("playwright/cli");
16
- } catch {
17
- console.warn("[atto] Playwright is not installed. The app will download Chromium on the first test.");
18
- process.exit(0);
19
- }
20
-
21
- const result = spawnSync(process.execPath, [cliPath, "install", "chromium"], { stdio: "inherit" });
22
- if (result.status !== 0) {
23
- console.warn("[atto] Chromium download did not finish. The app will try again on the first test.");
24
- }
2
+ // Intentionally a no-op on npm install.
3
+ // Chromium is large; downloading it during `npm install -g` makes first setup feel stuck.
4
+ // The desktop app fetches Chromium in the background after the window opens (and again
5
+ // before the first browser session if needed).
25
6
  process.exit(0);