@qablehq/atto 0.0.21 → 0.0.23

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,8 +1,50 @@
1
1
  #!/usr/bin/env node
2
2
  // Opens the built Atto desktop window. Installed as the `atto` command.
3
- const { spawn } = require("node:child_process");
3
+ // If a silent update was queued on the previous quit, apply it before launch.
4
+ const { spawn, spawnSync } = require("node:child_process");
5
+ const fs = require("node:fs");
6
+ const os = require("node:os");
4
7
  const path = require("node:path");
5
8
 
9
+ const PENDING_FILE = path.join(os.homedir(), ".atto", "pending-npm-update.json");
10
+
11
+ function applyPendingSilentUpdate() {
12
+ let pending;
13
+ try {
14
+ pending = JSON.parse(fs.readFileSync(PENDING_FILE, "utf8"));
15
+ } catch {
16
+ return;
17
+ }
18
+ if (!pending?.name || !pending?.version) {
19
+ try {
20
+ fs.unlinkSync(PENDING_FILE);
21
+ } catch {
22
+ /* ignore */
23
+ }
24
+ return;
25
+ }
26
+
27
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
28
+ const args = ["install", "-g", `${pending.name}@${pending.version}`, "--silent", "--no-fund", "--no-audit"];
29
+ if (pending.prefix) args.push("--prefix", pending.prefix);
30
+
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) {
38
+ try {
39
+ fs.unlinkSync(PENDING_FILE);
40
+ } catch {
41
+ /* ignore */
42
+ }
43
+ }
44
+ }
45
+
46
+ applyPendingSilentUpdate();
47
+
6
48
  let electronPath;
7
49
  try {
8
50
  electronPath = require("electron");
package/out/main/index.js CHANGED
@@ -10,6 +10,7 @@ const node_child_process = require("node:child_process");
10
10
  const playwright = require("playwright");
11
11
  const ts = require("typescript");
12
12
  const node_module = require("node:module");
13
+ const node_os = require("node:os");
13
14
  const electronUpdater = require("electron-updater");
14
15
  const IPC_CHANNELS = {
15
16
  submitGoal: "taa:sessions:submitGoal",
@@ -366,13 +367,7 @@ function mirrorEngineEventToChat(event) {
366
367
  return;
367
368
  }
368
369
  if (event.type === "narration_step" && event.status === "in_progress") return;
369
- if (event.type === "narration_step" && Array.isArray(event.attachments)) {
370
- const shot = event.attachments.find((item) => item.kind === "screenshot" && item.url);
371
- if (shot?.url?.startsWith("taa-media://")) {
372
- void uploadLiveFrame(jobId, event.sessionId, shot.url).catch(() => void 0);
373
- }
374
- }
375
- const payload = event.type === "code_generated" ? {
370
+ const basePayload = event.type === "code_generated" ? {
376
371
  type: "code_generated",
377
372
  sessionId: event.sessionId,
378
373
  filePath: event.filePath,
@@ -385,7 +380,17 @@ function mirrorEngineEventToChat(event) {
385
380
  content: String(file.content || "").slice(0, 12e4)
386
381
  })) : void 0
387
382
  } : event;
388
- void postRemoteSessionEvent(jobId, payload).catch(() => void 0);
383
+ void postRemoteSessionEvent(jobId, basePayload).catch(() => void 0);
384
+ if (event.type === "narration_step" && Array.isArray(event.attachments)) {
385
+ const shot = event.attachments.find((item) => item.kind === "screenshot" && item.url);
386
+ if (shot?.url?.startsWith("taa-media://")) {
387
+ const frameId = String(event.stepId || "").replace(/[^a-zA-Z0-9_-]/g, "").slice(0, 80);
388
+ const caption = String(event.narration || "").slice(0, 300);
389
+ void uploadLiveFrame(jobId, event.sessionId, shot.url, frameId || void 0, caption || void 0).catch(
390
+ () => void 0
391
+ );
392
+ }
393
+ }
389
394
  if (event.type === "session_status_changed") {
390
395
  const status = event.status;
391
396
  if (status === "failed" || status === "stopped" || status === "awaiting_review" || status === "approved") {
@@ -510,21 +515,39 @@ async function fetchAttoRemoteConfig() {
510
515
  }
511
516
  };
512
517
  }
513
- async function uploadLiveFrame(jobId, desktopSessionId, mediaUrl) {
514
- const link = readLink();
515
- if (!link) return;
518
+ async function readLiveFramePayload(desktopSessionId, mediaUrl) {
516
519
  try {
517
520
  const parsed = new URL(mediaUrl);
518
521
  const filename = decodeURIComponent(parsed.pathname.replace(/^\/+/, ""));
519
522
  const absolute = resolveSessionMediaFile(desktopSessionId, filename);
520
- if (!absolute) return;
523
+ if (!absolute) return null;
521
524
  const buf = node_fs.readFileSync(absolute);
522
- if (buf.length > 24e5) return;
525
+ if (buf.length < 32 || buf.length > 24e5) return null;
523
526
  const mime = filename.toLowerCase().endsWith(".png") ? "image/png" : "image/jpeg";
524
- await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/live-frame`, {
525
- method: "POST",
526
- body: JSON.stringify({ imageBase64: buf.toString("base64"), mimeType: mime })
527
- });
527
+ return { buf, mime };
528
+ } catch {
529
+ return null;
530
+ }
531
+ }
532
+ async function uploadLiveFrameBuffer(jobId, buf, mime, frameId, caption) {
533
+ const link = readLink();
534
+ if (!link) return;
535
+ await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/live-frame`, {
536
+ method: "POST",
537
+ body: JSON.stringify({
538
+ imageBase64: buf.toString("base64"),
539
+ mimeType: mime,
540
+ frameId: frameId || void 0,
541
+ caption: caption || void 0,
542
+ createChatShot: Boolean(frameId)
543
+ })
544
+ });
545
+ }
546
+ async function uploadLiveFrame(jobId, desktopSessionId, mediaUrl, frameId, caption) {
547
+ try {
548
+ const frame = await readLiveFramePayload(desktopSessionId, mediaUrl);
549
+ if (!frame) return;
550
+ await uploadLiveFrameBuffer(jobId, frame.buf, frame.mime, frameId, caption);
528
551
  } catch {
529
552
  }
530
553
  }
@@ -11425,6 +11448,9 @@ class RealEngine {
11425
11448
  });
11426
11449
  registerSessionMediaRoot(sessionId, sessionMediaDir(project.folderPath, sessionId));
11427
11450
  await writeSessionMeta(meta);
11451
+ if (cmd.remoteJobId) {
11452
+ bindRemoteSessionJob(cmd.remoteJobId, sessionId);
11453
+ }
11428
11454
  void this.runTracked(sessionId, (signal) => this.startSession(sessionId, signal));
11429
11455
  return sessionId;
11430
11456
  }
@@ -12535,16 +12561,25 @@ function detectNpmPrefix() {
12535
12561
  }
12536
12562
  return beforeModules;
12537
12563
  }
12564
+ function pendingUpdatePath() {
12565
+ return node_path.join(node_os.homedir(), ".atto", "pending-npm-update.json");
12566
+ }
12567
+ function writePendingUpdate(name, version, prefix) {
12568
+ const dir = node_path.join(node_os.homedir(), ".atto");
12569
+ node_fs.mkdirSync(dir, { recursive: true });
12570
+ node_fs.writeFileSync(
12571
+ pendingUpdatePath(),
12572
+ JSON.stringify({ name, version, prefix: prefix ?? null, queuedAt: (/* @__PURE__ */ new Date()).toISOString() }),
12573
+ "utf8"
12574
+ );
12575
+ }
12538
12576
  function setupNpmUpdater() {
12539
12577
  const name = readPackageName();
12540
12578
  let pending = null;
12541
12579
  const prefix = detectNpmPrefix();
12542
- electron.app.on("before-quit", () => {
12543
- if (!pending) return;
12544
- const version = pending;
12545
- pending = null;
12580
+ const installQuietly = (version) => {
12546
12581
  const npm = process.platform === "win32" ? "npm.cmd" : "npm";
12547
- const args = ["install", "-g", `${name}@${version}`];
12582
+ const args = ["install", "-g", `${name}@${version}`, "--silent", "--no-fund", "--no-audit"];
12548
12583
  if (prefix) args.push("--prefix", prefix);
12549
12584
  console.log(
12550
12585
  `[npm-updater] installing ${name}@${version}${prefix ? ` --prefix ${prefix}` : ""} after quit`
@@ -12555,6 +12590,13 @@ function setupNpmUpdater() {
12555
12590
  windowsHide: true
12556
12591
  });
12557
12592
  child.unref();
12593
+ };
12594
+ electron.app.on("before-quit", () => {
12595
+ if (!pending) return;
12596
+ const version = pending;
12597
+ pending = null;
12598
+ writePendingUpdate(name, version, prefix);
12599
+ installQuietly(version);
12558
12600
  });
12559
12601
  const current = electron.app.getVersion();
12560
12602
  void (async () => {
@@ -12566,7 +12608,8 @@ function setupNpmUpdater() {
12566
12608
  const body = await response.json();
12567
12609
  if (!body.version || !isNewerVersion(body.version, current)) return;
12568
12610
  pending = body.version;
12569
- console.log(`[npm-updater] ${body.version} will install quietly on quit`);
12611
+ writePendingUpdate(name, body.version, prefix);
12612
+ console.log(`[npm-updater] ${body.version} queued for silent install on quit / next launch`);
12570
12613
  } catch (error) {
12571
12614
  console.error("[npm-updater] check failed", error);
12572
12615
  } finally {
@@ -1380,6 +1380,10 @@
1380
1380
  padding-block: calc(var(--spacing) * 6);
1381
1381
  }
1382
1382
 
1383
+ .py-8 {
1384
+ padding-block: calc(var(--spacing) * 8);
1385
+ }
1386
+
1383
1387
  .py-16 {
1384
1388
  padding-block: calc(var(--spacing) * 16);
1385
1389
  }
@@ -17255,7 +17255,11 @@ function Sidebar() {
17255
17255
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
17256
17256
  "button",
17257
17257
  {
17258
- onClick: () => setActiveProject(null),
17258
+ type: "button",
17259
+ onClick: () => {
17260
+ setActiveProject(null);
17261
+ setView("projects");
17262
+ },
17259
17263
  className: "flex w-fit items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground",
17260
17264
  children: [
17261
17265
  /* @__PURE__ */ jsxRuntimeExports.jsx(ArrowLeft, { className: "size-3.5" }),
@@ -33137,8 +33141,8 @@ function TesboPanel() {
33137
33141
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "mb-6 rounded-lg border border-border bg-card p-4", children: [
33138
33142
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
33139
33143
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33140
- /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-sm font-semibold", children: "Tesbo projects" }),
33141
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "Paste the access code from your QAble contact. Atto does not open the Tesbo website." }),
33144
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-sm font-semibold", children: status?.connected ? "Tesbo connection" : "Connect with access code" }),
33145
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: status?.connected ? "This PC is linked. Choose a project below to start testing." : "Paste the access code from Agents → Atto on the website. This is the first step — no local project needed." }),
33142
33146
  status?.connected && status.user?.name && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-sm text-foreground", children: status.user.name })
33143
33147
  ] }),
33144
33148
  status?.connected && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => void disconnect(), disabled: busy, children: "Disconnect" })
@@ -33146,7 +33150,7 @@ function TesboPanel() {
33146
33150
  !status?.connected ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
33147
33151
  "form",
33148
33152
  {
33149
- className: "mt-4 grid gap-3",
33153
+ className: "mt-4 grid max-w-lg gap-3",
33150
33154
  onSubmit: (event) => {
33151
33155
  event.preventDefault();
33152
33156
  void connect();
@@ -33159,13 +33163,15 @@ function TesboPanel() {
33159
33163
  {
33160
33164
  value: code,
33161
33165
  onChange: (event) => setCode(event.target.value),
33162
- className: "h-9 rounded-md border border-border bg-background px-3 text-sm text-foreground",
33166
+ className: "h-10 rounded-md border border-border bg-background px-3 text-sm text-foreground",
33167
+ placeholder: "atto_…",
33163
33168
  autoComplete: "off",
33164
- spellCheck: false
33169
+ spellCheck: false,
33170
+ autoFocus: true
33165
33171
  }
33166
33172
  )
33167
33173
  ] }),
33168
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", type: "submit", disabled: busy || !code.trim(), children: busy ? "Connecting…" : "Connect" }) })
33174
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", disabled: busy || !code.trim(), children: busy ? "Connecting…" : "Connect" }) })
33169
33175
  ]
33170
33176
  }
33171
33177
  ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid gap-3", children: [
@@ -33193,8 +33199,8 @@ function TesboPanel() {
33193
33199
  formError && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-3 text-sm text-destructive", children: formError })
33194
33200
  ] });
33195
33201
  }
33196
- function tesboProjectId$1(remote) {
33197
- return `tesbo-${remote.projectId}`;
33202
+ function tesboProjectId$1(remoteProjectId) {
33203
+ return `tesbo-${remoteProjectId}`;
33198
33204
  }
33199
33205
  function ProjectList() {
33200
33206
  const projectsById = useAppStore((s2) => s2.projectsById);
@@ -33214,8 +33220,8 @@ function ProjectList() {
33214
33220
  };
33215
33221
  reactExports.useEffect(() => {
33216
33222
  let cancelled = false;
33217
- const applyRemote = (remote) => {
33218
- const id = tesboProjectId$1(remote);
33223
+ const syncRemote = (remote) => {
33224
+ const id = tesboProjectId$1(remote.projectId);
33219
33225
  ensureProject(id, {
33220
33226
  name: remote.projectName || remote.userName || "Tesbo project",
33221
33227
  targetUrl: remote.targetUrl || void 0,
@@ -33233,7 +33239,6 @@ function ProjectList() {
33233
33239
  source: "manual"
33234
33240
  }))
33235
33241
  );
33236
- setActiveProject(id);
33237
33242
  };
33238
33243
  const refresh = async () => {
33239
33244
  try {
@@ -33241,9 +33246,14 @@ function ProjectList() {
33241
33246
  if (cancelled) return;
33242
33247
  setTesboConnected(Boolean(status.connected));
33243
33248
  if (!status.connected) return;
33249
+ for (const project of status.projects) {
33250
+ ensureProject(tesboProjectId$1(project.id), {
33251
+ name: project.name || project.userName || "Tesbo project"
33252
+ });
33253
+ }
33244
33254
  const remote = await window.taa.tesbo.remoteConfig();
33245
33255
  if (cancelled || !remote?.projectId) return;
33246
- applyRemote(remote);
33256
+ syncRemote(remote);
33247
33257
  } catch {
33248
33258
  }
33249
33259
  };
@@ -33253,29 +33263,28 @@ function ProjectList() {
33253
33263
  cancelled = true;
33254
33264
  window.clearInterval(timer);
33255
33265
  };
33256
- }, [ensureProject, setFolderPath, setBrowserMode, setMemories, setActiveProject]);
33266
+ }, [ensureProject, setFolderPath, setBrowserMode, setMemories]);
33257
33267
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-1 flex-col overflow-hidden bg-background", children: [
33258
33268
  /* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "flex items-center justify-between border-b border-border px-6 py-4", children: [
33259
33269
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33260
- /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-lg font-semibold", children: "Projects" }),
33261
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: tesboConnected ? "Connected to Tesbo. Folder, browser mode, and memories come from Agents → Atto on the website." : "Group your test cases by the app or flow they cover." })
33270
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-lg font-semibold", children: tesboConnected ? "Projects" : "Connect Atto" }),
33271
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: tesboConnected ? "Pick a Tesbo project below. Folder and browser mode come from Agents → Atto on the website." : "Paste your access code to link this PC. You do not need a local project first." })
33262
33272
  ] }),
33263
- !tesboConnected && /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", className: "gap-2", onClick: () => setDialogOpen(true), children: [
33273
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "outline", className: "gap-2", onClick: () => setDialogOpen(true), children: [
33264
33274
  /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "size-4" }),
33265
- "New project"
33275
+ "New local project"
33266
33276
  ] })
33267
33277
  ] }),
33268
33278
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto px-6 py-5", children: [
33269
33279
  /* @__PURE__ */ jsxRuntimeExports.jsx(TesboPanel, {}),
33270
- projects.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-center", children: [
33280
+ !tesboConnected && projects.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 rounded-lg border border-dashed border-border px-4 py-8 text-center", children: [
33281
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium", children: "Connect to see your projects" }),
33282
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "After you connect, Tesbo projects (including ones shared with you) show up here." })
33283
+ ] }) : tesboConnected && projects.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-center", children: [
33271
33284
  /* @__PURE__ */ jsxRuntimeExports.jsx(FolderKanban, { className: "size-8 text-muted-foreground" }),
33272
33285
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
33273
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium", children: tesboConnected ? "Waiting for website settings" : "No projects yet" }),
33274
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: tesboConnected ? "On app-atto.tesbo.io open Agents → Atto, set the project folder path, then keep Atto connected." : "Create a project to start generating test cases." })
33275
- ] }),
33276
- !tesboConnected && /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", className: "gap-2", onClick: () => setDialogOpen(true), children: [
33277
- /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "size-4" }),
33278
- "New project"
33286
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium", children: "Waiting for website settings" }),
33287
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "On the website open Agents → Atto, set the project folder path, then keep Atto connected." })
33279
33288
  ] })
33280
33289
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3", children: projects.map((project) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
33281
33290
  "div",
@@ -34891,14 +34900,16 @@ async function startRemoteSession(job) {
34891
34900
  project = useAppStore.getState().projectsById[id];
34892
34901
  }
34893
34902
  await registerProjectWithEngine(project);
34903
+ const targetUrl = (job.targetUrl || "").trim() || project.targetUrl;
34894
34904
  const sessionId = await window.taa.sessions.submitGoal({
34895
34905
  goal: job.goal,
34896
- targetUrl: job.targetUrl || project.targetUrl,
34906
+ targetUrl,
34907
+ remoteJobId: job.id,
34897
34908
  project: {
34898
34909
  projectId: project.id,
34899
34910
  name: project.name,
34900
34911
  folderPath: project.folderPath,
34901
- targetUrl: job.targetUrl || project.targetUrl,
34912
+ targetUrl,
34902
34913
  memories: (project.memories || []).map((memory) => memory.content),
34903
34914
  browserMode: job.browserMode || project.browserMode
34904
34915
  }
@@ -8,8 +8,8 @@
8
8
  />
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
10
  <title>Tesbo Automate</title>
11
- <script type="module" crossorigin src="./assets/index-DPu6kKU4.js"></script>
12
- <link rel="stylesheet" crossorigin href="./assets/index-CKtSvvUQ.css">
11
+ <script type="module" crossorigin src="./assets/index-DhNABw4-.js"></script>
12
+ <link rel="stylesheet" crossorigin href="./assets/index-Cq11Gc4F.css">
13
13
  </head>
14
14
  <body>
15
15
  <div id="root"></div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qablehq/atto",
3
- "version": "0.0.21",
4
- "description": "Atto \u2014 AI-assisted desktop test automation",
3
+ "version": "0.0.23",
4
+ "description": "Atto — AI-assisted desktop test automation",
5
5
  "homepage": "https://github.com/QAbleHQ/Atto",
6
6
  "author": {
7
7
  "name": "QAble",