@qablehq/atto 0.0.34 → 0.0.36

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
@@ -419,13 +419,13 @@ function attachEngineForRemoteAnswers(adapter) {
419
419
  if (answerPollTimer) return;
420
420
  answerPollTimer = setInterval(() => {
421
421
  void pullRemoteSessionAnswers().catch(() => void 0);
422
- }, 2500);
422
+ }, 800);
423
423
  answerPollTimer.unref?.();
424
424
  }
425
425
  function mirrorEngineEventToChat(event) {
426
426
  const jobId = remoteJobByDesktopSession.get(event.sessionId);
427
427
  if (!jobId) return;
428
- if (event.type !== "narration_step" && event.type !== "assertion_result" && event.type !== "stuck_question" && event.type !== "session_status_changed" && event.type !== "agent_log" && event.type !== "code_generated" && event.type !== "quality_gate_report" && event.type !== "failure_diagnosis") {
428
+ if (event.type !== "narration_step" && event.type !== "assertion_result" && event.type !== "stuck_question" && event.type !== "session_status_changed" && event.type !== "agent_log" && event.type !== "code_generated" && event.type !== "quality_gate_report" && event.type !== "failure_diagnosis" && event.type !== "stability_report") {
429
429
  return;
430
430
  }
431
431
  if (event.type === "narration_step" && event.status === "in_progress") return;
@@ -469,6 +469,16 @@ async function postRemoteSessionEvent(jobId, event) {
469
469
  body: JSON.stringify(event)
470
470
  });
471
471
  }
472
+ function enrichWebsiteAnswerText(raw) {
473
+ const text2 = typeof raw === "string" ? raw.trim() : "";
474
+ if (!text2) return raw;
475
+ if (/^\d{4,8}$/.test(text2)) {
476
+ return `${text2}
477
+
478
+ Use this on the CURRENT page only. Do NOT re-type the email, do NOT restart the login, and do NOT navigate away from the OTP/code field.`;
479
+ }
480
+ return text2;
481
+ }
472
482
  async function pullRemoteSessionAnswers() {
473
483
  const link = readLink();
474
484
  const adapter = engineAdapterForAnswers;
@@ -478,16 +488,26 @@ async function pullRemoteSessionAnswers() {
478
488
  const response = await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/answers/pending`);
479
489
  if (!response.ok) continue;
480
490
  const body = await response.json();
491
+ const desktopSessionId = [...remoteJobByDesktopSession.entries()].find(([, id]) => id === jobId)?.[0];
492
+ if (body.stop === true && desktopSessionId) {
493
+ try {
494
+ await adapter.stopSession({ sessionId: desktopSessionId });
495
+ } catch {
496
+ }
497
+ await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/stop/ack`, {
498
+ method: "POST",
499
+ body: "{}"
500
+ }).catch(() => void 0);
501
+ }
481
502
  const answers = Array.isArray(body.answers) ? body.answers : [];
482
503
  for (const answer of answers) {
483
504
  if (!answer?.questionId) continue;
484
- const desktopSessionId = [...remoteJobByDesktopSession.entries()].find(([, id]) => id === jobId)?.[0];
485
505
  if (!desktopSessionId) continue;
486
506
  await adapter.answerStuckQuestion({
487
507
  sessionId: desktopSessionId,
488
508
  questionId: answer.questionId,
489
509
  optionId: answer.optionId,
490
- text: answer.text
510
+ text: enrichWebsiteAnswerText(answer.text)
491
511
  });
492
512
  await tesboFetch(
493
513
  link,
@@ -4964,13 +4984,17 @@ ${args.goal}`,
4964
4984
  if (outcome.question) {
4965
4985
  const answer = await this.askUser(outcome.question);
4966
4986
  const chosen = answer.optionId ? outcome.question.options.find((option) => option.id === answer.optionId)?.label ?? answer.optionId : void 0;
4987
+ const answerText = String(answer.text ?? chosen ?? "(no answer given)").trim();
4988
+ const questionText = String(outcome.question.question || "");
4989
+ const looksLikeOtp = /^\d{4,8}$/.test(answerText) || /\botp\b|one[-\s]?time|verification code|passcode|email code/i.test(`${questionText} ${answerText}`);
4990
+ const otpGuard = looksLikeOtp ? " Use this on the CURRENT page only. Do NOT re-type the email, do NOT restart login, and do NOT navigate away from the OTP field." : "";
4967
4991
  results.push({
4968
4992
  type: "tool_result",
4969
4993
  toolUseId: call.id,
4970
4994
  content: [
4971
4995
  {
4972
4996
  type: "text",
4973
- text: `The user answered: ${answer.text ?? chosen ?? "(no answer given)"}`
4997
+ text: `The user answered: ${answerText}.${otpGuard}`
4974
4998
  }
4975
4999
  ]
4976
5000
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qablehq/atto",
3
- "version": "0.0.34",
4
- "description": "Atto — AI-assisted desktop test automation",
3
+ "version": "0.0.36",
4
+ "description": "Atto \u2014 AI-assisted desktop test automation",
5
5
  "homepage": "https://github.com/QAbleHQ/Atto",
6
6
  "author": {
7
7
  "name": "QAble",