myaiforone 1.1.28 → 1.1.30
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/web-ui.d.ts.map +1 -1
- package/dist/web-ui.js +36 -13
- package/dist/web-ui.js.map +1 -1
- package/package.json +1 -1
- package/public/home2.html +205 -8
- package/public/index.html +180 -2
- package/public/lab.html +41 -4
- package/src/web-ui.ts +34 -13
package/dist/web-ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-ui.d.ts","sourceRoot":"","sources":["../src/web-ui.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAa7C,UAAU,YAAY;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,qBAAqB,EAAE,aAAa,CAAC,CAAC;CACtE;AAyBD,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"web-ui.d.ts","sourceRoot":"","sources":["../src/web-ui.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAa7C,UAAU,YAAY;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrG,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,qBAAqB,EAAE,aAAa,CAAC,CAAC;CACtE;AAyBD,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAoqLnD"}
|
package/dist/web-ui.js
CHANGED
|
@@ -32,20 +32,26 @@ export function startWebUI(opts) {
|
|
|
32
32
|
index: false,
|
|
33
33
|
extensions: ["svg", "png", "ico", "jpg", "jpeg", "gif", "webp", "js", "css"],
|
|
34
34
|
}));
|
|
35
|
-
// Helper: serve an HTML page from public/ using
|
|
36
|
-
//
|
|
37
|
-
//
|
|
35
|
+
// Helper: serve an HTML page from public/ using readFileSync + res.send
|
|
36
|
+
// Bypasses Express 5 send module's realpath resolution which fails on
|
|
37
|
+
// macOS npx cache symlinked paths. HTML files are small enough that
|
|
38
|
+
// readFileSync has no meaningful performance impact.
|
|
38
39
|
const servePage = (res, filename, fallback = null) => {
|
|
39
|
-
|
|
40
|
+
const filePath = join(publicDir, filename);
|
|
41
|
+
if (existsSync(filePath)) {
|
|
40
42
|
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
try {
|
|
44
|
+
const content = readFileSync(filePath, "utf8");
|
|
45
|
+
res.type("html").send(content);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
if (!res.headersSent) {
|
|
43
49
|
if (fallback)
|
|
44
50
|
res.redirect(fallback);
|
|
45
51
|
else
|
|
46
52
|
res.status(404).send(`${filename} not found.`);
|
|
47
53
|
}
|
|
48
|
-
}
|
|
54
|
+
}
|
|
49
55
|
}
|
|
50
56
|
else if (fallback) {
|
|
51
57
|
res.redirect(fallback);
|
|
@@ -2538,10 +2544,14 @@ export function startWebUI(opts) {
|
|
|
2538
2544
|
res.setHeader("Content-Disposition", `${isInline ? "inline" : "attachment"}; filename="${fileName}"`);
|
|
2539
2545
|
res.setHeader("Content-Type", contentTypes[ext] || "application/octet-stream");
|
|
2540
2546
|
log.info(`[Download] ${agentId}: ${fileName} from ${resolvedPath}`);
|
|
2541
|
-
|
|
2542
|
-
|
|
2547
|
+
try {
|
|
2548
|
+
const content = readFileSync(resolvedPath);
|
|
2549
|
+
res.send(content);
|
|
2550
|
+
}
|
|
2551
|
+
catch {
|
|
2552
|
+
if (!res.headersSent)
|
|
2543
2553
|
res.status(404).json({ error: "File send failed" });
|
|
2544
|
-
}
|
|
2554
|
+
}
|
|
2545
2555
|
});
|
|
2546
2556
|
// ─── API: Create agent ──────────────────────────────────────────
|
|
2547
2557
|
app.post("/api/agents", async (req, res) => {
|
|
@@ -5486,10 +5496,15 @@ Project context and credentials are at: ${projectDir}/context.md and ${projectDi
|
|
|
5486
5496
|
app.get("/changelog", (_req, res) => servePage(res, "changelog.html"));
|
|
5487
5497
|
app.get("/user-guide", (_req, res) => servePage(res, "user-guide.html"));
|
|
5488
5498
|
app.get("/docs/user-guide.md", (_req, res) => {
|
|
5489
|
-
|
|
5490
|
-
|
|
5499
|
+
const guidePath = join(opts.baseDir, "docs", "user-guide.md");
|
|
5500
|
+
try {
|
|
5501
|
+
const content = readFileSync(guidePath, "utf8");
|
|
5502
|
+
res.type("text/markdown").send(content);
|
|
5503
|
+
}
|
|
5504
|
+
catch {
|
|
5505
|
+
if (!res.headersSent)
|
|
5491
5506
|
res.status(404).send("User guide not found.");
|
|
5492
|
-
}
|
|
5507
|
+
}
|
|
5493
5508
|
});
|
|
5494
5509
|
// ─── API: User Guide ────────────────────────────────────────────
|
|
5495
5510
|
app.get("/api/user-guide", (_req, res) => {
|
|
@@ -5823,6 +5838,14 @@ Project context and credentials are at: ${projectDir}/context.md and ${projectDi
|
|
|
5823
5838
|
catch (err) {
|
|
5824
5839
|
log.warn(`[Registry Sync] Skill startup sync failed: ${err}`);
|
|
5825
5840
|
}
|
|
5841
|
+
// Global error handler — catch unhandled Express errors instead of
|
|
5842
|
+
// dumping raw stack traces to the browser
|
|
5843
|
+
app.use((err, _req, res, _next) => {
|
|
5844
|
+
log.warn(`[Web UI] Unhandled error: ${err.message}`);
|
|
5845
|
+
if (!res.headersSent) {
|
|
5846
|
+
res.status(err.status || 500).json({ error: err.message || "Internal server error" });
|
|
5847
|
+
}
|
|
5848
|
+
});
|
|
5826
5849
|
app.listen(opts.port, () => {
|
|
5827
5850
|
log.info(`Web UI running on http://localhost:${opts.port}/ui`);
|
|
5828
5851
|
// Start gym activity digest cron if gymEnabled
|