@qablehq/atto 0.0.16 → 0.0.18
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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const electron = require("electron");
|
|
3
3
|
const node_path = require("node:path");
|
|
4
|
-
const node_fs = require("node:fs");
|
|
5
4
|
const Anthropic = require("@anthropic-ai/sdk");
|
|
5
|
+
const node_fs = require("node:fs");
|
|
6
6
|
const node_crypto = require("node:crypto");
|
|
7
7
|
const node_http = require("node:http");
|
|
8
8
|
const node_url = require("node:url");
|
|
@@ -54,424 +54,11 @@ const IPC_CHANNELS = {
|
|
|
54
54
|
tesboLogin: "taa:tesbo:login",
|
|
55
55
|
tesboLogout: "taa:tesbo:logout",
|
|
56
56
|
tesboAgents: "taa:tesbo:agents",
|
|
57
|
-
tesboRemoteConfig: "taa:tesbo:remoteConfig",
|
|
58
|
-
/** Main → renderer: start a Chat-queued desktop session (New session equivalent). */
|
|
59
|
-
tesboRemoteSession: "taa:tesbo:remoteSession",
|
|
60
|
-
tesboAckRemoteSession: "taa:tesbo:ackRemoteSession",
|
|
61
|
-
/** Renderer → main: bind a RealEngine session to a Chat job for live mirroring. */
|
|
62
|
-
tesboBindRemoteSession: "taa:tesbo:bindRemoteSession",
|
|
63
57
|
// Contextual command handling
|
|
64
58
|
submitCommand: "taa:sessions:submitCommand",
|
|
65
59
|
getCommandQueue: "taa:sessions:getCommandQueue",
|
|
66
60
|
clearCommandQueue: "taa:sessions:clearCommandQueue"
|
|
67
61
|
};
|
|
68
|
-
const DEFAULT_BASE_URL = "https://api-app-atto.tesbo.io";
|
|
69
|
-
const ACCESS_HEADER = "x-atto-access-code";
|
|
70
|
-
function sessionPath() {
|
|
71
|
-
return node_path.join(electron.app.getPath("userData"), "tesbo-link.json");
|
|
72
|
-
}
|
|
73
|
-
function readLink() {
|
|
74
|
-
try {
|
|
75
|
-
const parsed = JSON.parse(node_fs.readFileSync(sessionPath(), "utf8"));
|
|
76
|
-
if (typeof parsed.code !== "string" || !parsed.code.trim()) return null;
|
|
77
|
-
return { baseUrl: DEFAULT_BASE_URL, code: parsed.code.trim() };
|
|
78
|
-
} catch {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function writeLink(link) {
|
|
83
|
-
const path = sessionPath();
|
|
84
|
-
node_fs.mkdirSync(electron.app.getPath("userData"), { recursive: true });
|
|
85
|
-
node_fs.writeFileSync(path, JSON.stringify(link), { mode: 384 });
|
|
86
|
-
node_fs.chmodSync(path, 384);
|
|
87
|
-
}
|
|
88
|
-
function clearLink() {
|
|
89
|
-
node_fs.rmSync(sessionPath(), { force: true });
|
|
90
|
-
}
|
|
91
|
-
function disconnected(error = null) {
|
|
92
|
-
return { connected: false, baseUrl: DEFAULT_BASE_URL, user: null, workspaces: [], projects: [], error };
|
|
93
|
-
}
|
|
94
|
-
async function errorMessage(response) {
|
|
95
|
-
try {
|
|
96
|
-
const body = await response.json();
|
|
97
|
-
if (typeof body.error === "string" && body.error.trim()) return body.error;
|
|
98
|
-
if (typeof body.message === "string" && body.message.trim()) return body.message;
|
|
99
|
-
} catch {
|
|
100
|
-
}
|
|
101
|
-
return `Tesbo returned ${response.status}`;
|
|
102
|
-
}
|
|
103
|
-
function isTransientNetworkError(error) {
|
|
104
|
-
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
105
|
-
return /fetch failed|failed to fetch|network|ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|socket/i.test(
|
|
106
|
-
message
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
async function tesboFetch(link, path, init) {
|
|
110
|
-
const run = () => fetch(`${link.baseUrl}${path}`, {
|
|
111
|
-
...init,
|
|
112
|
-
headers: {
|
|
113
|
-
accept: "application/json",
|
|
114
|
-
[ACCESS_HEADER]: link.code,
|
|
115
|
-
...init?.body ? { "content-type": "application/json" } : {},
|
|
116
|
-
...init?.headers
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
try {
|
|
120
|
-
return await run();
|
|
121
|
-
} catch (error) {
|
|
122
|
-
if (!isTransientNetworkError(error) || init?.method && init.method !== "GET") throw error;
|
|
123
|
-
await new Promise((resolve2) => setTimeout(resolve2, 400));
|
|
124
|
-
return await run();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function asProjects(value) {
|
|
128
|
-
if (!Array.isArray(value)) return [];
|
|
129
|
-
const projects = [];
|
|
130
|
-
for (const item of value) {
|
|
131
|
-
if (!item || typeof item !== "object") continue;
|
|
132
|
-
const row = item;
|
|
133
|
-
if (typeof row.id !== "string" || typeof row.name !== "string") continue;
|
|
134
|
-
projects.push({
|
|
135
|
-
id: row.id,
|
|
136
|
-
key: typeof row.key === "string" ? row.key : "",
|
|
137
|
-
name: row.name,
|
|
138
|
-
role: typeof row.role === "string" ? row.role : "member",
|
|
139
|
-
clientName: typeof row.clientName === "string" ? row.clientName : void 0,
|
|
140
|
-
userName: typeof row.userName === "string" ? row.userName : void 0
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return projects;
|
|
144
|
-
}
|
|
145
|
-
async function loadAccount(link) {
|
|
146
|
-
const response = await tesboFetch(link, "/api/atto/projects");
|
|
147
|
-
if (response.status === 401) {
|
|
148
|
-
clearLink();
|
|
149
|
-
return disconnected(await errorMessage(response));
|
|
150
|
-
}
|
|
151
|
-
if (!response.ok) throw new Error(await errorMessage(response));
|
|
152
|
-
const projects = asProjects(await response.json());
|
|
153
|
-
return {
|
|
154
|
-
connected: true,
|
|
155
|
-
baseUrl: link.baseUrl,
|
|
156
|
-
user: signedInUser(projects),
|
|
157
|
-
workspaces: [],
|
|
158
|
-
projects,
|
|
159
|
-
error: null
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function signedInUser(projects) {
|
|
163
|
-
const project = projects.find((item) => item.userName || item.clientName);
|
|
164
|
-
if (!project) return null;
|
|
165
|
-
const name = [project.userName, project.clientName].filter(Boolean).join(" · ");
|
|
166
|
-
return { userId: project.userName || project.clientName || "", email: null, name: name || null };
|
|
167
|
-
}
|
|
168
|
-
async function tesboStatus() {
|
|
169
|
-
const link = readLink();
|
|
170
|
-
if (!link) return disconnected();
|
|
171
|
-
try {
|
|
172
|
-
return await loadAccount(link);
|
|
173
|
-
} catch (error) {
|
|
174
|
-
if (isTransientNetworkError(error)) return disconnected("Could not reach Tesbo.");
|
|
175
|
-
return disconnected(error instanceof Error ? error.message : "Could not reach Tesbo.");
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
async function tesboLogin(cmd) {
|
|
179
|
-
const code = cmd.code.trim();
|
|
180
|
-
if (!code) throw new Error("Paste the access code from Tesbo.");
|
|
181
|
-
const link = { baseUrl: DEFAULT_BASE_URL, code };
|
|
182
|
-
const connectOnce = () => fetch(`${link.baseUrl}/api/atto/connect`, {
|
|
183
|
-
method: "POST",
|
|
184
|
-
headers: { accept: "application/json", "content-type": "application/json" },
|
|
185
|
-
body: JSON.stringify({ code })
|
|
186
|
-
});
|
|
187
|
-
let response;
|
|
188
|
-
try {
|
|
189
|
-
response = await connectOnce();
|
|
190
|
-
} catch (error) {
|
|
191
|
-
if (!isTransientNetworkError(error)) throw error;
|
|
192
|
-
await new Promise((resolve2) => setTimeout(resolve2, 400));
|
|
193
|
-
response = await connectOnce();
|
|
194
|
-
}
|
|
195
|
-
if (!response.ok) throw new Error(await errorMessage(response));
|
|
196
|
-
writeLink(link);
|
|
197
|
-
const projects = asProjects(await response.json());
|
|
198
|
-
return {
|
|
199
|
-
connected: true,
|
|
200
|
-
baseUrl: link.baseUrl,
|
|
201
|
-
user: signedInUser(projects),
|
|
202
|
-
workspaces: [],
|
|
203
|
-
projects,
|
|
204
|
-
error: null
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
async function tesboLogout() {
|
|
208
|
-
clearLink();
|
|
209
|
-
return disconnected();
|
|
210
|
-
}
|
|
211
|
-
const SERVER_AGENTS = [
|
|
212
|
-
{
|
|
213
|
-
id: "zyra",
|
|
214
|
-
name: "Zyra the Test Generator",
|
|
215
|
-
role: "AI testcase generation agent",
|
|
216
|
-
summary: "Stays on Tesbo for the QAble team. This package does not open the website.",
|
|
217
|
-
status: "active",
|
|
218
|
-
detail: null
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
id: "nyra",
|
|
222
|
-
name: "NYRA",
|
|
223
|
-
role: "App exploration agent",
|
|
224
|
-
summary: "Stays on Tesbo for the QAble team. This package does not open the website.",
|
|
225
|
-
status: "active",
|
|
226
|
-
detail: null
|
|
227
|
-
}
|
|
228
|
-
];
|
|
229
|
-
const COMING_SOON = [
|
|
230
|
-
{
|
|
231
|
-
id: "run-analyst",
|
|
232
|
-
name: "Run Analyst",
|
|
233
|
-
role: "Execution insight agent",
|
|
234
|
-
summary: "Planned for run failure clustering, flaky-test signals, and release risk notes.",
|
|
235
|
-
status: "coming-soon",
|
|
236
|
-
detail: null
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
id: "bug-triage",
|
|
240
|
-
name: "Bug Triage",
|
|
241
|
-
role: "Defect analysis agent",
|
|
242
|
-
summary: "Planned for duplicate bug checks, severity suggestions, and owner recommendations.",
|
|
243
|
-
status: "coming-soon",
|
|
244
|
-
detail: null
|
|
245
|
-
}
|
|
246
|
-
];
|
|
247
|
-
async function tesboAgents(projectId) {
|
|
248
|
-
const link = readLink();
|
|
249
|
-
if (!link) throw new Error("Connect with an access code first.");
|
|
250
|
-
if (!projectId.trim()) throw new Error("Choose a project.");
|
|
251
|
-
const status = await loadAccount(link);
|
|
252
|
-
if (!status.connected) throw new Error(status.error || "This access code has been stopped.");
|
|
253
|
-
if (!status.projects.some((project) => project.id === projectId)) {
|
|
254
|
-
throw new Error("This project is not available for this access code.");
|
|
255
|
-
}
|
|
256
|
-
return { projectId, agents: [...SERVER_AGENTS, ...COMING_SOON], notice: null };
|
|
257
|
-
}
|
|
258
|
-
function safeTargetPath(savePath, fileName) {
|
|
259
|
-
const folder = node_path.resolve(node_path.normalize(savePath.trim()));
|
|
260
|
-
if (!node_path.isAbsolute(folder)) throw new Error("Save location from Tesbo must be an absolute path.");
|
|
261
|
-
const base = String(fileName || "script.spec.ts").replace(/[/\\]/g, "_").trim() || "script.spec.ts";
|
|
262
|
-
const target = node_path.resolve(folder, base);
|
|
263
|
-
const root = folder.endsWith(node_path.sep) ? folder : folder + node_path.sep;
|
|
264
|
-
if (target !== folder && !target.startsWith(root)) {
|
|
265
|
-
throw new Error("Refusing to write outside the configured save location.");
|
|
266
|
-
}
|
|
267
|
-
return target;
|
|
268
|
-
}
|
|
269
|
-
async function pullAndSavePendingScripts() {
|
|
270
|
-
const link = readLink();
|
|
271
|
-
if (!link) return { saved: 0, errors: [] };
|
|
272
|
-
const response = await tesboFetch(link, "/api/atto/scripts/pending");
|
|
273
|
-
if (response.status === 401) {
|
|
274
|
-
clearLink();
|
|
275
|
-
return { saved: 0, errors: ["Access code stopped."] };
|
|
276
|
-
}
|
|
277
|
-
if (!response.ok) throw new Error(await errorMessage(response));
|
|
278
|
-
const body = await response.json();
|
|
279
|
-
const scripts = Array.isArray(body.scripts) ? body.scripts : [];
|
|
280
|
-
let saved = 0;
|
|
281
|
-
const errors = [];
|
|
282
|
-
for (const item of scripts) {
|
|
283
|
-
if (!item?.id || !item.script || !item.savePath) continue;
|
|
284
|
-
try {
|
|
285
|
-
const target = safeTargetPath(item.savePath, item.fileName || `${item.externalId || "script"}.spec.ts`);
|
|
286
|
-
node_fs.mkdirSync(node_path.resolve(node_path.normalize(item.savePath.trim())), { recursive: true });
|
|
287
|
-
node_fs.writeFileSync(target, item.script, { encoding: "utf8" });
|
|
288
|
-
const ack = await tesboFetch(link, `/api/atto/scripts/${encodeURIComponent(item.id)}/ack`, { method: "POST", body: "{}" });
|
|
289
|
-
if (!ack.ok) throw new Error(await errorMessage(ack));
|
|
290
|
-
saved += 1;
|
|
291
|
-
} catch (error) {
|
|
292
|
-
errors.push(error instanceof Error ? error.message : "Could not save a script.");
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return { saved, errors };
|
|
296
|
-
}
|
|
297
|
-
let scriptPollTimer = null;
|
|
298
|
-
const claimedSessionJobs = /* @__PURE__ */ new Set();
|
|
299
|
-
let remoteSessionSink = null;
|
|
300
|
-
function setRemoteSessionSink(sink) {
|
|
301
|
-
remoteSessionSink = sink;
|
|
302
|
-
}
|
|
303
|
-
async function ackAttoRemoteSession(id, status, error, desktopSessionId) {
|
|
304
|
-
const link = readLink();
|
|
305
|
-
if (!link || !id) return;
|
|
306
|
-
await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(id)}/ack`, {
|
|
307
|
-
method: "POST",
|
|
308
|
-
body: JSON.stringify({
|
|
309
|
-
status,
|
|
310
|
-
error: error || void 0,
|
|
311
|
-
desktopSessionId: desktopSessionId || void 0
|
|
312
|
-
})
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
const remoteJobByDesktopSession = /* @__PURE__ */ new Map();
|
|
316
|
-
const activeRemoteJobIds = /* @__PURE__ */ new Set();
|
|
317
|
-
let answerPollTimer = null;
|
|
318
|
-
let engineAdapterForAnswers = null;
|
|
319
|
-
function bindRemoteSessionJob(jobId, desktopSessionId) {
|
|
320
|
-
if (!jobId || !desktopSessionId) return;
|
|
321
|
-
remoteJobByDesktopSession.set(desktopSessionId, jobId);
|
|
322
|
-
activeRemoteJobIds.add(jobId);
|
|
323
|
-
void ackAttoRemoteSession(jobId, "running", void 0, desktopSessionId).catch(() => void 0);
|
|
324
|
-
}
|
|
325
|
-
function attachEngineForRemoteAnswers(adapter) {
|
|
326
|
-
engineAdapterForAnswers = adapter;
|
|
327
|
-
if (answerPollTimer) return;
|
|
328
|
-
answerPollTimer = setInterval(() => {
|
|
329
|
-
void pullRemoteSessionAnswers().catch(() => void 0);
|
|
330
|
-
}, 2500);
|
|
331
|
-
answerPollTimer.unref?.();
|
|
332
|
-
}
|
|
333
|
-
function mirrorEngineEventToChat(event) {
|
|
334
|
-
const jobId = remoteJobByDesktopSession.get(event.sessionId);
|
|
335
|
-
if (!jobId) return;
|
|
336
|
-
if (event.type !== "narration_step" && event.type !== "assertion_result" && event.type !== "stuck_question" && event.type !== "session_status_changed" && event.type !== "agent_log") {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (event.type === "narration_step" && event.status === "in_progress") return;
|
|
340
|
-
void postRemoteSessionEvent(jobId, event).catch(() => void 0);
|
|
341
|
-
if (event.type === "session_status_changed") {
|
|
342
|
-
const status = event.status;
|
|
343
|
-
if (status === "failed" || status === "stopped" || status === "developed" || status === "approved") {
|
|
344
|
-
void ackAttoRemoteSession(jobId, status === "failed" ? "failed" : "done").catch(() => void 0);
|
|
345
|
-
activeRemoteJobIds.delete(jobId);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
async function postRemoteSessionEvent(jobId, event) {
|
|
350
|
-
const link = readLink();
|
|
351
|
-
if (!link) return;
|
|
352
|
-
await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/events`, {
|
|
353
|
-
method: "POST",
|
|
354
|
-
body: JSON.stringify(event)
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
async function pullRemoteSessionAnswers() {
|
|
358
|
-
const link = readLink();
|
|
359
|
-
const adapter = engineAdapterForAnswers;
|
|
360
|
-
if (!link || !adapter || activeRemoteJobIds.size === 0) return;
|
|
361
|
-
for (const jobId of [...activeRemoteJobIds]) {
|
|
362
|
-
try {
|
|
363
|
-
const response = await tesboFetch(link, `/api/atto/sessions/${encodeURIComponent(jobId)}/answers/pending`);
|
|
364
|
-
if (!response.ok) continue;
|
|
365
|
-
const body = await response.json();
|
|
366
|
-
const answers = Array.isArray(body.answers) ? body.answers : [];
|
|
367
|
-
for (const answer of answers) {
|
|
368
|
-
if (!answer?.questionId) continue;
|
|
369
|
-
const desktopSessionId = [...remoteJobByDesktopSession.entries()].find(([, id]) => id === jobId)?.[0];
|
|
370
|
-
if (!desktopSessionId) continue;
|
|
371
|
-
await adapter.answerStuckQuestion({
|
|
372
|
-
sessionId: desktopSessionId,
|
|
373
|
-
questionId: answer.questionId,
|
|
374
|
-
optionId: answer.optionId,
|
|
375
|
-
text: answer.text
|
|
376
|
-
});
|
|
377
|
-
await tesboFetch(
|
|
378
|
-
link,
|
|
379
|
-
`/api/atto/sessions/${encodeURIComponent(jobId)}/answers/${encodeURIComponent(answer.questionId)}/ack`,
|
|
380
|
-
{ method: "POST", body: "{}" }
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
} catch {
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
async function pullAndDispatchPendingSessions() {
|
|
388
|
-
const link = readLink();
|
|
389
|
-
if (!link) return { started: 0, errors: [] };
|
|
390
|
-
const response = await tesboFetch(link, "/api/atto/sessions/pending");
|
|
391
|
-
if (response.status === 401) {
|
|
392
|
-
clearLink();
|
|
393
|
-
return { started: 0, errors: ["Access code stopped."] };
|
|
394
|
-
}
|
|
395
|
-
if (!response.ok) throw new Error(await errorMessage(response));
|
|
396
|
-
const body = await response.json();
|
|
397
|
-
const sessions = Array.isArray(body.sessions) ? body.sessions : [];
|
|
398
|
-
let started = 0;
|
|
399
|
-
const errors = [];
|
|
400
|
-
for (const item of sessions) {
|
|
401
|
-
if (!item?.id || !item.goal || !item.folderPath) continue;
|
|
402
|
-
if (claimedSessionJobs.has(item.id)) continue;
|
|
403
|
-
claimedSessionJobs.add(item.id);
|
|
404
|
-
try {
|
|
405
|
-
const job = {
|
|
406
|
-
id: String(item.id),
|
|
407
|
-
projectId: String(item.projectId || ""),
|
|
408
|
-
projectName: String(item.projectName || ""),
|
|
409
|
-
goal: String(item.goal || "").trim(),
|
|
410
|
-
targetUrl: String(item.targetUrl || "").trim(),
|
|
411
|
-
folderPath: String(item.folderPath || "").trim(),
|
|
412
|
-
browserMode: item.browserMode === "headless" ? "headless" : "headed",
|
|
413
|
-
createdAt: String(item.createdAt || ""),
|
|
414
|
-
chatSessionId: item.chatSessionId ? String(item.chatSessionId) : void 0
|
|
415
|
-
};
|
|
416
|
-
activeRemoteJobIds.add(job.id);
|
|
417
|
-
if (!remoteSessionSink) {
|
|
418
|
-
claimedSessionJobs.delete(item.id);
|
|
419
|
-
errors.push("Atto window is not ready to start a remote session yet.");
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
await ackAttoRemoteSession(job.id, "running");
|
|
423
|
-
remoteSessionSink(job);
|
|
424
|
-
started += 1;
|
|
425
|
-
} catch (error) {
|
|
426
|
-
claimedSessionJobs.delete(item.id);
|
|
427
|
-
errors.push(error instanceof Error ? error.message : "Could not start a remote session.");
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
if (claimedSessionJobs.size > 200) {
|
|
431
|
-
const keep = [...claimedSessionJobs].slice(-100);
|
|
432
|
-
claimedSessionJobs.clear();
|
|
433
|
-
for (const id of keep) claimedSessionJobs.add(id);
|
|
434
|
-
}
|
|
435
|
-
return { started, errors };
|
|
436
|
-
}
|
|
437
|
-
async function fetchAttoRemoteConfig() {
|
|
438
|
-
const link = readLink();
|
|
439
|
-
if (!link) return null;
|
|
440
|
-
const response = await tesboFetch(link, "/api/atto/remote-config");
|
|
441
|
-
if (response.status === 401) {
|
|
442
|
-
clearLink();
|
|
443
|
-
return null;
|
|
444
|
-
}
|
|
445
|
-
if (!response.ok) throw new Error(await errorMessage(response));
|
|
446
|
-
const body = await response.json();
|
|
447
|
-
return {
|
|
448
|
-
userName: String(body.userName || ""),
|
|
449
|
-
clientName: String(body.clientName || ""),
|
|
450
|
-
projectId: String(body.projectId || ""),
|
|
451
|
-
projectName: String(body.projectName || ""),
|
|
452
|
-
scriptSavePath: String(body.scriptSavePath || "").trim(),
|
|
453
|
-
browserMode: body.browserMode === "headless" ? "headless" : "headed",
|
|
454
|
-
targetUrl: String(body.targetUrl || "").trim(),
|
|
455
|
-
description: String(body.description || "").trim(),
|
|
456
|
-
memories: Array.isArray(body.memories) ? body.memories : [],
|
|
457
|
-
qualityGates: body.qualityGates && typeof body.qualityGates === "object" ? body.qualityGates : {},
|
|
458
|
-
install: {
|
|
459
|
-
package: String(body.install?.package || "npm install -g @qablehq/atto"),
|
|
460
|
-
chromium: String(body.install?.chromium || "npx playwright install chromium"),
|
|
461
|
-
note: String(body.install?.note || "")
|
|
462
|
-
}
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
function startAttoScriptPoller(intervalMs = 5e3) {
|
|
466
|
-
if (scriptPollTimer) return;
|
|
467
|
-
const tick = () => {
|
|
468
|
-
void pullAndSavePendingScripts().catch(() => void 0);
|
|
469
|
-
void pullAndDispatchPendingSessions().catch(() => void 0);
|
|
470
|
-
};
|
|
471
|
-
tick();
|
|
472
|
-
scriptPollTimer = setInterval(tick, intervalMs);
|
|
473
|
-
scriptPollTimer.unref?.();
|
|
474
|
-
}
|
|
475
62
|
function registerIpcHandlers(adapter) {
|
|
476
63
|
electron.ipcMain.handle(IPC_CHANNELS.submitGoal, (_e, cmd) => adapter.submitGoal(cmd));
|
|
477
64
|
electron.ipcMain.handle(
|
|
@@ -501,7 +88,6 @@ function registerIpcHandlers(adapter) {
|
|
|
501
88
|
for (const win of electron.BrowserWindow.getAllWindows()) {
|
|
502
89
|
win.webContents.send(IPC_CHANNELS.engineEvent, event);
|
|
503
90
|
}
|
|
504
|
-
mirrorEngineEventToChat(event);
|
|
505
91
|
});
|
|
506
92
|
}
|
|
507
93
|
const DEFAULT_GATE_POLICY = {
|
|
@@ -3490,32 +3076,179 @@ function registerAppStateHandlers() {
|
|
|
3490
3076
|
electron.ipcMain.handle(IPC_CHANNELS.getAppState, () => readAppState());
|
|
3491
3077
|
electron.ipcMain.handle(IPC_CHANNELS.setAppState, (_e, value) => writeAppState(value));
|
|
3492
3078
|
}
|
|
3493
|
-
|
|
3079
|
+
const DEFAULT_BASE_URL = "https://api-app-atto.tesbo.io";
|
|
3080
|
+
const ACCESS_HEADER = "x-atto-access-code";
|
|
3081
|
+
function sessionPath() {
|
|
3082
|
+
return node_path.join(electron.app.getPath("userData"), "tesbo-link.json");
|
|
3083
|
+
}
|
|
3084
|
+
function readLink() {
|
|
3085
|
+
try {
|
|
3086
|
+
const parsed = JSON.parse(node_fs.readFileSync(sessionPath(), "utf8"));
|
|
3087
|
+
if (typeof parsed.code !== "string" || !parsed.code.trim()) return null;
|
|
3088
|
+
return { baseUrl: DEFAULT_BASE_URL, code: parsed.code.trim() };
|
|
3089
|
+
} catch {
|
|
3090
|
+
return null;
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
function writeLink(link) {
|
|
3094
|
+
const path = sessionPath();
|
|
3095
|
+
node_fs.mkdirSync(electron.app.getPath("userData"), { recursive: true });
|
|
3096
|
+
node_fs.writeFileSync(path, JSON.stringify(link), { mode: 384 });
|
|
3097
|
+
node_fs.chmodSync(path, 384);
|
|
3098
|
+
}
|
|
3099
|
+
function clearLink() {
|
|
3100
|
+
node_fs.rmSync(sessionPath(), { force: true });
|
|
3101
|
+
}
|
|
3102
|
+
function disconnected(error = null) {
|
|
3103
|
+
return { connected: false, baseUrl: DEFAULT_BASE_URL, user: null, workspaces: [], projects: [], error };
|
|
3104
|
+
}
|
|
3105
|
+
async function errorMessage(response) {
|
|
3106
|
+
try {
|
|
3107
|
+
const body = await response.json();
|
|
3108
|
+
if (typeof body.error === "string" && body.error.trim()) return body.error;
|
|
3109
|
+
if (typeof body.message === "string" && body.message.trim()) return body.message;
|
|
3110
|
+
} catch {
|
|
3111
|
+
}
|
|
3112
|
+
return `Tesbo returned ${response.status}`;
|
|
3113
|
+
}
|
|
3114
|
+
async function tesboFetch(link, path, init) {
|
|
3115
|
+
return fetch(`${link.baseUrl}${path}`, {
|
|
3116
|
+
...init,
|
|
3117
|
+
headers: {
|
|
3118
|
+
accept: "application/json",
|
|
3119
|
+
[ACCESS_HEADER]: link.code,
|
|
3120
|
+
...{},
|
|
3121
|
+
...init?.headers
|
|
3122
|
+
}
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
function asProjects(value) {
|
|
3126
|
+
if (!Array.isArray(value)) return [];
|
|
3127
|
+
const projects = [];
|
|
3128
|
+
for (const item of value) {
|
|
3129
|
+
if (!item || typeof item !== "object") continue;
|
|
3130
|
+
const row = item;
|
|
3131
|
+
if (typeof row.id !== "string" || typeof row.name !== "string") continue;
|
|
3132
|
+
projects.push({
|
|
3133
|
+
id: row.id,
|
|
3134
|
+
key: typeof row.key === "string" ? row.key : "",
|
|
3135
|
+
name: row.name,
|
|
3136
|
+
role: typeof row.role === "string" ? row.role : "member",
|
|
3137
|
+
clientName: typeof row.clientName === "string" ? row.clientName : void 0,
|
|
3138
|
+
userName: typeof row.userName === "string" ? row.userName : void 0
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
return projects;
|
|
3142
|
+
}
|
|
3143
|
+
async function loadAccount(link) {
|
|
3144
|
+
const response = await tesboFetch(link, "/api/atto/projects");
|
|
3145
|
+
if (response.status === 401) {
|
|
3146
|
+
clearLink();
|
|
3147
|
+
return disconnected(await errorMessage(response));
|
|
3148
|
+
}
|
|
3149
|
+
if (!response.ok) throw new Error(await errorMessage(response));
|
|
3150
|
+
const projects = asProjects(await response.json());
|
|
3151
|
+
return {
|
|
3152
|
+
connected: true,
|
|
3153
|
+
baseUrl: link.baseUrl,
|
|
3154
|
+
user: signedInUser(projects),
|
|
3155
|
+
workspaces: [],
|
|
3156
|
+
projects,
|
|
3157
|
+
error: null
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
function signedInUser(projects) {
|
|
3161
|
+
const project = projects.find((item) => item.userName || item.clientName);
|
|
3162
|
+
if (!project) return null;
|
|
3163
|
+
const name = [project.userName, project.clientName].filter(Boolean).join(" · ");
|
|
3164
|
+
return { userId: project.userName || project.clientName || "", email: null, name: name || null };
|
|
3165
|
+
}
|
|
3166
|
+
async function tesboStatus() {
|
|
3167
|
+
const link = readLink();
|
|
3168
|
+
if (!link) return disconnected();
|
|
3169
|
+
try {
|
|
3170
|
+
return await loadAccount(link);
|
|
3171
|
+
} catch (error) {
|
|
3172
|
+
return disconnected(error instanceof Error ? error.message : "Could not reach Tesbo.");
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
async function tesboLogin(cmd) {
|
|
3176
|
+
const code = cmd.code.trim();
|
|
3177
|
+
if (!code) throw new Error("Paste the access code from Tesbo.");
|
|
3178
|
+
const link = { baseUrl: DEFAULT_BASE_URL, code };
|
|
3179
|
+
const response = await fetch(`${link.baseUrl}/api/atto/connect`, {
|
|
3180
|
+
method: "POST",
|
|
3181
|
+
headers: { accept: "application/json", "content-type": "application/json" },
|
|
3182
|
+
body: JSON.stringify({ code })
|
|
3183
|
+
});
|
|
3184
|
+
if (!response.ok) throw new Error(await errorMessage(response));
|
|
3185
|
+
writeLink(link);
|
|
3186
|
+
const projects = asProjects(await response.json());
|
|
3187
|
+
return {
|
|
3188
|
+
connected: true,
|
|
3189
|
+
baseUrl: link.baseUrl,
|
|
3190
|
+
user: signedInUser(projects),
|
|
3191
|
+
workspaces: [],
|
|
3192
|
+
projects,
|
|
3193
|
+
error: null
|
|
3194
|
+
};
|
|
3195
|
+
}
|
|
3196
|
+
async function tesboLogout() {
|
|
3197
|
+
clearLink();
|
|
3198
|
+
return disconnected();
|
|
3199
|
+
}
|
|
3200
|
+
const SERVER_AGENTS = [
|
|
3201
|
+
{
|
|
3202
|
+
id: "zyra",
|
|
3203
|
+
name: "Zyra the Test Generator",
|
|
3204
|
+
role: "AI testcase generation agent",
|
|
3205
|
+
summary: "Stays on Tesbo for the QAble team. This package does not open the website.",
|
|
3206
|
+
status: "active",
|
|
3207
|
+
detail: null
|
|
3208
|
+
},
|
|
3209
|
+
{
|
|
3210
|
+
id: "nyra",
|
|
3211
|
+
name: "NYRA",
|
|
3212
|
+
role: "App exploration agent",
|
|
3213
|
+
summary: "Stays on Tesbo for the QAble team. This package does not open the website.",
|
|
3214
|
+
status: "active",
|
|
3215
|
+
detail: null
|
|
3216
|
+
}
|
|
3217
|
+
];
|
|
3218
|
+
const COMING_SOON = [
|
|
3219
|
+
{
|
|
3220
|
+
id: "run-analyst",
|
|
3221
|
+
name: "Run Analyst",
|
|
3222
|
+
role: "Execution insight agent",
|
|
3223
|
+
summary: "Planned for run failure clustering, flaky-test signals, and release risk notes.",
|
|
3224
|
+
status: "coming-soon",
|
|
3225
|
+
detail: null
|
|
3226
|
+
},
|
|
3227
|
+
{
|
|
3228
|
+
id: "bug-triage",
|
|
3229
|
+
name: "Bug Triage",
|
|
3230
|
+
role: "Defect analysis agent",
|
|
3231
|
+
summary: "Planned for duplicate bug checks, severity suggestions, and owner recommendations.",
|
|
3232
|
+
status: "coming-soon",
|
|
3233
|
+
detail: null
|
|
3234
|
+
}
|
|
3235
|
+
];
|
|
3236
|
+
async function tesboAgents(projectId) {
|
|
3237
|
+
const link = readLink();
|
|
3238
|
+
if (!link) throw new Error("Connect with an access code first.");
|
|
3239
|
+
if (!projectId.trim()) throw new Error("Choose a project.");
|
|
3240
|
+
const status = await loadAccount(link);
|
|
3241
|
+
if (!status.connected) throw new Error(status.error || "This access code has been stopped.");
|
|
3242
|
+
if (!status.projects.some((project) => project.id === projectId)) {
|
|
3243
|
+
throw new Error("This project is not available for this access code.");
|
|
3244
|
+
}
|
|
3245
|
+
return { projectId, agents: [...SERVER_AGENTS, ...COMING_SOON], notice: null };
|
|
3246
|
+
}
|
|
3247
|
+
function registerTesboHandlers() {
|
|
3494
3248
|
electron.ipcMain.handle(IPC_CHANNELS.tesboStatus, () => tesboStatus());
|
|
3495
3249
|
electron.ipcMain.handle(IPC_CHANNELS.tesboLogin, (_event, cmd) => tesboLogin(cmd));
|
|
3496
3250
|
electron.ipcMain.handle(IPC_CHANNELS.tesboLogout, () => tesboLogout());
|
|
3497
3251
|
electron.ipcMain.handle(IPC_CHANNELS.tesboAgents, (_event, projectId) => tesboAgents(projectId));
|
|
3498
|
-
electron.ipcMain.handle(IPC_CHANNELS.tesboRemoteConfig, () => fetchAttoRemoteConfig());
|
|
3499
|
-
electron.ipcMain.handle(
|
|
3500
|
-
IPC_CHANNELS.tesboAckRemoteSession,
|
|
3501
|
-
async (_event, cmd) => {
|
|
3502
|
-
await ackAttoRemoteSession(cmd.id, cmd.status, cmd.error, cmd.desktopSessionId);
|
|
3503
|
-
}
|
|
3504
|
-
);
|
|
3505
|
-
electron.ipcMain.handle(
|
|
3506
|
-
IPC_CHANNELS.tesboBindRemoteSession,
|
|
3507
|
-
async (_event, cmd) => {
|
|
3508
|
-
bindRemoteSessionJob(cmd.jobId, cmd.desktopSessionId);
|
|
3509
|
-
}
|
|
3510
|
-
);
|
|
3511
|
-
setRemoteSessionSink((job) => {
|
|
3512
|
-
for (const win of electron.BrowserWindow.getAllWindows()) {
|
|
3513
|
-
win.webContents.send(IPC_CHANNELS.tesboRemoteSession, job);
|
|
3514
|
-
}
|
|
3515
|
-
});
|
|
3516
|
-
if (adapter) attachEngineForRemoteAnswers(adapter);
|
|
3517
|
-
startAttoScriptPoller();
|
|
3518
|
-
void pullAndSavePendingScripts().catch(() => void 0);
|
|
3519
3252
|
}
|
|
3520
3253
|
const SCHEME = "taa-media";
|
|
3521
3254
|
const sessionRoots = /* @__PURE__ */ new Map();
|
|
@@ -12492,7 +12225,7 @@ electron.app.whenReady().then(() => {
|
|
|
12492
12225
|
registerAiHandlers();
|
|
12493
12226
|
registerProjectFilesHandlers();
|
|
12494
12227
|
registerAppStateHandlers();
|
|
12495
|
-
registerTesboHandlers(
|
|
12228
|
+
registerTesboHandlers();
|
|
12496
12229
|
createMainWindow();
|
|
12497
12230
|
setupAutoUpdater();
|
|
12498
12231
|
electron.app.on("activate", () => {
|
package/out/preload/index.js
CHANGED
|
@@ -43,12 +43,6 @@ const IPC_CHANNELS = {
|
|
|
43
43
|
tesboLogin: "taa:tesbo:login",
|
|
44
44
|
tesboLogout: "taa:tesbo:logout",
|
|
45
45
|
tesboAgents: "taa:tesbo:agents",
|
|
46
|
-
tesboRemoteConfig: "taa:tesbo:remoteConfig",
|
|
47
|
-
/** Main → renderer: start a Chat-queued desktop session (New session equivalent). */
|
|
48
|
-
tesboRemoteSession: "taa:tesbo:remoteSession",
|
|
49
|
-
tesboAckRemoteSession: "taa:tesbo:ackRemoteSession",
|
|
50
|
-
/** Renderer → main: bind a RealEngine session to a Chat job for live mirroring. */
|
|
51
|
-
tesboBindRemoteSession: "taa:tesbo:bindRemoteSession",
|
|
52
46
|
// Contextual command handling
|
|
53
47
|
submitCommand: "taa:sessions:submitCommand",
|
|
54
48
|
getCommandQueue: "taa:sessions:getCommandQueue",
|
|
@@ -114,15 +108,7 @@ const api = {
|
|
|
114
108
|
status: () => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboStatus),
|
|
115
109
|
login: (cmd) => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboLogin, cmd),
|
|
116
110
|
logout: () => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboLogout),
|
|
117
|
-
agents: (projectId) => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboAgents, projectId)
|
|
118
|
-
remoteConfig: () => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboRemoteConfig),
|
|
119
|
-
onRemoteSession: (cb) => {
|
|
120
|
-
const listener = (_event, payload) => cb(payload);
|
|
121
|
-
electron.ipcRenderer.on(IPC_CHANNELS.tesboRemoteSession, listener);
|
|
122
|
-
return () => electron.ipcRenderer.removeListener(IPC_CHANNELS.tesboRemoteSession, listener);
|
|
123
|
-
},
|
|
124
|
-
ackRemoteSession: (cmd) => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboAckRemoteSession, cmd),
|
|
125
|
-
bindRemoteSession: (cmd) => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboBindRemoteSession, cmd)
|
|
111
|
+
agents: (projectId) => electron.ipcRenderer.invoke(IPC_CHANNELS.tesboAgents, projectId)
|
|
126
112
|
}
|
|
127
113
|
};
|
|
128
114
|
electron.contextBridge.exposeInMainWorld("taa", api);
|
|
@@ -16969,8 +16969,6 @@ function patchProject(slice, id, patch) {
|
|
|
16969
16969
|
};
|
|
16970
16970
|
}
|
|
16971
16971
|
function setProjectFolderPath(slice, id, folderPath) {
|
|
16972
|
-
const existing = slice.projectsById[id];
|
|
16973
|
-
if (existing && existing.folderPath === folderPath) return slice;
|
|
16974
16972
|
return patchProject(slice, id, { folderPath, analysis: { status: "idle" } });
|
|
16975
16973
|
}
|
|
16976
16974
|
function setProjectAiBinding(slice, id, aiBinding) {
|
|
@@ -17047,12 +17045,6 @@ const useAppStore = create$1()(
|
|
|
17047
17045
|
set((state) => createProject(state, id, input));
|
|
17048
17046
|
return id;
|
|
17049
17047
|
},
|
|
17050
|
-
ensureProject: (id, input) => {
|
|
17051
|
-
set(
|
|
17052
|
-
(state) => state.projectsById[id] ? updateProject(state, id, input) : createProject(state, id, input)
|
|
17053
|
-
);
|
|
17054
|
-
return id;
|
|
17055
|
-
},
|
|
17056
17048
|
updateProject: (id, patch) => set((state) => updateProject(state, id, patch)),
|
|
17057
17049
|
deleteProject: (id) => set((state) => {
|
|
17058
17050
|
const wasActive = state.activeProjectId === id;
|
|
@@ -33038,12 +33030,6 @@ const STATUS_LABEL$1 = {
|
|
|
33038
33030
|
inactive: "Inactive",
|
|
33039
33031
|
"coming-soon": "Coming soon"
|
|
33040
33032
|
};
|
|
33041
|
-
function isTransientReachError(message) {
|
|
33042
|
-
if (!message) return false;
|
|
33043
|
-
return /could not reach tesbo|fetch failed|failed to fetch|network|ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENOTFOUND/i.test(
|
|
33044
|
-
message
|
|
33045
|
-
);
|
|
33046
|
-
}
|
|
33047
33033
|
function TesboPanel() {
|
|
33048
33034
|
const [status, setStatus] = reactExports.useState(null);
|
|
33049
33035
|
const [code, setCode] = reactExports.useState("");
|
|
@@ -33057,17 +33043,15 @@ function TesboPanel() {
|
|
|
33057
33043
|
let cancelled = false;
|
|
33058
33044
|
const apply = (next, stamp) => {
|
|
33059
33045
|
if (cancelled || stamp !== refreshGeneration.current) return;
|
|
33060
|
-
|
|
33061
|
-
|
|
33062
|
-
}
|
|
33046
|
+
const offline = !next.connected && next.error === "Could not reach Tesbo.";
|
|
33047
|
+
if (offline && statusRef.current?.connected) return;
|
|
33063
33048
|
statusRef.current = next;
|
|
33064
33049
|
setStatus(next);
|
|
33065
33050
|
setProjectId(
|
|
33066
33051
|
(current) => next.projects.some((project) => project.id === current) ? current : next.projects[0]?.id ?? ""
|
|
33067
33052
|
);
|
|
33068
33053
|
if (!next.connected) setAgents(null);
|
|
33069
|
-
if (next.error
|
|
33070
|
-
else if (next.connected || !next.error) setFormError(null);
|
|
33054
|
+
if (next.error) setFormError(next.error);
|
|
33071
33055
|
};
|
|
33072
33056
|
const refresh = () => {
|
|
33073
33057
|
const stamp = refreshGeneration.current;
|
|
@@ -33089,15 +33073,11 @@ function TesboPanel() {
|
|
|
33089
33073
|
}
|
|
33090
33074
|
let cancelled = false;
|
|
33091
33075
|
void window.taa.tesbo.agents(projectId).then((next) => {
|
|
33092
|
-
if (cancelled)
|
|
33093
|
-
setAgents(next);
|
|
33094
|
-
setFormError(null);
|
|
33076
|
+
if (!cancelled) setAgents(next);
|
|
33095
33077
|
}).catch((error) => {
|
|
33096
33078
|
if (cancelled) return;
|
|
33097
|
-
const message = error instanceof Error ? error.message : "Could not load agents.";
|
|
33098
|
-
if (isTransientReachError(message)) return;
|
|
33099
33079
|
setAgents(null);
|
|
33100
|
-
setFormError(message);
|
|
33080
|
+
setFormError(error instanceof Error ? error.message : "Could not load agents.");
|
|
33101
33081
|
});
|
|
33102
33082
|
return () => {
|
|
33103
33083
|
cancelled = true;
|
|
@@ -33193,74 +33173,24 @@ function TesboPanel() {
|
|
|
33193
33173
|
formError && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-3 text-sm text-destructive", children: formError })
|
|
33194
33174
|
] });
|
|
33195
33175
|
}
|
|
33196
|
-
function tesboProjectId$1(remote) {
|
|
33197
|
-
return `tesbo-${remote.projectId}`;
|
|
33198
|
-
}
|
|
33199
33176
|
function ProjectList() {
|
|
33200
33177
|
const projectsById = useAppStore((s2) => s2.projectsById);
|
|
33201
33178
|
const projectOrder = useAppStore((s2) => s2.projectOrder);
|
|
33202
33179
|
const setActiveProject = useAppStore((s2) => s2.setActiveProject);
|
|
33203
33180
|
const setView = useAppStore((s2) => s2.setView);
|
|
33204
|
-
const ensureProject = useAppStore((s2) => s2.ensureProject);
|
|
33205
|
-
const setFolderPath = useAppStore((s2) => s2.setProjectFolderPath);
|
|
33206
|
-
const setBrowserMode = useAppStore((s2) => s2.setProjectBrowserMode);
|
|
33207
|
-
const setMemories = useAppStore((s2) => s2.setProjectMemories);
|
|
33208
33181
|
const [dialogOpen, setDialogOpen] = reactExports.useState(false);
|
|
33209
|
-
const [tesboConnected, setTesboConnected] = reactExports.useState(false);
|
|
33210
33182
|
const projects = projectOrder.map((id) => projectsById[id]);
|
|
33211
33183
|
const openProjectSettings = (id) => {
|
|
33212
33184
|
setActiveProject(id);
|
|
33213
33185
|
setView("project-settings");
|
|
33214
33186
|
};
|
|
33215
|
-
reactExports.useEffect(() => {
|
|
33216
|
-
let cancelled = false;
|
|
33217
|
-
const applyRemote = (remote) => {
|
|
33218
|
-
const id = tesboProjectId$1(remote);
|
|
33219
|
-
ensureProject(id, {
|
|
33220
|
-
name: remote.projectName || remote.userName || "Tesbo project",
|
|
33221
|
-
targetUrl: remote.targetUrl || void 0,
|
|
33222
|
-
description: remote.description || void 0
|
|
33223
|
-
});
|
|
33224
|
-
if (remote.scriptSavePath) setFolderPath(id, remote.scriptSavePath);
|
|
33225
|
-
setBrowserMode(id, remote.browserMode);
|
|
33226
|
-
setMemories(
|
|
33227
|
-
id,
|
|
33228
|
-
(remote.memories || []).map((memory) => ({
|
|
33229
|
-
id: memory.id,
|
|
33230
|
-
kind: "note",
|
|
33231
|
-
content: memory.content,
|
|
33232
|
-
createdAt: memory.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
33233
|
-
source: "manual"
|
|
33234
|
-
}))
|
|
33235
|
-
);
|
|
33236
|
-
setActiveProject(id);
|
|
33237
|
-
};
|
|
33238
|
-
const refresh = async () => {
|
|
33239
|
-
try {
|
|
33240
|
-
const status = await window.taa.tesbo.status();
|
|
33241
|
-
if (cancelled) return;
|
|
33242
|
-
setTesboConnected(Boolean(status.connected));
|
|
33243
|
-
if (!status.connected) return;
|
|
33244
|
-
const remote = await window.taa.tesbo.remoteConfig();
|
|
33245
|
-
if (cancelled || !remote?.projectId) return;
|
|
33246
|
-
applyRemote(remote);
|
|
33247
|
-
} catch {
|
|
33248
|
-
}
|
|
33249
|
-
};
|
|
33250
|
-
void refresh();
|
|
33251
|
-
const timer = window.setInterval(() => void refresh(), 8e3);
|
|
33252
|
-
return () => {
|
|
33253
|
-
cancelled = true;
|
|
33254
|
-
window.clearInterval(timer);
|
|
33255
|
-
};
|
|
33256
|
-
}, [ensureProject, setFolderPath, setBrowserMode, setMemories, setActiveProject]);
|
|
33257
33187
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-1 flex-col overflow-hidden bg-background", children: [
|
|
33258
33188
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("header", { className: "flex items-center justify-between border-b border-border px-6 py-4", children: [
|
|
33259
33189
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
33260
33190
|
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-lg font-semibold", children: "Projects" }),
|
|
33261
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
33191
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "Group your test cases by the app or flow they cover." })
|
|
33262
33192
|
] }),
|
|
33263
|
-
|
|
33193
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", className: "gap-2", onClick: () => setDialogOpen(true), children: [
|
|
33264
33194
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "size-4" }),
|
|
33265
33195
|
"New project"
|
|
33266
33196
|
] })
|
|
@@ -33270,10 +33200,10 @@ function ProjectList() {
|
|
|
33270
33200
|
projects.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center gap-3 py-16 text-center", children: [
|
|
33271
33201
|
/* @__PURE__ */ jsxRuntimeExports.jsx(FolderKanban, { className: "size-8 text-muted-foreground" }),
|
|
33272
33202
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
33273
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium", children:
|
|
33274
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
33203
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium", children: "No projects yet" }),
|
|
33204
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "Create a project to start generating test cases." })
|
|
33275
33205
|
] }),
|
|
33276
|
-
|
|
33206
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", className: "gap-2", onClick: () => setDialogOpen(true), children: [
|
|
33277
33207
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "size-4" }),
|
|
33278
33208
|
"New project"
|
|
33279
33209
|
] })
|
|
@@ -34508,7 +34438,7 @@ function GateEditor({
|
|
|
34508
34438
|
}
|
|
34509
34439
|
);
|
|
34510
34440
|
}
|
|
34511
|
-
let started
|
|
34441
|
+
let started = false;
|
|
34512
34442
|
function toEngineContext(project) {
|
|
34513
34443
|
if (!project.folderPath || !project.aiBinding) return null;
|
|
34514
34444
|
return {
|
|
@@ -34532,8 +34462,8 @@ async function syncAiBindings() {
|
|
|
34532
34462
|
}
|
|
34533
34463
|
}
|
|
34534
34464
|
async function bootstrapEngineConnection() {
|
|
34535
|
-
if (started
|
|
34536
|
-
started
|
|
34465
|
+
if (started) return;
|
|
34466
|
+
started = true;
|
|
34537
34467
|
await waitForStoreHydration();
|
|
34538
34468
|
const { ingestEvent, setActiveSession, setActiveProject, createProject: createProject2, linkSessionToProject: linkSessionToProject2 } = useAppStore.getState();
|
|
34539
34469
|
await syncAiBindings();
|
|
@@ -34830,101 +34760,7 @@ function App() {
|
|
|
34830
34760
|
useThemeEffect();
|
|
34831
34761
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(AppShell, {});
|
|
34832
34762
|
}
|
|
34833
|
-
function tesboProjectId(projectId) {
|
|
34834
|
-
return `tesbo-${projectId}`;
|
|
34835
|
-
}
|
|
34836
|
-
async function startRemoteSession(job) {
|
|
34837
|
-
const {
|
|
34838
|
-
ensureProject,
|
|
34839
|
-
setProjectFolderPath: setProjectFolderPath2,
|
|
34840
|
-
setProjectBrowserMode: setProjectBrowserMode2,
|
|
34841
|
-
setProjectAiBinding: setProjectAiBinding2,
|
|
34842
|
-
setProjectAnalysis: setProjectAnalysis2,
|
|
34843
|
-
setProjectMemories: setProjectMemories2,
|
|
34844
|
-
setActiveProject,
|
|
34845
|
-
setView,
|
|
34846
|
-
linkSessionToProject: linkSessionToProject2,
|
|
34847
|
-
setActiveSession,
|
|
34848
|
-
setStreamingSession
|
|
34849
|
-
} = useAppStore.getState();
|
|
34850
|
-
const id = tesboProjectId(job.projectId || "project");
|
|
34851
|
-
ensureProject(id, {
|
|
34852
|
-
name: job.projectName || "Tesbo project",
|
|
34853
|
-
targetUrl: job.targetUrl || void 0
|
|
34854
|
-
});
|
|
34855
|
-
setProjectFolderPath2(id, job.folderPath);
|
|
34856
|
-
setProjectBrowserMode2(id, job.browserMode);
|
|
34857
|
-
if (job.targetUrl) {
|
|
34858
|
-
ensureProject(id, {
|
|
34859
|
-
name: useAppStore.getState().projectsById[id]?.name || job.projectName || "Tesbo project",
|
|
34860
|
-
targetUrl: job.targetUrl
|
|
34861
|
-
});
|
|
34862
|
-
}
|
|
34863
|
-
setActiveProject(id);
|
|
34864
|
-
setView("session");
|
|
34865
|
-
const bindings = await window.taa.ai.listBindings().catch(() => ({}));
|
|
34866
|
-
if (bindings[id]) setProjectAiBinding2(id, bindings[id]);
|
|
34867
|
-
let project = useAppStore.getState().projectsById[id];
|
|
34868
|
-
if (!project?.folderPath) {
|
|
34869
|
-
throw new Error("No folder path on this PC for the Atto user. Set save location under Agents → Atto.");
|
|
34870
|
-
}
|
|
34871
|
-
if (!project.aiBinding) {
|
|
34872
|
-
throw new Error("Connect an AI key in Atto project settings on this PC, then retry from Chat.");
|
|
34873
|
-
}
|
|
34874
|
-
if (project.analysis?.status !== "ready") {
|
|
34875
|
-
setProjectAnalysis2(id, { status: "analyzing" });
|
|
34876
|
-
try {
|
|
34877
|
-
const result = await window.taa.projects.analyzeFolder({
|
|
34878
|
-
projectId: id,
|
|
34879
|
-
folderPath: project.folderPath
|
|
34880
|
-
});
|
|
34881
|
-
setProjectMemories2(id, result.memories);
|
|
34882
|
-
setProjectAnalysis2(id, {
|
|
34883
|
-
status: "ready",
|
|
34884
|
-
lastRunAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
34885
|
-
usedAi: result.usedAi,
|
|
34886
|
-
error: result.warning
|
|
34887
|
-
});
|
|
34888
|
-
} catch {
|
|
34889
|
-
setProjectAnalysis2(id, { status: "ready", lastRunAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
34890
|
-
}
|
|
34891
|
-
project = useAppStore.getState().projectsById[id];
|
|
34892
|
-
}
|
|
34893
|
-
await registerProjectWithEngine(project);
|
|
34894
|
-
const sessionId = await window.taa.sessions.submitGoal({
|
|
34895
|
-
goal: job.goal,
|
|
34896
|
-
targetUrl: job.targetUrl || project.targetUrl,
|
|
34897
|
-
project: {
|
|
34898
|
-
projectId: project.id,
|
|
34899
|
-
name: project.name,
|
|
34900
|
-
folderPath: project.folderPath,
|
|
34901
|
-
targetUrl: job.targetUrl || project.targetUrl,
|
|
34902
|
-
memories: (project.memories || []).map((memory) => memory.content),
|
|
34903
|
-
browserMode: job.browserMode || project.browserMode
|
|
34904
|
-
}
|
|
34905
|
-
});
|
|
34906
|
-
linkSessionToProject2(id, sessionId);
|
|
34907
|
-
setActiveSession(sessionId);
|
|
34908
|
-
setStreamingSession(sessionId);
|
|
34909
|
-
await window.taa.tesbo.bindRemoteSession({ jobId: job.id, desktopSessionId: sessionId });
|
|
34910
|
-
}
|
|
34911
|
-
let started = false;
|
|
34912
|
-
function startRemoteSessionListener() {
|
|
34913
|
-
if (started) return;
|
|
34914
|
-
started = true;
|
|
34915
|
-
window.taa.tesbo.onRemoteSession((job) => {
|
|
34916
|
-
void (async () => {
|
|
34917
|
-
try {
|
|
34918
|
-
await startRemoteSession(job);
|
|
34919
|
-
} catch (error) {
|
|
34920
|
-
const message = error instanceof Error ? error.message : "Could not start remote session.";
|
|
34921
|
-
await window.taa.tesbo.ackRemoteSession({ id: job.id, status: "failed", error: message }).catch(() => void 0);
|
|
34922
|
-
}
|
|
34923
|
-
})();
|
|
34924
|
-
});
|
|
34925
|
-
}
|
|
34926
34763
|
void bootstrapEngineConnection();
|
|
34927
|
-
startRemoteSessionListener();
|
|
34928
34764
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
34929
34765
|
/* @__PURE__ */ jsxRuntimeExports.jsx(React.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, {}) })
|
|
34930
34766
|
);
|
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-CWoTAmL0.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-CKtSvvUQ.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|