@qablehq/atto 0.0.41 → 0.0.43

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
@@ -422,6 +422,15 @@ function attachEngineForRemoteAnswers(adapter) {
422
422
  }, 800);
423
423
  answerPollTimer.unref?.();
424
424
  }
425
+ const remoteEventChains = /* @__PURE__ */ new Map();
426
+ function enqueueRemoteSessionEvent(jobId, run) {
427
+ const previous = remoteEventChains.get(jobId) || Promise.resolve();
428
+ const next = previous.then(run).catch(() => void 0);
429
+ remoteEventChains.set(jobId, next);
430
+ void next.finally(() => {
431
+ if (remoteEventChains.get(jobId) === next) remoteEventChains.delete(jobId);
432
+ });
433
+ }
425
434
  function mirrorEngineEventToChat(event) {
426
435
  const jobId = remoteJobByDesktopSession.get(event.sessionId);
427
436
  if (!jobId) return;
@@ -442,7 +451,9 @@ function mirrorEngineEventToChat(event) {
442
451
  content: String(file.content || "").slice(0, 12e4)
443
452
  })) : void 0
444
453
  } : event;
445
- void postRemoteSessionEvent(jobId, basePayload).catch(() => void 0);
454
+ enqueueRemoteSessionEvent(jobId, async () => {
455
+ await postRemoteSessionEvent(jobId, basePayload);
456
+ });
446
457
  if (event.type === "narration_step" && Array.isArray(event.attachments)) {
447
458
  const shot = event.attachments.find((item) => item.kind === "screenshot" && item.url);
448
459
  if (shot?.url?.startsWith("taa-media://")) {
@@ -456,18 +467,45 @@ function mirrorEngineEventToChat(event) {
456
467
  if (event.type === "session_status_changed") {
457
468
  const status = event.status;
458
469
  if (status === "failed" || status === "stopped" || status === "awaiting_review" || status === "approved") {
459
- void ackAttoRemoteSession(jobId, status === "failed" ? "failed" : "done").catch(() => void 0);
460
- activeRemoteJobIds.delete(jobId);
470
+ enqueueRemoteSessionEvent(jobId, async () => {
471
+ await ackAttoRemoteSession(jobId, status === "failed" ? "failed" : "done");
472
+ activeRemoteJobIds.delete(jobId);
473
+ });
461
474
  }
462
475
  }
463
476
  }
464
477
  async function postRemoteSessionEvent(jobId, event) {
465
478
  const link = readLink();
466
479
  if (!link) return;
467
- await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/events`, {
480
+ const response = await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/events`, {
468
481
  method: "POST",
469
482
  body: JSON.stringify(event)
470
483
  });
484
+ if (response.ok) return;
485
+ if (event.type === "code_generated") {
486
+ const files = Array.isArray(event.files) ? event.files : [];
487
+ const slim = {
488
+ ...event,
489
+ content: String(event.content || "").slice(0, 4e4),
490
+ files: files.slice(0, 40).map((file) => {
491
+ const row = file && typeof file === "object" ? file : {};
492
+ return {
493
+ path: String(row.path || ""),
494
+ kind: row.kind,
495
+ change: row.change,
496
+ content: String(row.content || "").slice(0, 4e4)
497
+ };
498
+ })
499
+ };
500
+ const retry = await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/events`, {
501
+ method: "POST",
502
+ body: JSON.stringify(slim)
503
+ });
504
+ if (retry.ok) return;
505
+ console.error("[tesbo] code_generated sync failed", retry.status, await retry.text().catch(() => ""));
506
+ return;
507
+ }
508
+ console.error("[tesbo] session event sync failed", event.type, response.status);
471
509
  }
472
510
  function enrichWebsiteAnswerText(raw) {
473
511
  const text2 = typeof raw === "string" ? raw.trim() : "";
@@ -522,6 +560,7 @@ async function pullRemoteSessionAnswers() {
522
560
  async function pullAndDispatchPendingSessions() {
523
561
  const link = readLink();
524
562
  if (!link) return { started: 0, errors: [] };
563
+ await fetchAttoRemoteConfig().catch(() => null);
525
564
  const response = await tesboFetch(link, "/api/atto/sessions/pending");
526
565
  if (response.status === 401) {
527
566
  clearLink();
@@ -806,6 +845,7 @@ async function pullAndHandleDesktopCommands() {
806
845
  }
807
846
  }
808
847
  let commandPollTimer = null;
848
+ let remoteConfigPollTimer = null;
809
849
  function startAttoScriptPoller(intervalMs = 5e3) {
810
850
  if (scriptPollTimer) return;
811
851
  const tick = () => {
@@ -815,6 +855,14 @@ function startAttoScriptPoller(intervalMs = 5e3) {
815
855
  tick();
816
856
  scriptPollTimer = setInterval(tick, intervalMs);
817
857
  scriptPollTimer.unref?.();
858
+ if (!remoteConfigPollTimer) {
859
+ const configTick = () => {
860
+ void fetchAttoRemoteConfig().catch(() => void 0);
861
+ };
862
+ configTick();
863
+ remoteConfigPollTimer = setInterval(configTick, 3e3);
864
+ remoteConfigPollTimer.unref?.();
865
+ }
818
866
  if (!commandPollTimer) {
819
867
  const commandTick = () => {
820
868
  void pullAndHandleDesktopCommands().catch(() => void 0);
@@ -33481,7 +33481,7 @@ function ProjectList() {
33481
33481
  }
33482
33482
  };
33483
33483
  void refresh();
33484
- const timer = window.setInterval(() => void refresh(), 8e3);
33484
+ const timer = window.setInterval(() => void refresh(), 3e3);
33485
33485
  return () => {
33486
33486
  cancelled = true;
33487
33487
  window.clearInterval(timer);
@@ -35166,6 +35166,7 @@ async function startRemoteSession(job) {
35166
35166
  }
35167
35167
  setActiveProject(id, { force: true });
35168
35168
  setView("session");
35169
+ const remote = await window.taa.tesbo.remoteConfig().catch(() => null);
35169
35170
  const bindings = await window.taa.ai.listBindings().catch(() => ({}));
35170
35171
  if (bindings[id]) setProjectAiBinding2(id, bindings[id]);
35171
35172
  let project = useAppStore.getState().projectsById[id];
@@ -35173,15 +35174,9 @@ async function startRemoteSession(job) {
35173
35174
  throw new Error("No folder path on this PC for the Atto user. Set save location under Agents → Atto.");
35174
35175
  }
35175
35176
  if (!project.aiBinding) {
35176
- const remote = await window.taa.tesbo.remoteConfig().catch(() => null);
35177
- const refreshed = await window.taa.ai.listBindings().catch(() => ({}));
35178
- if (refreshed[id]) setProjectAiBinding2(id, refreshed[id]);
35179
- project = useAppStore.getState().projectsById[id];
35180
- if (!project?.aiBinding) {
35181
- throw new Error(
35182
- remote?.aiSynced ? "Website AI key synced but project binding is missing. Reconnect Atto, then retry." : "Allocate an AI key to this project on Tesbo (Workspace → AI Providers), or connect a key in Atto project settings on this PC."
35183
- );
35184
- }
35177
+ throw new Error(
35178
+ remote?.aiSynced ? "Website AI key synced but project binding is missing. Reconnect Atto, then retry." : "Allocate an AI key to this project on Tesbo (Workspace → AI Providers), or connect a key in Atto project settings on this PC."
35179
+ );
35185
35180
  }
35186
35181
  if (project.analysis?.status !== "ready") {
35187
35182
  setProjectAnalysis2(id, { status: "analyzing" });
@@ -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-DevA0EpF.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-CugGXqpv.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="./assets/index-DyJdhPcb.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.41",
3
+ "version": "0.0.43",
4
4
  "description": "Atto — AI-assisted desktop test automation",
5
5
  "homepage": "https://github.com/QAbleHQ/Atto",
6
6
  "author": {