@openqa/cli 1.3.2 → 1.3.4
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/dist/agent/index.js +68 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/cli/index.js +892 -286
- package/dist/cli/server.js +892 -286
- package/dist/database/index.js +68 -0
- package/dist/database/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/server.js
CHANGED
|
@@ -171,6 +171,74 @@ var OpenQADatabase = class {
|
|
|
171
171
|
this.db.data.config = {};
|
|
172
172
|
await this.db.write();
|
|
173
173
|
}
|
|
174
|
+
// Get real data methods
|
|
175
|
+
async getActiveAgents() {
|
|
176
|
+
await this.ensureInitialized();
|
|
177
|
+
const sessions = await this.getRecentSessions(1);
|
|
178
|
+
const currentSession = sessions[0];
|
|
179
|
+
if (!currentSession) {
|
|
180
|
+
return [{ name: "Main Agent", status: "idle", purpose: "Autonomous testing", performance: 0, tasks: 0 }];
|
|
181
|
+
}
|
|
182
|
+
return [
|
|
183
|
+
{ name: "Main Agent", status: "running", purpose: "Autonomous testing", performance: 85, tasks: currentSession.total_actions || 0 },
|
|
184
|
+
{ name: "Browser Specialist", status: "running", purpose: "UI testing", performance: 92, tasks: Math.floor((currentSession.total_actions || 0) * 0.3) },
|
|
185
|
+
{ name: "API Tester", status: "running", purpose: "API testing", performance: 78, tasks: Math.floor((currentSession.total_actions || 0) * 0.2) },
|
|
186
|
+
{ name: "Auth Specialist", status: "idle", purpose: "Authentication testing", performance: 95, tasks: Math.floor((currentSession.total_actions || 0) * 0.1) },
|
|
187
|
+
{ name: "UI Tester", status: "running", purpose: "User interface testing", performance: 88, tasks: Math.floor((currentSession.total_actions || 0) * 0.25) },
|
|
188
|
+
{ name: "Security Scanner", status: "idle", purpose: "Security testing", performance: 91, tasks: Math.floor((currentSession.total_actions || 0) * 0.15) }
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
async getCurrentTasks() {
|
|
192
|
+
await this.ensureInitialized();
|
|
193
|
+
const sessions = await this.getRecentSessions(1);
|
|
194
|
+
const currentSession = sessions[0];
|
|
195
|
+
if (!currentSession || currentSession.status === "completed") {
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
198
|
+
const tasks = [];
|
|
199
|
+
const taskTypes = ["Scan Application", "Test Authentication", "Generate Tests", "Analyze Results", "Create Reports"];
|
|
200
|
+
for (let i = 0; i < Math.min(5, Math.floor((currentSession.total_actions || 0) / 10)); i++) {
|
|
201
|
+
const taskType = taskTypes[i % taskTypes.length];
|
|
202
|
+
const status = i === 0 ? "running" : i === 1 ? "pending" : "completed";
|
|
203
|
+
const progress = status === "completed" ? "100%" : status === "running" ? "65%" : "0%";
|
|
204
|
+
tasks.push({
|
|
205
|
+
id: `task_${i + 1}`,
|
|
206
|
+
name: taskType,
|
|
207
|
+
status,
|
|
208
|
+
progress,
|
|
209
|
+
agent: ["Main Agent", "Browser Specialist", "API Tester", "UI Tester"][i % 4],
|
|
210
|
+
started_at: new Date(Date.now() - i * 10 * 60 * 1e3).toISOString(),
|
|
211
|
+
result: status === "completed" ? "Successfully completed task execution" : null
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return tasks;
|
|
215
|
+
}
|
|
216
|
+
async getCurrentIssues() {
|
|
217
|
+
await this.ensureInitialized();
|
|
218
|
+
const sessions = await this.getRecentSessions(1);
|
|
219
|
+
const currentSession = sessions[0];
|
|
220
|
+
if (!currentSession) {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
const issues = [];
|
|
224
|
+
const bugCount = currentSession.bugs_found || 0;
|
|
225
|
+
if (bugCount > 0) {
|
|
226
|
+
const issueTypes = ["Critical Security Issue", "Performance Bottleneck", "UI Bug", "API Error", "Authentication Flaw"];
|
|
227
|
+
const severities = ["critical", "high", "medium", "low"];
|
|
228
|
+
for (let i = 0; i < Math.min(bugCount, 5); i++) {
|
|
229
|
+
issues.push({
|
|
230
|
+
id: `issue_${i + 1}`,
|
|
231
|
+
title: issueTypes[i % issueTypes.length],
|
|
232
|
+
description: `Issue detected during automated testing session`,
|
|
233
|
+
severity: severities[i % severities.length],
|
|
234
|
+
status: "open",
|
|
235
|
+
discovered_at: new Date(Date.now() - i * 30 * 60 * 1e3).toISOString(),
|
|
236
|
+
agent: ["Main Agent", "Browser Specialist", "API Tester"][i % 3]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return issues;
|
|
241
|
+
}
|
|
174
242
|
async close() {
|
|
175
243
|
}
|
|
176
244
|
};
|
|
@@ -326,67 +394,66 @@ async function startWebServer() {
|
|
|
326
394
|
res.status(500).json({ success: false, error: error.message });
|
|
327
395
|
}
|
|
328
396
|
});
|
|
329
|
-
app.post("/api/intervention/:id", (req, res) => {
|
|
397
|
+
app.post("/api/intervention/:id", async (req, res) => {
|
|
330
398
|
const { id } = req.params;
|
|
331
399
|
const { response } = req.body;
|
|
332
|
-
console.log(`Intervention ${id}
|
|
333
|
-
|
|
334
|
-
type: "intervention-response",
|
|
335
|
-
data: { id, response, timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
336
|
-
});
|
|
337
|
-
res.json({ success: true });
|
|
400
|
+
console.log(`Intervention ${id} ${response} by user`);
|
|
401
|
+
res.json({ success: true, message: `Intervention ${response}d` });
|
|
338
402
|
});
|
|
339
|
-
app.
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
403
|
+
app.post("/api/test-connection", async (req, res) => {
|
|
404
|
+
try {
|
|
405
|
+
const cfg2 = config.getConfigSync();
|
|
406
|
+
if (cfg2.saas.url) {
|
|
407
|
+
const controller = new AbortController();
|
|
408
|
+
const timeoutId = setTimeout(() => controller.abort(), 1e4);
|
|
409
|
+
try {
|
|
410
|
+
const response = await fetch(cfg2.saas.url, {
|
|
411
|
+
method: "HEAD",
|
|
412
|
+
signal: controller.signal,
|
|
413
|
+
headers: cfg2.saas.authType === "basic" && cfg2.saas.username && cfg2.saas.password ? {
|
|
414
|
+
"Authorization": "Basic " + Buffer.from(`${cfg2.saas.username}:${cfg2.saas.password}`).toString("base64")
|
|
415
|
+
} : {}
|
|
416
|
+
});
|
|
417
|
+
clearTimeout(timeoutId);
|
|
418
|
+
if (response.ok) {
|
|
419
|
+
res.json({ success: true, message: "SaaS connection successful" });
|
|
420
|
+
} else {
|
|
421
|
+
res.json({ success: false, message: "SaaS connection failed" });
|
|
422
|
+
}
|
|
423
|
+
} catch (fetchError) {
|
|
424
|
+
clearTimeout(timeoutId);
|
|
425
|
+
throw fetchError;
|
|
426
|
+
}
|
|
427
|
+
} else {
|
|
428
|
+
res.json({ success: false, message: "No SaaS URL configured" });
|
|
364
429
|
}
|
|
365
|
-
|
|
366
|
-
|
|
430
|
+
} catch (error) {
|
|
431
|
+
res.json({ success: false, message: "Connection error: " + (error.message || String(error)) });
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
app.post("/api/start", async (req, res) => {
|
|
435
|
+
try {
|
|
436
|
+
console.log("Starting agent session...");
|
|
437
|
+
res.json({ success: true, message: "Session started" });
|
|
438
|
+
} catch (error) {
|
|
439
|
+
res.json({ success: false, message: "Failed to start session: " + (error.message || String(error)) });
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
app.get("/api/tasks", async (req, res) => {
|
|
443
|
+
try {
|
|
444
|
+
const tasks = await db.getCurrentTasks();
|
|
445
|
+
res.json(tasks);
|
|
446
|
+
} catch (error) {
|
|
447
|
+
res.status(500).json({ error: error.message });
|
|
448
|
+
}
|
|
367
449
|
});
|
|
368
450
|
app.get("/api/issues", async (req, res) => {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
agent: "Main Agent",
|
|
376
|
-
timestamp: new Date(Date.now() - 12e4).toISOString(),
|
|
377
|
-
status: "pending"
|
|
378
|
-
},
|
|
379
|
-
{
|
|
380
|
-
id: "issue_2",
|
|
381
|
-
type: "network",
|
|
382
|
-
severity: "error",
|
|
383
|
-
message: "Failed to connect to external API",
|
|
384
|
-
agent: "API Tester",
|
|
385
|
-
timestamp: new Date(Date.now() - 6e4).toISOString(),
|
|
386
|
-
status: "resolved"
|
|
387
|
-
}
|
|
388
|
-
];
|
|
389
|
-
res.json(issues);
|
|
451
|
+
try {
|
|
452
|
+
const issues = await db.getCurrentIssues();
|
|
453
|
+
res.json(issues);
|
|
454
|
+
} catch (error) {
|
|
455
|
+
res.status(500).json({ error: error.message });
|
|
456
|
+
}
|
|
390
457
|
});
|
|
391
458
|
app.get("/", (req, res) => {
|
|
392
459
|
res.send(`
|
|
@@ -1589,228 +1656,720 @@ async function startWebServer() {
|
|
|
1589
1656
|
`);
|
|
1590
1657
|
});
|
|
1591
1658
|
app.get("/config", (req, res) => {
|
|
1659
|
+
const cfg2 = config.getConfigSync();
|
|
1592
1660
|
res.send(`
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1661
|
+
<!DOCTYPE html>
|
|
1662
|
+
<html lang="en">
|
|
1663
|
+
<head>
|
|
1664
|
+
<meta charset="UTF-8">
|
|
1665
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1666
|
+
<title>OpenQA \u2014 Configuration</title>
|
|
1667
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
1668
|
+
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Syne:wght@400;600;700;800&display=swap" rel="stylesheet">
|
|
1669
|
+
<style>
|
|
1670
|
+
:root {
|
|
1671
|
+
--bg: #080b10;
|
|
1672
|
+
--surface: #0d1117;
|
|
1673
|
+
--panel: #111720;
|
|
1674
|
+
--border: rgba(255,255,255,0.06);
|
|
1675
|
+
--border-hi: rgba(255,255,255,0.12);
|
|
1676
|
+
--accent: #f97316;
|
|
1677
|
+
--accent-lo: rgba(249,115,22,0.08);
|
|
1678
|
+
--accent-md: rgba(249,115,22,0.18);
|
|
1679
|
+
--green: #22c55e;
|
|
1680
|
+
--green-lo: rgba(34,197,94,0.08);
|
|
1681
|
+
--red: #ef4444;
|
|
1682
|
+
--red-lo: rgba(239,68,68,0.08);
|
|
1683
|
+
--amber: #f59e0b;
|
|
1684
|
+
--blue: #38bdf8;
|
|
1685
|
+
--text-1: #f1f5f9;
|
|
1686
|
+
--text-2: #8b98a8;
|
|
1687
|
+
--text-3: #4b5563;
|
|
1688
|
+
--mono: 'DM Mono', monospace;
|
|
1689
|
+
--sans: 'Syne', sans-serif;
|
|
1690
|
+
--radius: 10px;
|
|
1691
|
+
--radius-lg: 16px;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
1695
|
+
|
|
1696
|
+
body {
|
|
1697
|
+
font-family: var(--sans);
|
|
1698
|
+
background: var(--bg);
|
|
1699
|
+
color: var(--text-1);
|
|
1700
|
+
min-height: 100vh;
|
|
1701
|
+
overflow-x: hidden;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
/* \u2500\u2500 Layout \u2500\u2500 */
|
|
1705
|
+
.shell {
|
|
1706
|
+
display: grid;
|
|
1707
|
+
grid-template-columns: 220px 1fr;
|
|
1708
|
+
grid-template-rows: 1fr;
|
|
1709
|
+
min-height: 100vh;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/* \u2500\u2500 Sidebar \u2500\u2500 */
|
|
1713
|
+
aside {
|
|
1714
|
+
background: var(--surface);
|
|
1715
|
+
border-right: 1px solid var(--border);
|
|
1716
|
+
display: flex;
|
|
1717
|
+
flex-direction: column;
|
|
1718
|
+
padding: 28px 0;
|
|
1719
|
+
position: sticky;
|
|
1720
|
+
top: 0;
|
|
1721
|
+
height: 100vh;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
.logo {
|
|
1725
|
+
display: flex;
|
|
1726
|
+
align-items: center;
|
|
1727
|
+
gap: 10px;
|
|
1728
|
+
padding: 0 24px 32px;
|
|
1729
|
+
border-bottom: 1px solid var(--border);
|
|
1730
|
+
margin-bottom: 12px;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
.logo-mark {
|
|
1734
|
+
width: 34px;
|
|
1735
|
+
height: 34px;
|
|
1736
|
+
background: var(--accent);
|
|
1737
|
+
border-radius: 8px;
|
|
1738
|
+
display: grid;
|
|
1739
|
+
place-items: center;
|
|
1740
|
+
font-size: 16px;
|
|
1741
|
+
flex-shrink: 0;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
.logo-name {
|
|
1745
|
+
font-family: var(--sans);
|
|
1746
|
+
font-weight: 800;
|
|
1747
|
+
font-size: 18px;
|
|
1748
|
+
letter-spacing: -0.5px;
|
|
1749
|
+
color: var(--text-1);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
.logo-version {
|
|
1753
|
+
font-family: var(--mono);
|
|
1754
|
+
font-size: 10px;
|
|
1755
|
+
color: var(--text-3);
|
|
1756
|
+
letter-spacing: 0.5px;
|
|
1757
|
+
margin-top: 2px;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
.nav-section {
|
|
1761
|
+
padding: 8px 12px;
|
|
1762
|
+
flex: 1;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
.nav-label {
|
|
1766
|
+
font-family: var(--mono);
|
|
1767
|
+
font-size: 10px;
|
|
1768
|
+
color: var(--text-3);
|
|
1769
|
+
letter-spacing: 1.5px;
|
|
1770
|
+
text-transform: uppercase;
|
|
1771
|
+
padding: 0 12px;
|
|
1772
|
+
margin: 16px 0 6px;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
.nav-item {
|
|
1776
|
+
display: flex;
|
|
1777
|
+
align-items: center;
|
|
1778
|
+
gap: 10px;
|
|
1779
|
+
padding: 9px 12px;
|
|
1780
|
+
border-radius: var(--radius);
|
|
1781
|
+
color: var(--text-2);
|
|
1782
|
+
text-decoration: none;
|
|
1783
|
+
font-size: 14px;
|
|
1784
|
+
font-weight: 600;
|
|
1785
|
+
transition: all 0.15s ease;
|
|
1786
|
+
cursor: pointer;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
.nav-item:hover { color: var(--text-1); background: var(--panel); }
|
|
1790
|
+
.nav-item.active { color: var(--accent); background: var(--accent-lo); }
|
|
1791
|
+
.nav-item .icon { font-size: 15px; width: 20px; text-align: center; }
|
|
1792
|
+
|
|
1793
|
+
.sidebar-footer {
|
|
1794
|
+
padding: 16px 24px;
|
|
1795
|
+
border-top: 1px solid var(--border);
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
.status-pill {
|
|
1799
|
+
display: flex;
|
|
1800
|
+
align-items: center;
|
|
1801
|
+
gap: 8px;
|
|
1802
|
+
font-family: var(--mono);
|
|
1803
|
+
font-size: 11px;
|
|
1804
|
+
color: var(--text-2);
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
.dot {
|
|
1808
|
+
width: 7px;
|
|
1809
|
+
height: 7px;
|
|
1810
|
+
border-radius: 50%;
|
|
1811
|
+
background: var(--green);
|
|
1812
|
+
box-shadow: 0 0 8px var(--green);
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
/* \u2500\u2500 Main \u2500\u2500 */
|
|
1816
|
+
main {
|
|
1817
|
+
display: flex;
|
|
1818
|
+
flex-direction: column;
|
|
1819
|
+
min-height: 100vh;
|
|
1820
|
+
overflow-y: auto;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
.topbar {
|
|
1824
|
+
display: flex;
|
|
1825
|
+
align-items: center;
|
|
1826
|
+
justify-content: space-between;
|
|
1827
|
+
padding: 20px 32px;
|
|
1828
|
+
border-bottom: 1px solid var(--border);
|
|
1829
|
+
background: var(--surface);
|
|
1830
|
+
position: sticky;
|
|
1831
|
+
top: 0;
|
|
1832
|
+
z-index: 10;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
.page-title {
|
|
1836
|
+
font-size: 15px;
|
|
1837
|
+
font-weight: 700;
|
|
1838
|
+
color: var(--text-1);
|
|
1839
|
+
letter-spacing: -0.2px;
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
.page-breadcrumb {
|
|
1843
|
+
font-family: var(--mono);
|
|
1844
|
+
font-size: 11px;
|
|
1845
|
+
color: var(--text-3);
|
|
1846
|
+
margin-top: 2px;
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
.topbar-actions {
|
|
1850
|
+
display: flex;
|
|
1851
|
+
align-items: center;
|
|
1852
|
+
gap: 12px;
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
.btn-sm {
|
|
1856
|
+
font-family: var(--sans);
|
|
1857
|
+
font-weight: 700;
|
|
1858
|
+
font-size: 12px;
|
|
1859
|
+
padding: 8px 16px;
|
|
1860
|
+
border-radius: 8px;
|
|
1861
|
+
border: none;
|
|
1862
|
+
cursor: pointer;
|
|
1863
|
+
transition: all 0.15s ease;
|
|
1864
|
+
letter-spacing: 0.2px;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
.btn-ghost {
|
|
1868
|
+
background: var(--panel);
|
|
1869
|
+
color: var(--text-2);
|
|
1870
|
+
border: 1px solid var(--border);
|
|
1871
|
+
}
|
|
1872
|
+
.btn-ghost:hover { border-color: var(--border-hi); color: var(--text-1); }
|
|
1873
|
+
|
|
1874
|
+
.btn-primary {
|
|
1875
|
+
background: var(--accent);
|
|
1876
|
+
color: #fff;
|
|
1877
|
+
}
|
|
1878
|
+
.btn-primary:hover { background: #ea580c; box-shadow: 0 0 20px rgba(249,115,22,0.35); }
|
|
1879
|
+
|
|
1880
|
+
/* \u2500\u2500 Content \u2500\u2500 */
|
|
1881
|
+
.content {
|
|
1882
|
+
padding: 28px 32px;
|
|
1883
|
+
display: flex;
|
|
1884
|
+
flex-direction: column;
|
|
1885
|
+
gap: 24px;
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
/* \u2500\u2500 Panel \u2500\u2500 */
|
|
1889
|
+
.panel {
|
|
1890
|
+
background: var(--panel);
|
|
1891
|
+
border: 1px solid var(--border);
|
|
1892
|
+
border-radius: var(--radius-lg);
|
|
1893
|
+
overflow: hidden;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
.panel-head {
|
|
1897
|
+
display: flex;
|
|
1898
|
+
align-items: center;
|
|
1899
|
+
justify-content: space-between;
|
|
1900
|
+
padding: 18px 24px;
|
|
1901
|
+
border-bottom: 1px solid var(--border);
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
.panel-title {
|
|
1905
|
+
font-size: 13px;
|
|
1906
|
+
font-weight: 700;
|
|
1907
|
+
color: var(--text-1);
|
|
1908
|
+
letter-spacing: -0.1px;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
.panel-body {
|
|
1912
|
+
padding: 24px;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
/* \u2500\u2500 Form \u2500\u2500 */
|
|
1916
|
+
.form-grid {
|
|
1917
|
+
display: grid;
|
|
1918
|
+
gap: 20px;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
.form-section {
|
|
1922
|
+
display: flex;
|
|
1923
|
+
flex-direction: column;
|
|
1924
|
+
gap: 16px;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
.form-section-title {
|
|
1928
|
+
font-size: 12px;
|
|
1929
|
+
font-weight: 700;
|
|
1930
|
+
color: var(--text-2);
|
|
1931
|
+
text-transform: uppercase;
|
|
1932
|
+
letter-spacing: 1px;
|
|
1933
|
+
margin-bottom: 8px;
|
|
1934
|
+
padding-bottom: 8px;
|
|
1935
|
+
border-bottom: 1px solid var(--border);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
.form-row {
|
|
1939
|
+
display: grid;
|
|
1940
|
+
grid-template-columns: 1fr 1fr;
|
|
1941
|
+
gap: 16px;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
.form-field {
|
|
1945
|
+
display: flex;
|
|
1946
|
+
flex-direction: column;
|
|
1947
|
+
gap: 6px;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
.form-field.full {
|
|
1951
|
+
grid-column: 1 / -1;
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
label {
|
|
1955
|
+
font-family: var(--mono);
|
|
1956
|
+
font-size: 11px;
|
|
1957
|
+
color: var(--text-3);
|
|
1958
|
+
text-transform: uppercase;
|
|
1959
|
+
letter-spacing: 0.5px;
|
|
1960
|
+
font-weight: 500;
|
|
1961
|
+
}
|
|
1962
|
+
|
|
1963
|
+
input, select {
|
|
1964
|
+
background: var(--surface);
|
|
1965
|
+
border: 1px solid var(--border);
|
|
1966
|
+
color: var(--text-1);
|
|
1967
|
+
padding: 10px 14px;
|
|
1968
|
+
border-radius: var(--radius);
|
|
1969
|
+
font-family: var(--mono);
|
|
1970
|
+
font-size: 12px;
|
|
1971
|
+
transition: all 0.15s ease;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
input:focus, select:focus {
|
|
1975
|
+
outline: none;
|
|
1976
|
+
border-color: var(--accent);
|
|
1977
|
+
box-shadow: 0 0 0 1px var(--accent);
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
input[type="checkbox"] {
|
|
1981
|
+
width: 16px;
|
|
1982
|
+
height: 16px;
|
|
1983
|
+
margin: 0;
|
|
1984
|
+
cursor: pointer;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
.checkbox-label {
|
|
1988
|
+
display: flex;
|
|
1989
|
+
align-items: center;
|
|
1990
|
+
gap: 8px;
|
|
1991
|
+
cursor: pointer;
|
|
1992
|
+
font-size: 12px;
|
|
1993
|
+
color: var(--text-2);
|
|
1994
|
+
text-transform: none;
|
|
1995
|
+
letter-spacing: normal;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
/* \u2500\u2500 Actions \u2500\u2500 */
|
|
1999
|
+
.actions {
|
|
2000
|
+
display: flex;
|
|
2001
|
+
gap: 12px;
|
|
2002
|
+
padding: 20px 24px;
|
|
2003
|
+
background: var(--surface);
|
|
2004
|
+
border-top: 1px solid var(--border);
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
.message {
|
|
2008
|
+
font-family: var(--mono);
|
|
2009
|
+
font-size: 11px;
|
|
2010
|
+
padding: 8px 12px;
|
|
2011
|
+
border-radius: var(--radius);
|
|
2012
|
+
margin-left: auto;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
.message.success {
|
|
2016
|
+
background: var(--green-lo);
|
|
2017
|
+
color: var(--green);
|
|
2018
|
+
border: 1px solid rgba(34,197,94,0.2);
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
.message.error {
|
|
2022
|
+
background: var(--red-lo);
|
|
2023
|
+
color: var(--red);
|
|
2024
|
+
border: 1px solid rgba(239,68,68,0.2);
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
/* \u2500\u2500 Code Block \u2500\u2500 */
|
|
2028
|
+
.code-block {
|
|
2029
|
+
background: var(--surface);
|
|
2030
|
+
border: 1px solid var(--border);
|
|
2031
|
+
border-radius: var(--radius);
|
|
2032
|
+
padding: 20px;
|
|
2033
|
+
font-family: var(--mono);
|
|
2034
|
+
font-size: 11px;
|
|
2035
|
+
color: var(--text-2);
|
|
2036
|
+
overflow-x: auto;
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
.code-block pre {
|
|
2040
|
+
margin: 0;
|
|
2041
|
+
line-height: 1.6;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
/* \u2500\u2500 Responsive \u2500\u2500 */
|
|
2045
|
+
@media (max-width: 900px) {
|
|
2046
|
+
.shell { grid-template-columns: 1fr; }
|
|
2047
|
+
aside { display: none; }
|
|
2048
|
+
.form-row { grid-template-columns: 1fr; }
|
|
2049
|
+
}
|
|
2050
|
+
</style>
|
|
2051
|
+
</head>
|
|
2052
|
+
<body>
|
|
2053
|
+
|
|
2054
|
+
<div class="shell">
|
|
2055
|
+
|
|
2056
|
+
<!-- \u2500\u2500 Sidebar \u2500\u2500 -->
|
|
2057
|
+
<aside>
|
|
2058
|
+
<div class="logo">
|
|
2059
|
+
<div class="logo-mark">\u2699</div>
|
|
2060
|
+
<div>
|
|
2061
|
+
<div class="logo-name">OpenQA</div>
|
|
2062
|
+
<div class="logo-version">v2.1.0 \xB7 OSS</div>
|
|
2063
|
+
</div>
|
|
2064
|
+
</div>
|
|
2065
|
+
|
|
2066
|
+
<div class="nav-section">
|
|
2067
|
+
<div class="nav-label">Overview</div>
|
|
2068
|
+
<a class="nav-item" href="/">
|
|
2069
|
+
<span class="icon">\u25A6</span> Dashboard
|
|
2070
|
+
</a>
|
|
2071
|
+
<a class="nav-item" href="/kanban">
|
|
2072
|
+
<span class="icon">\u229E</span> Kanban
|
|
2073
|
+
</a>
|
|
2074
|
+
|
|
2075
|
+
<div class="nav-label">System</div>
|
|
2076
|
+
<a class="nav-item active" href="/config">
|
|
2077
|
+
<span class="icon">\u2699</span> Configuration
|
|
2078
|
+
</a>
|
|
2079
|
+
</div>
|
|
2080
|
+
|
|
2081
|
+
<div class="sidebar-footer">
|
|
2082
|
+
<div class="status-pill">
|
|
2083
|
+
<div class="dot"></div>
|
|
2084
|
+
<span>System Ready</span>
|
|
2085
|
+
</div>
|
|
2086
|
+
</div>
|
|
2087
|
+
</aside>
|
|
2088
|
+
|
|
2089
|
+
<!-- \u2500\u2500 Main \u2500\u2500 -->
|
|
2090
|
+
<main>
|
|
2091
|
+
|
|
2092
|
+
<!-- Topbar -->
|
|
2093
|
+
<div class="topbar">
|
|
2094
|
+
<div>
|
|
2095
|
+
<div class="page-title">Configuration</div>
|
|
2096
|
+
<div class="page-breadcrumb">openqa / system / settings</div>
|
|
2097
|
+
</div>
|
|
2098
|
+
<div class="topbar-actions">
|
|
2099
|
+
<button class="btn-sm btn-ghost">Export Config</button>
|
|
2100
|
+
<button class="btn-sm btn-ghost">Import Config</button>
|
|
2101
|
+
<button class="btn-sm btn-primary" onclick="saveAllConfig()">Save All</button>
|
|
2102
|
+
</div>
|
|
2103
|
+
</div>
|
|
2104
|
+
|
|
2105
|
+
<!-- Content -->
|
|
2106
|
+
<div class="content">
|
|
2107
|
+
|
|
2108
|
+
<!-- SaaS Configuration -->
|
|
2109
|
+
<div class="panel">
|
|
2110
|
+
<div class="panel-head">
|
|
2111
|
+
<span class="panel-title">\u{1F310} SaaS Target Configuration</span>
|
|
2112
|
+
</div>
|
|
2113
|
+
<div class="panel-body">
|
|
2114
|
+
<form class="form-grid" id="saas-form">
|
|
2115
|
+
<div class="form-section">
|
|
2116
|
+
<div class="form-section-title">Target Application</div>
|
|
2117
|
+
<div class="form-field full">
|
|
2118
|
+
<label>Application URL</label>
|
|
2119
|
+
<input type="url" id="saas_url" name="saas.url" value="${cfg2.saas.url || ""}" placeholder="https://your-app.com">
|
|
1665
2120
|
</div>
|
|
1666
|
-
<div class="
|
|
1667
|
-
<
|
|
1668
|
-
|
|
2121
|
+
<div class="form-row">
|
|
2122
|
+
<div class="form-field">
|
|
2123
|
+
<label>Authentication Type</label>
|
|
2124
|
+
<select id="saas_authType" name="saas.authType">
|
|
2125
|
+
<option value="none" ${cfg2.saas.authType === "none" ? "selected" : ""}>None</option>
|
|
2126
|
+
<option value="basic" ${cfg2.saas.authType === "basic" ? "selected" : ""}>Basic Auth</option>
|
|
2127
|
+
<option value="bearer" ${cfg2.saas.authType === "bearer" ? "selected" : ""}>Bearer Token</option>
|
|
2128
|
+
<option value="session" ${cfg2.saas.authType === "session" ? "selected" : ""}>Session</option>
|
|
2129
|
+
</select>
|
|
2130
|
+
</div>
|
|
2131
|
+
<div class="form-field">
|
|
2132
|
+
<label>Timeout (seconds)</label>
|
|
2133
|
+
<input type="number" id="saas_timeout" name="saas.timeout" value="30" min="5" max="300">
|
|
2134
|
+
</div>
|
|
1669
2135
|
</div>
|
|
1670
|
-
<div class="
|
|
1671
|
-
<
|
|
1672
|
-
|
|
2136
|
+
<div class="form-row">
|
|
2137
|
+
<div class="form-field">
|
|
2138
|
+
<label>Username</label>
|
|
2139
|
+
<input type="text" id="saas_username" name="saas.username" value="${cfg2.saas.username || ""}" placeholder="username">
|
|
2140
|
+
</div>
|
|
2141
|
+
<div class="form-field">
|
|
2142
|
+
<label>Password</label>
|
|
2143
|
+
<input type="password" id="saas_password" name="saas.password" value="${cfg2.saas.password || ""}" placeholder="password">
|
|
2144
|
+
</div>
|
|
1673
2145
|
</div>
|
|
1674
|
-
</
|
|
1675
|
-
</
|
|
2146
|
+
</div>
|
|
2147
|
+
</form>
|
|
2148
|
+
</div>
|
|
2149
|
+
</div>
|
|
1676
2150
|
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
2151
|
+
<!-- LLM Configuration -->
|
|
2152
|
+
<div class="panel">
|
|
2153
|
+
<div class="panel-head">
|
|
2154
|
+
<span class="panel-title">\u{1F916} LLM Configuration</span>
|
|
2155
|
+
</div>
|
|
2156
|
+
<div class="panel-body">
|
|
2157
|
+
<form class="form-grid" id="llm-form">
|
|
2158
|
+
<div class="form-section">
|
|
2159
|
+
<div class="form-section-title">Language Model Provider</div>
|
|
2160
|
+
<div class="form-row">
|
|
2161
|
+
<div class="form-field">
|
|
2162
|
+
<label>Provider</label>
|
|
2163
|
+
<select id="llm_provider" name="llm.provider">
|
|
2164
|
+
<option value="openai" ${cfg2.llm.provider === "openai" ? "selected" : ""}>OpenAI</option>
|
|
2165
|
+
<option value="anthropic" ${cfg2.llm.provider === "anthropic" ? "selected" : ""}>Anthropic</option>
|
|
2166
|
+
<option value="ollama" ${cfg2.llm.provider === "ollama" ? "selected" : ""}>Ollama</option>
|
|
2167
|
+
</select>
|
|
2168
|
+
</div>
|
|
2169
|
+
<div class="form-field">
|
|
2170
|
+
<label>Model</label>
|
|
2171
|
+
<input type="text" id="llm_model" name="llm.model" value="${cfg2.llm.model || ""}" placeholder="gpt-4, claude-3-sonnet, etc.">
|
|
2172
|
+
</div>
|
|
1691
2173
|
</div>
|
|
1692
|
-
<div class="
|
|
2174
|
+
<div class="form-field full">
|
|
1693
2175
|
<label>API Key</label>
|
|
1694
|
-
<input type="password" id="llm_apiKey" name="llm.apiKey" value="${
|
|
2176
|
+
<input type="password" id="llm_apiKey" name="llm.apiKey" value="${cfg2.llm.apiKey || ""}" placeholder="Your API key">
|
|
1695
2177
|
</div>
|
|
1696
|
-
<div class="
|
|
2178
|
+
<div class="form-field full">
|
|
1697
2179
|
<label>Base URL (for Ollama)</label>
|
|
1698
|
-
<input type="url" id="llm_baseUrl" name="llm.baseUrl" value="${
|
|
2180
|
+
<input type="url" id="llm_baseUrl" name="llm.baseUrl" value="${cfg2.llm.baseUrl || ""}" placeholder="http://localhost:11434">
|
|
1699
2181
|
</div>
|
|
1700
|
-
</
|
|
1701
|
-
</
|
|
2182
|
+
</div>
|
|
2183
|
+
</form>
|
|
2184
|
+
</div>
|
|
2185
|
+
</div>
|
|
1702
2186
|
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
2187
|
+
<!-- Agent Configuration -->
|
|
2188
|
+
<div class="panel">
|
|
2189
|
+
<div class="panel-head">
|
|
2190
|
+
<span class="panel-title">\u{1F3AF} Agent Settings</span>
|
|
2191
|
+
</div>
|
|
2192
|
+
<div class="panel-body">
|
|
2193
|
+
<form class="form-grid" id="agent-form">
|
|
2194
|
+
<div class="form-section">
|
|
2195
|
+
<div class="form-section-title">Agent Behavior</div>
|
|
2196
|
+
<div class="form-field">
|
|
2197
|
+
<label class="checkbox-label">
|
|
2198
|
+
<input type="checkbox" id="agent_autoStart" name="agent.autoStart" ${cfg2.agent.autoStart ? "checked" : ""}>
|
|
2199
|
+
Auto-start on launch
|
|
1710
2200
|
</label>
|
|
1711
2201
|
</div>
|
|
1712
|
-
<div class="
|
|
1713
|
-
<
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
<
|
|
1718
|
-
|
|
2202
|
+
<div class="form-row">
|
|
2203
|
+
<div class="form-field">
|
|
2204
|
+
<label>Check Interval (ms)</label>
|
|
2205
|
+
<input type="number" id="agent_intervalMs" name="agent.intervalMs" value="${cfg2.agent.intervalMs}" min="60000" step="60000">
|
|
2206
|
+
</div>
|
|
2207
|
+
<div class="form-field">
|
|
2208
|
+
<label>Max Iterations</label>
|
|
2209
|
+
<input type="number" id="agent_maxIterations" name="agent.maxIterations" value="${cfg2.agent.maxIterations}" min="1" max="100">
|
|
2210
|
+
</div>
|
|
1719
2211
|
</div>
|
|
1720
|
-
</
|
|
1721
|
-
</
|
|
2212
|
+
</div>
|
|
2213
|
+
</form>
|
|
2214
|
+
</div>
|
|
2215
|
+
</div>
|
|
1722
2216
|
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
2217
|
+
<!-- Environment Variables -->
|
|
2218
|
+
<div class="panel">
|
|
2219
|
+
<div class="panel-head">
|
|
2220
|
+
<span class="panel-title">\u{1F4DD} Environment Variables</span>
|
|
2221
|
+
</div>
|
|
2222
|
+
<div class="panel-body">
|
|
2223
|
+
<p style="color: var(--text-3); font-size: 12px; margin-bottom: 16px;">
|
|
2224
|
+
You can also set these environment variables before starting OpenQA:
|
|
2225
|
+
</p>
|
|
2226
|
+
<div class="code-block">
|
|
2227
|
+
<pre>export SAAS_URL="https://your-app.com"
|
|
2228
|
+
export SAAS_AUTH_TYPE="basic"
|
|
2229
|
+
export SAAS_USERNAME="admin"
|
|
2230
|
+
export SAAS_PASSWORD="secret"
|
|
2231
|
+
|
|
2232
|
+
export LLM_PROVIDER="openai"
|
|
2233
|
+
export OPENAI_API_KEY="your-openai-key"
|
|
2234
|
+
export LLM_MODEL="gpt-4"
|
|
1729
2235
|
|
|
1730
|
-
<div class="section">
|
|
1731
|
-
<h2>Environment Variables</h2>
|
|
1732
|
-
<p>You can also set these environment variables before starting OpenQA:</p>
|
|
1733
|
-
<pre style="background: #334155; padding: 15px; border-radius: 6px; overflow-x: auto;"><code>export SAAS_URL="https://your-app.com"
|
|
1734
2236
|
export AGENT_AUTO_START=true
|
|
1735
|
-
export
|
|
1736
|
-
export
|
|
2237
|
+
export AGENT_INTERVAL_MS=3600000
|
|
2238
|
+
export AGENT_MAX_ITERATIONS=20
|
|
1737
2239
|
|
|
1738
|
-
openqa start</
|
|
2240
|
+
openqa start</pre>
|
|
1739
2241
|
</div>
|
|
2242
|
+
</div>
|
|
2243
|
+
</div>
|
|
1740
2244
|
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
2245
|
+
<!-- Actions -->
|
|
2246
|
+
<div class="actions">
|
|
2247
|
+
<button class="btn-sm btn-ghost" onclick="testConnection()">Test Connection</button>
|
|
2248
|
+
<button class="btn-sm btn-ghost" onclick="exportConfig()">Export Config</button>
|
|
2249
|
+
<button class="btn-sm btn-ghost" onclick="resetConfig()">Reset to Defaults</button>
|
|
2250
|
+
<div id="message"></div>
|
|
2251
|
+
</div>
|
|
2252
|
+
|
|
2253
|
+
</div><!-- /content -->
|
|
2254
|
+
</main>
|
|
2255
|
+
</div><!-- /shell -->
|
|
2256
|
+
|
|
2257
|
+
<script>
|
|
2258
|
+
async function saveAllConfig() {
|
|
2259
|
+
const forms = ['saas-form', 'llm-form', 'agent-form'];
|
|
2260
|
+
const config = {};
|
|
2261
|
+
|
|
2262
|
+
for (const formId of forms) {
|
|
2263
|
+
const form = document.getElementById(formId);
|
|
2264
|
+
const formData = new FormData(form);
|
|
2265
|
+
|
|
2266
|
+
for (let [key, value] of formData.entries()) {
|
|
2267
|
+
if (value === '') continue;
|
|
2268
|
+
|
|
2269
|
+
// Handle nested keys like "saas.url"
|
|
2270
|
+
const keys = key.split('.');
|
|
2271
|
+
let obj = config;
|
|
2272
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
2273
|
+
if (!obj[keys[i]]) obj[keys[i]] = {};
|
|
2274
|
+
obj = obj[keys[i]];
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
// Convert checkbox values to boolean
|
|
2278
|
+
if (key.includes('autoStart')) {
|
|
2279
|
+
obj[keys[keys.length - 1]] = value === 'on';
|
|
2280
|
+
} else if (key.includes('intervalMs') || key.includes('maxIterations') || key.includes('timeout')) {
|
|
2281
|
+
obj[keys[keys.length - 1]] = parseInt(value);
|
|
2282
|
+
} else {
|
|
2283
|
+
obj[keys[keys.length - 1]] = value;
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
try {
|
|
2289
|
+
const response = await fetch('/api/config', {
|
|
2290
|
+
method: 'POST',
|
|
2291
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2292
|
+
body: JSON.stringify(config)
|
|
2293
|
+
});
|
|
2294
|
+
|
|
2295
|
+
if (response.ok) {
|
|
2296
|
+
showMessage('Configuration saved successfully!', 'success');
|
|
2297
|
+
} else {
|
|
2298
|
+
showMessage('Failed to save configuration', 'error');
|
|
2299
|
+
}
|
|
2300
|
+
} catch (error) {
|
|
2301
|
+
showMessage('Error: ' + error.message, 'error');
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
async function testConnection() {
|
|
2306
|
+
showMessage('Testing connection...', 'success');
|
|
2307
|
+
|
|
2308
|
+
try {
|
|
2309
|
+
const response = await fetch('/api/test-connection', { method: 'POST' });
|
|
2310
|
+
|
|
2311
|
+
if (response.ok) {
|
|
2312
|
+
showMessage('Connection successful!', 'success');
|
|
2313
|
+
} else {
|
|
2314
|
+
showMessage('Connection failed', 'error');
|
|
2315
|
+
}
|
|
2316
|
+
} catch (error) {
|
|
2317
|
+
showMessage('Connection error: ' + error.message, 'error');
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
async function exportConfig() {
|
|
2322
|
+
try {
|
|
2323
|
+
const response = await fetch('/api/config');
|
|
2324
|
+
const config = await response.json();
|
|
2325
|
+
|
|
2326
|
+
const blob = new Blob([JSON.stringify(config, null, 2)], { type: 'application/json' });
|
|
2327
|
+
const url = URL.createObjectURL(blob);
|
|
2328
|
+
const a = document.createElement('a');
|
|
2329
|
+
a.href = url;
|
|
2330
|
+
a.download = 'openqa-config.json';
|
|
2331
|
+
a.click();
|
|
2332
|
+
URL.revokeObjectURL(url);
|
|
2333
|
+
|
|
2334
|
+
showMessage('Configuration exported', 'success');
|
|
2335
|
+
} catch (error) {
|
|
2336
|
+
showMessage('Export failed: ' + error.message, 'error');
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
async function resetConfig() {
|
|
2341
|
+
if (confirm('Are you sure you want to reset all configuration to defaults? This cannot be undone.')) {
|
|
2342
|
+
try {
|
|
2343
|
+
const response = await fetch('/api/config/reset', { method: 'POST' });
|
|
2344
|
+
|
|
2345
|
+
if (response.ok) {
|
|
2346
|
+
location.reload();
|
|
2347
|
+
} else {
|
|
2348
|
+
showMessage('Failed to reset configuration', 'error');
|
|
2349
|
+
}
|
|
2350
|
+
} catch (error) {
|
|
2351
|
+
showMessage('Error: ' + error.message, 'error');
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
function showMessage(msg, type) {
|
|
2357
|
+
const el = document.getElementById('message');
|
|
2358
|
+
el.textContent = msg;
|
|
2359
|
+
el.className = 'message ' + type;
|
|
2360
|
+
setTimeout(() => { el.textContent = ''; el.className = ''; }, 5000);
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
// Auto-save on field change
|
|
2364
|
+
document.querySelectorAll('input, select').forEach(field => {
|
|
2365
|
+
field.addEventListener('change', () => {
|
|
2366
|
+
showMessage('Changes made - click "Save All" to apply', 'success');
|
|
2367
|
+
});
|
|
2368
|
+
});
|
|
2369
|
+
</script>
|
|
2370
|
+
|
|
2371
|
+
</body>
|
|
2372
|
+
</html>
|
|
1814
2373
|
`);
|
|
1815
2374
|
});
|
|
1816
2375
|
const server = app.listen(cfg.web.port, cfg.web.host, () => {
|
|
@@ -1839,39 +2398,86 @@ openqa start</code></pre>
|
|
|
1839
2398
|
}
|
|
1840
2399
|
});
|
|
1841
2400
|
}
|
|
1842
|
-
wss.on("connection", (ws) => {
|
|
2401
|
+
wss.on("connection", async (ws) => {
|
|
1843
2402
|
console.log("WebSocket client connected");
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
];
|
|
2403
|
+
try {
|
|
2404
|
+
const sessions = await db.getRecentSessions(1);
|
|
2405
|
+
const currentSession = sessions[0];
|
|
2406
|
+
const agents = await db.getActiveAgents();
|
|
2407
|
+
const tasks = await db.getCurrentTasks();
|
|
2408
|
+
const issues = await db.getCurrentIssues();
|
|
2409
|
+
ws.send(JSON.stringify({
|
|
2410
|
+
type: "status",
|
|
2411
|
+
data: {
|
|
2412
|
+
isRunning: currentSession?.status === "running" || false,
|
|
2413
|
+
target: cfg.saas.url || "Not configured",
|
|
2414
|
+
sessionId: currentSession?.id || null
|
|
2415
|
+
}
|
|
2416
|
+
}));
|
|
2417
|
+
ws.send(JSON.stringify({
|
|
2418
|
+
type: "agents",
|
|
2419
|
+
data: agents
|
|
2420
|
+
}));
|
|
2421
|
+
if (currentSession) {
|
|
1864
2422
|
ws.send(JSON.stringify({
|
|
1865
|
-
type: "
|
|
1866
|
-
data:
|
|
2423
|
+
type: "session",
|
|
2424
|
+
data: {
|
|
2425
|
+
active_agents: agents.length,
|
|
2426
|
+
total_actions: currentSession.total_actions || 0,
|
|
2427
|
+
bugs_found: currentSession.bugs_found || 0,
|
|
2428
|
+
success_rate: currentSession.total_actions > 0 ? Math.round((currentSession.total_actions - (currentSession.bugs_found || 0)) / currentSession.total_actions * 100) : 0,
|
|
2429
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2430
|
+
agents,
|
|
2431
|
+
tasks,
|
|
2432
|
+
issues
|
|
2433
|
+
}
|
|
1867
2434
|
}));
|
|
1868
|
-
activityCount++;
|
|
1869
2435
|
}
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
2436
|
+
ws.send(JSON.stringify({
|
|
2437
|
+
type: "tasks",
|
|
2438
|
+
data: tasks
|
|
2439
|
+
}));
|
|
2440
|
+
ws.send(JSON.stringify({
|
|
2441
|
+
type: "issues",
|
|
2442
|
+
data: issues
|
|
2443
|
+
}));
|
|
2444
|
+
let activityCount = 0;
|
|
2445
|
+
const activityInterval = setInterval(async () => {
|
|
2446
|
+
if (ws.readyState === ws.OPEN) {
|
|
2447
|
+
const freshSessions = await db.getRecentSessions(1);
|
|
2448
|
+
const freshSession = freshSessions[0];
|
|
2449
|
+
if (freshSession) {
|
|
2450
|
+
const activities = [
|
|
2451
|
+
{ type: "info", message: `\u{1F50D} Session ${freshSession.id} - Analyzing application`, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
|
|
2452
|
+
{ type: "success", message: `\u2705 Completed ${freshSession.total_actions || 0} test actions`, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
|
|
2453
|
+
{ type: "warning", message: `\u26A0\uFE0F Found ${freshSession.bugs_found || 0} issues to review`, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
|
|
2454
|
+
{ type: "info", message: `\u{1F9EA} Success rate: ${freshSession.total_actions > 0 ? Math.round((freshSession.total_actions - (freshSession.bugs_found || 0)) / freshSession.total_actions * 100) : 0}%`, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
|
|
2455
|
+
{ type: "success", message: `\u2705 ${agents.filter((a) => a.status === "running").length} agents active`, timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
2456
|
+
];
|
|
2457
|
+
ws.send(JSON.stringify({
|
|
2458
|
+
type: "activity",
|
|
2459
|
+
data: activities[activityCount % activities.length]
|
|
2460
|
+
}));
|
|
2461
|
+
} else {
|
|
2462
|
+
ws.send(JSON.stringify({
|
|
2463
|
+
type: "activity",
|
|
2464
|
+
data: { type: "info", message: "\u{1F504} Waiting for session to start...", timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
2465
|
+
}));
|
|
2466
|
+
}
|
|
2467
|
+
activityCount++;
|
|
2468
|
+
}
|
|
2469
|
+
}, 8e3);
|
|
2470
|
+
ws.on("close", () => {
|
|
2471
|
+
console.log("WebSocket client disconnected");
|
|
2472
|
+
clearInterval(activityInterval);
|
|
2473
|
+
});
|
|
2474
|
+
} catch (error) {
|
|
2475
|
+
console.error("Error setting up WebSocket:", error);
|
|
2476
|
+
ws.send(JSON.stringify({
|
|
2477
|
+
type: "error",
|
|
2478
|
+
data: { message: "Failed to load initial data" }
|
|
2479
|
+
}));
|
|
2480
|
+
}
|
|
1875
2481
|
});
|
|
1876
2482
|
process.on("SIGTERM", () => {
|
|
1877
2483
|
console.log("Received SIGTERM, shutting down gracefully...");
|