@qablehq/atto 0.0.33 → 0.0.35
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,7 +419,7 @@ function attachEngineForRemoteAnswers(adapter) {
|
|
|
419
419
|
if (answerPollTimer) return;
|
|
420
420
|
answerPollTimer = setInterval(() => {
|
|
421
421
|
void pullRemoteSessionAnswers().catch(() => void 0);
|
|
422
|
-
},
|
|
422
|
+
}, 800);
|
|
423
423
|
answerPollTimer.unref?.();
|
|
424
424
|
}
|
|
425
425
|
function mirrorEngineEventToChat(event) {
|
|
@@ -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,
|
|
@@ -559,10 +579,35 @@ async function fetchAttoRemoteConfig() {
|
|
|
559
579
|
}
|
|
560
580
|
if (!response.ok) throw new Error(await errorMessage(response));
|
|
561
581
|
const body = await response.json();
|
|
582
|
+
const projectId = String(body.projectId || "");
|
|
583
|
+
let aiSynced = false;
|
|
584
|
+
let aiProvider = "";
|
|
585
|
+
let aiModel = "";
|
|
586
|
+
let aiName = "";
|
|
587
|
+
const remoteAi = body.ai;
|
|
588
|
+
if (projectId && remoteAi && String(remoteAi.apiKey || "").trim()) {
|
|
589
|
+
try {
|
|
590
|
+
const { applyTesboWebsiteAi: applyTesboWebsiteAi2 } = await Promise.resolve().then(() => ConnectionManager);
|
|
591
|
+
const applied = await applyTesboWebsiteAi2({
|
|
592
|
+
projectId: `tesbo-${projectId}`,
|
|
593
|
+
provider: String(remoteAi.provider || "openai"),
|
|
594
|
+
apiKey: String(remoteAi.apiKey || ""),
|
|
595
|
+
model: remoteAi.model,
|
|
596
|
+
baseUrl: remoteAi.baseUrl,
|
|
597
|
+
keyName: remoteAi.name
|
|
598
|
+
});
|
|
599
|
+
aiSynced = applied.synced;
|
|
600
|
+
aiProvider = applied.providerId;
|
|
601
|
+
aiModel = applied.model;
|
|
602
|
+
aiName = String(remoteAi.name || "");
|
|
603
|
+
} catch (error) {
|
|
604
|
+
console.error("[tesbo] could not apply website AI key", error);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
562
607
|
return {
|
|
563
608
|
userName: String(body.userName || ""),
|
|
564
609
|
clientName: String(body.clientName || ""),
|
|
565
|
-
projectId
|
|
610
|
+
projectId,
|
|
566
611
|
projectName: String(body.projectName || ""),
|
|
567
612
|
scriptSavePath: String(body.scriptSavePath || "").trim(),
|
|
568
613
|
browserMode: body.browserMode === "headless" ? "headless" : "headed",
|
|
@@ -574,7 +619,11 @@ async function fetchAttoRemoteConfig() {
|
|
|
574
619
|
package: String(body.install?.package || "npm install -g @qablehq/atto"),
|
|
575
620
|
chromium: String(body.install?.chromium || "npx playwright install chromium"),
|
|
576
621
|
note: String(body.install?.note || "")
|
|
577
|
-
}
|
|
622
|
+
},
|
|
623
|
+
aiSynced,
|
|
624
|
+
aiProvider: aiProvider || void 0,
|
|
625
|
+
aiModel: aiModel || void 0,
|
|
626
|
+
aiName: aiName || void 0
|
|
578
627
|
};
|
|
579
628
|
}
|
|
580
629
|
async function readLiveFramePayload(desktopSessionId, mediaUrl) {
|
|
@@ -1944,6 +1993,54 @@ function labelFor(providerId, accountHint) {
|
|
|
1944
1993
|
const base = getProviderOption(providerId).label;
|
|
1945
1994
|
return accountHint ? `${base} — ${accountHint}` : base;
|
|
1946
1995
|
}
|
|
1996
|
+
async function applyTesboWebsiteAi(input) {
|
|
1997
|
+
const projectId = String(input.projectId || "").trim();
|
|
1998
|
+
const apiKey = String(input.apiKey || "").trim();
|
|
1999
|
+
if (!projectId || !apiKey) return { synced: false, providerId: "openai", model: "" };
|
|
2000
|
+
const providerId = mapWebsiteProvider(input.provider);
|
|
2001
|
+
const provider = getProviderOption(providerId);
|
|
2002
|
+
const model = String(input.model || "").trim() || provider.defaultModel;
|
|
2003
|
+
const connectionId = `tesbo-web-${projectId}`;
|
|
2004
|
+
const accountHint = `···${apiKey.slice(-4)}`;
|
|
2005
|
+
const existing = await getStoredConnection(connectionId);
|
|
2006
|
+
let sameKey = false;
|
|
2007
|
+
if (existing?.secret) {
|
|
2008
|
+
try {
|
|
2009
|
+
sameKey = await readApiKey(existing) === apiKey;
|
|
2010
|
+
} catch {
|
|
2011
|
+
sameKey = false;
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
if (!existing || !sameKey || existing.providerId !== providerId || existing.model !== model) {
|
|
2015
|
+
await saveConnection({
|
|
2016
|
+
id: connectionId,
|
|
2017
|
+
providerId,
|
|
2018
|
+
authKind: "api_key",
|
|
2019
|
+
label: input.keyName?.trim() ? `Tesbo — ${input.keyName.trim()}` : labelFor(providerId, accountHint),
|
|
2020
|
+
accountHint,
|
|
2021
|
+
model,
|
|
2022
|
+
baseUrl: input.baseUrl?.trim() || provider.defaultBaseUrl,
|
|
2023
|
+
plainSecret: apiKey,
|
|
2024
|
+
health: existing?.health ?? { state: "unchecked" },
|
|
2025
|
+
createdAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
await setBinding(projectId, { default: { connectionId, model } });
|
|
2029
|
+
return { synced: true, providerId, model };
|
|
2030
|
+
}
|
|
2031
|
+
function mapWebsiteProvider(raw) {
|
|
2032
|
+
const p = String(raw || "").toLowerCase().trim();
|
|
2033
|
+
if (p.includes("anthropic") || p.includes("claude")) return "anthropic";
|
|
2034
|
+
if (p.includes("openai") || p === "chatgpt") return "openai";
|
|
2035
|
+
if (p.includes("grok") || p.includes("xai")) return "grok";
|
|
2036
|
+
if (p.includes("gemini") || p.includes("google")) return "gemini";
|
|
2037
|
+
if (p.includes("mistral")) return "mistral";
|
|
2038
|
+
if (p.includes("groq")) return "groq";
|
|
2039
|
+
if (p.includes("openrouter")) return "openrouter";
|
|
2040
|
+
if (p.includes("ollama")) return "ollama";
|
|
2041
|
+
if (p.includes("lmstudio") || p.includes("lm studio")) return "lmstudio";
|
|
2042
|
+
return "openai";
|
|
2043
|
+
}
|
|
1947
2044
|
async function createApiKeyConnection(input) {
|
|
1948
2045
|
const provider = getProviderOption(input.providerId);
|
|
1949
2046
|
const apiKey = input.apiKey.trim();
|
|
@@ -2063,6 +2160,36 @@ async function getClient(projectId, role, opts = {}) {
|
|
|
2063
2160
|
return withRetry(await meter(target, fallbackModel));
|
|
2064
2161
|
});
|
|
2065
2162
|
}
|
|
2163
|
+
async function getClientForConnection(connectionId, model) {
|
|
2164
|
+
const connection = await getStoredConnection(connectionId);
|
|
2165
|
+
if (!connection) throw new LlmError("That AI connection no longer exists.");
|
|
2166
|
+
return buildClient(
|
|
2167
|
+
connection,
|
|
2168
|
+
model || connection.model || getProviderOption(connection.providerId).defaultModel
|
|
2169
|
+
);
|
|
2170
|
+
}
|
|
2171
|
+
async function projectHasUsableConnection(projectId) {
|
|
2172
|
+
try {
|
|
2173
|
+
await resolveForRole(projectId, "agent");
|
|
2174
|
+
return true;
|
|
2175
|
+
} catch {
|
|
2176
|
+
return false;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
const ConnectionManager = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2180
|
+
__proto__: null,
|
|
2181
|
+
applyTesboWebsiteAi,
|
|
2182
|
+
createApiKeyConnection,
|
|
2183
|
+
deleteConnection,
|
|
2184
|
+
getClient,
|
|
2185
|
+
getClientForConnection,
|
|
2186
|
+
getProjectSetup,
|
|
2187
|
+
listConnections,
|
|
2188
|
+
projectHasUsableConnection,
|
|
2189
|
+
saveOAuthConnection,
|
|
2190
|
+
setProjectBinding,
|
|
2191
|
+
verifyConnection
|
|
2192
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2066
2193
|
function tesboDir(projectFolder) {
|
|
2067
2194
|
return node_path.join(projectFolder, ".tesbo");
|
|
2068
2195
|
}
|
|
@@ -4857,13 +4984,17 @@ ${args.goal}`,
|
|
|
4857
4984
|
if (outcome.question) {
|
|
4858
4985
|
const answer = await this.askUser(outcome.question);
|
|
4859
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." : "";
|
|
4860
4991
|
results.push({
|
|
4861
4992
|
type: "tool_result",
|
|
4862
4993
|
toolUseId: call.id,
|
|
4863
4994
|
content: [
|
|
4864
4995
|
{
|
|
4865
4996
|
type: "text",
|
|
4866
|
-
text: `The user answered: ${
|
|
4997
|
+
text: `The user answered: ${answerText}.${otpGuard}`
|
|
4867
4998
|
}
|
|
4868
4999
|
]
|
|
4869
5000
|
});
|
|
@@ -33221,6 +33221,7 @@ function ProjectList() {
|
|
|
33221
33221
|
const setFolderPath = useAppStore((s2) => s2.setProjectFolderPath);
|
|
33222
33222
|
const setBrowserMode = useAppStore((s2) => s2.setProjectBrowserMode);
|
|
33223
33223
|
const setMemories = useAppStore((s2) => s2.setProjectMemories);
|
|
33224
|
+
const setProjectAiBinding2 = useAppStore((s2) => s2.setProjectAiBinding);
|
|
33224
33225
|
const [dialogOpen, setDialogOpen] = reactExports.useState(false);
|
|
33225
33226
|
const [tesboConnected, setTesboConnected] = reactExports.useState(false);
|
|
33226
33227
|
const [connectedRemoteIds, setConnectedRemoteIds] = reactExports.useState([]);
|
|
@@ -33295,7 +33296,7 @@ function ProjectList() {
|
|
|
33295
33296
|
};
|
|
33296
33297
|
reactExports.useEffect(() => {
|
|
33297
33298
|
let cancelled = false;
|
|
33298
|
-
const syncRemote = (remote) => {
|
|
33299
|
+
const syncRemote = async (remote) => {
|
|
33299
33300
|
const id = tesboProjectId$1(remote.projectId);
|
|
33300
33301
|
ensureProject(id, {
|
|
33301
33302
|
name: remote.projectName || remote.userName || "Tesbo project",
|
|
@@ -33314,6 +33315,10 @@ function ProjectList() {
|
|
|
33314
33315
|
source: "manual"
|
|
33315
33316
|
}))
|
|
33316
33317
|
);
|
|
33318
|
+
if (remote.aiSynced) {
|
|
33319
|
+
const bindings = await window.taa.ai.listBindings().catch(() => ({}));
|
|
33320
|
+
if (bindings[id]) setProjectAiBinding2(id, bindings[id]);
|
|
33321
|
+
}
|
|
33317
33322
|
};
|
|
33318
33323
|
const refresh = async () => {
|
|
33319
33324
|
try {
|
|
@@ -33336,7 +33341,7 @@ function ProjectList() {
|
|
|
33336
33341
|
}
|
|
33337
33342
|
const remote = await window.taa.tesbo.remoteConfig();
|
|
33338
33343
|
if (cancelled || !remote?.projectId) return;
|
|
33339
|
-
syncRemote(remote);
|
|
33344
|
+
await syncRemote(remote);
|
|
33340
33345
|
} catch {
|
|
33341
33346
|
}
|
|
33342
33347
|
};
|
|
@@ -33346,7 +33351,7 @@ function ProjectList() {
|
|
|
33346
33351
|
cancelled = true;
|
|
33347
33352
|
window.clearInterval(timer);
|
|
33348
33353
|
};
|
|
33349
|
-
}, [ensureProject, deleteProject2, setFolderPath, setBrowserMode, setMemories]);
|
|
33354
|
+
}, [ensureProject, deleteProject2, setFolderPath, setBrowserMode, setMemories, setProjectAiBinding2]);
|
|
33350
33355
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-1 flex-col overflow-hidden bg-background", children: [
|
|
33351
33356
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "flex items-center justify-between border-b border-border px-6 py-4", children: [
|
|
33352
33357
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
@@ -35017,7 +35022,15 @@ async function startRemoteSession(job) {
|
|
|
35017
35022
|
throw new Error("No folder path on this PC for the Atto user. Set save location under Agents → Atto.");
|
|
35018
35023
|
}
|
|
35019
35024
|
if (!project.aiBinding) {
|
|
35020
|
-
|
|
35025
|
+
const remote = await window.taa.tesbo.remoteConfig().catch(() => null);
|
|
35026
|
+
const refreshed = await window.taa.ai.listBindings().catch(() => ({}));
|
|
35027
|
+
if (refreshed[id]) setProjectAiBinding2(id, refreshed[id]);
|
|
35028
|
+
project = useAppStore.getState().projectsById[id];
|
|
35029
|
+
if (!project?.aiBinding) {
|
|
35030
|
+
throw new Error(
|
|
35031
|
+
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."
|
|
35032
|
+
);
|
|
35033
|
+
}
|
|
35021
35034
|
}
|
|
35022
35035
|
if (project.analysis?.status !== "ready") {
|
|
35023
35036
|
setProjectAnalysis2(id, { status: "analyzing" });
|
package/out/renderer/index.html
CHANGED
|
@@ -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-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-DahmD4CZ.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-DyJdhPcb.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qablehq/atto",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Atto
|
|
3
|
+
"version": "0.0.35",
|
|
4
|
+
"description": "Atto \u2014 AI-assisted desktop test automation",
|
|
5
5
|
"homepage": "https://github.com/QAbleHQ/Atto",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "QAble",
|