@qablehq/atto 0.0.21 → 0.0.22

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/out/main/index.js CHANGED
@@ -366,13 +366,7 @@ function mirrorEngineEventToChat(event) {
366
366
  return;
367
367
  }
368
368
  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" ? {
369
+ const basePayload = event.type === "code_generated" ? {
376
370
  type: "code_generated",
377
371
  sessionId: event.sessionId,
378
372
  filePath: event.filePath,
@@ -385,7 +379,17 @@ function mirrorEngineEventToChat(event) {
385
379
  content: String(file.content || "").slice(0, 12e4)
386
380
  })) : void 0
387
381
  } : event;
388
- void postRemoteSessionEvent(jobId, payload).catch(() => void 0);
382
+ void postRemoteSessionEvent(jobId, basePayload).catch(() => void 0);
383
+ if (event.type === "narration_step" && Array.isArray(event.attachments)) {
384
+ const shot = event.attachments.find((item) => item.kind === "screenshot" && item.url);
385
+ if (shot?.url?.startsWith("taa-media://")) {
386
+ const frameId = String(event.stepId || "").replace(/[^a-zA-Z0-9_-]/g, "").slice(0, 80);
387
+ const caption = String(event.narration || "").slice(0, 300);
388
+ void uploadLiveFrame(jobId, event.sessionId, shot.url, frameId || void 0, caption || void 0).catch(
389
+ () => void 0
390
+ );
391
+ }
392
+ }
389
393
  if (event.type === "session_status_changed") {
390
394
  const status = event.status;
391
395
  if (status === "failed" || status === "stopped" || status === "awaiting_review" || status === "approved") {
@@ -510,21 +514,39 @@ async function fetchAttoRemoteConfig() {
510
514
  }
511
515
  };
512
516
  }
513
- async function uploadLiveFrame(jobId, desktopSessionId, mediaUrl) {
514
- const link = readLink();
515
- if (!link) return;
517
+ async function readLiveFramePayload(desktopSessionId, mediaUrl) {
516
518
  try {
517
519
  const parsed = new URL(mediaUrl);
518
520
  const filename = decodeURIComponent(parsed.pathname.replace(/^\/+/, ""));
519
521
  const absolute = resolveSessionMediaFile(desktopSessionId, filename);
520
- if (!absolute) return;
522
+ if (!absolute) return null;
521
523
  const buf = node_fs.readFileSync(absolute);
522
- if (buf.length > 24e5) return;
524
+ if (buf.length < 32 || buf.length > 24e5) return null;
523
525
  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
- });
526
+ return { buf, mime };
527
+ } catch {
528
+ return null;
529
+ }
530
+ }
531
+ async function uploadLiveFrameBuffer(jobId, buf, mime, frameId, caption) {
532
+ const link = readLink();
533
+ if (!link) return;
534
+ await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/live-frame`, {
535
+ method: "POST",
536
+ body: JSON.stringify({
537
+ imageBase64: buf.toString("base64"),
538
+ mimeType: mime,
539
+ frameId: frameId || void 0,
540
+ caption: caption || void 0,
541
+ createChatShot: Boolean(frameId)
542
+ })
543
+ });
544
+ }
545
+ async function uploadLiveFrame(jobId, desktopSessionId, mediaUrl, frameId, caption) {
546
+ try {
547
+ const frame = await readLiveFramePayload(desktopSessionId, mediaUrl);
548
+ if (!frame) return;
549
+ await uploadLiveFrameBuffer(jobId, frame.buf, frame.mime, frameId, caption);
528
550
  } catch {
529
551
  }
530
552
  }
@@ -11425,6 +11447,9 @@ class RealEngine {
11425
11447
  });
11426
11448
  registerSessionMediaRoot(sessionId, sessionMediaDir(project.folderPath, sessionId));
11427
11449
  await writeSessionMeta(meta);
11450
+ if (cmd.remoteJobId) {
11451
+ bindRemoteSessionJob(cmd.remoteJobId, sessionId);
11452
+ }
11428
11453
  void this.runTracked(sessionId, (signal) => this.startSession(sessionId, signal));
11429
11454
  return sessionId;
11430
11455
  }
@@ -34891,14 +34891,16 @@ async function startRemoteSession(job) {
34891
34891
  project = useAppStore.getState().projectsById[id];
34892
34892
  }
34893
34893
  await registerProjectWithEngine(project);
34894
+ const targetUrl = (job.targetUrl || "").trim() || project.targetUrl;
34894
34895
  const sessionId = await window.taa.sessions.submitGoal({
34895
34896
  goal: job.goal,
34896
- targetUrl: job.targetUrl || project.targetUrl,
34897
+ targetUrl,
34898
+ remoteJobId: job.id,
34897
34899
  project: {
34898
34900
  projectId: project.id,
34899
34901
  name: project.name,
34900
34902
  folderPath: project.folderPath,
34901
- targetUrl: job.targetUrl || project.targetUrl,
34903
+ targetUrl,
34902
34904
  memories: (project.memories || []).map((memory) => memory.content),
34903
34905
  browserMode: job.browserMode || project.browserMode
34904
34906
  }
@@ -8,7 +8,7 @@
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>
11
+ <script type="module" crossorigin src="./assets/index-B-MIIItw.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="./assets/index-CKtSvvUQ.css">
13
13
  </head>
14
14
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qablehq/atto",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Atto \u2014 AI-assisted desktop test automation",
5
5
  "homepage": "https://github.com/QAbleHQ/Atto",
6
6
  "author": {