myaiforone 1.1.25 → 1.1.26
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 +43 -202
- package/dist/web-ui.js.map +1 -1
- package/package.json +1 -1
- package/public/index.html +8 -6
- package/src/web-ui.ts +41 -205
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,CA4oLnD"}
|
package/dist/web-ui.js
CHANGED
|
@@ -26,11 +26,26 @@ export function startWebUI(opts) {
|
|
|
26
26
|
const app = express();
|
|
27
27
|
app.use(express.json());
|
|
28
28
|
// ─── Serve static assets (SVGs, images, etc.) from public/ ─────
|
|
29
|
-
|
|
29
|
+
const publicDir = join(opts.baseDir, "public");
|
|
30
|
+
app.use(express.static(publicDir, {
|
|
30
31
|
maxAge: "1h",
|
|
31
32
|
index: false,
|
|
32
33
|
extensions: ["svg", "png", "ico", "jpg", "jpeg", "gif", "webp", "js", "css"],
|
|
33
34
|
}));
|
|
35
|
+
// Helper: serve an HTML page from public/ using root-relative path
|
|
36
|
+
// (avoids sendFile symlink/realpath issues on macOS npx cache)
|
|
37
|
+
const servePage = (res, filename, fallback = "/org") => {
|
|
38
|
+
if (existsSync(join(publicDir, filename))) {
|
|
39
|
+
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
40
|
+
res.sendFile(filename, { root: publicDir }, (err) => {
|
|
41
|
+
if (err && !res.headersSent)
|
|
42
|
+
res.redirect(fallback);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
res.redirect(fallback);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
34
49
|
// ─── Mount Gym API routes (gated by gymEnabled in the router) ────
|
|
35
50
|
if (opts.config.service.gymEnabled) {
|
|
36
51
|
const gymAgent = opts.config.agents?.gym;
|
|
@@ -43,192 +58,28 @@ export function startWebUI(opts) {
|
|
|
43
58
|
userProgramsDir: gymUserProgramsDir,
|
|
44
59
|
}));
|
|
45
60
|
}
|
|
46
|
-
// ─── Serve
|
|
47
|
-
const serveHome = (_req, res) =>
|
|
48
|
-
const htmlPath = join(opts.baseDir, "public", "home2.html");
|
|
49
|
-
if (existsSync(htmlPath)) {
|
|
50
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
51
|
-
res.sendFile(htmlPath);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
res.redirect("/org");
|
|
55
|
-
}
|
|
56
|
-
};
|
|
61
|
+
// ─── Serve pages from public/ ─────────────────────────────────────
|
|
62
|
+
const serveHome = (_req, res) => servePage(res, "home2.html", "/org");
|
|
57
63
|
app.get("/", serveHome);
|
|
58
64
|
app.get("/home", serveHome);
|
|
59
|
-
|
|
60
|
-
app.get("/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
app.get("/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
else {
|
|
78
|
-
res.redirect("/");
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
// ─── Serve the Activity Logs page (redirects to admin) ──────────
|
|
82
|
-
app.get("/activity", (_req, res) => {
|
|
83
|
-
res.redirect("/admin?tab=activity");
|
|
84
|
-
});
|
|
85
|
-
// ─── Serve the UI HTML (no-cache to always get latest) ──────────
|
|
86
|
-
app.get("/ui", (_req, res) => {
|
|
87
|
-
const htmlPath = join(opts.baseDir, "public", "index.html");
|
|
88
|
-
if (existsSync(htmlPath)) {
|
|
89
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
90
|
-
res.sendFile(htmlPath);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
res.status(404).send("UI not found. Create public/index.html");
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
// ─── Serve the My Library page ──────────────────────────────────
|
|
97
|
-
app.get("/library", (_req, res) => {
|
|
98
|
-
const htmlPath = join(opts.baseDir, "public", "library.html");
|
|
99
|
-
if (existsSync(htmlPath)) {
|
|
100
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
101
|
-
res.sendFile(htmlPath);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
res.redirect("/marketplace");
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
// ─── Serve the Marketplace page ────────────────────────────────
|
|
108
|
-
app.get("/marketplace", (_req, res) => {
|
|
109
|
-
const htmlPath = join(opts.baseDir, "public", "marketplace.html");
|
|
110
|
-
if (existsSync(htmlPath)) {
|
|
111
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
112
|
-
res.sendFile(htmlPath);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
res.status(404).send("Marketplace page not found.");
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
// ─── Serve the Org page ────────────────────────────────────────
|
|
119
|
-
app.get("/org", (_req, res) => {
|
|
120
|
-
const htmlPath = join(opts.baseDir, "public", "org.html");
|
|
121
|
-
if (existsSync(htmlPath)) {
|
|
122
|
-
res.sendFile(htmlPath);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
res.status(404).send("Org page not found.");
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
// ─── Serve the Monitor page ────────────────────────────────────
|
|
129
|
-
app.get("/monitor", (_req, res) => {
|
|
130
|
-
const htmlPath = join(opts.baseDir, "public", "monitor.html");
|
|
131
|
-
if (existsSync(htmlPath)) {
|
|
132
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
133
|
-
res.sendFile(htmlPath);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
res.status(404).send("Monitor page not found.");
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
// ─── Serve the Admin page ──────────────────────────────────────
|
|
140
|
-
app.get("/admin", (_req, res) => {
|
|
141
|
-
const htmlPath = join(opts.baseDir, "public", "admin.html");
|
|
142
|
-
if (existsSync(htmlPath)) {
|
|
143
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
144
|
-
res.sendFile(htmlPath);
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
res.status(404).send("Admin page not found.");
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
// ─── Channels redirects to admin ───────────────────────────────
|
|
151
|
-
app.get("/channels", (_req, res) => {
|
|
152
|
-
res.redirect("/admin?tab=channels");
|
|
153
|
-
});
|
|
154
|
-
// ─── Serve the Tasks page ───────────────────────────────────────
|
|
155
|
-
app.get("/tasks", (_req, res) => {
|
|
156
|
-
const htmlPath = join(opts.baseDir, "public", "tasks.html");
|
|
157
|
-
if (existsSync(htmlPath)) {
|
|
158
|
-
res.sendFile(htmlPath);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
res.status(404).send("Tasks page not found.");
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
// ─── Serve the Projects page ──────────────────────────────────
|
|
165
|
-
app.get("/projects", (_req, res) => {
|
|
166
|
-
const htmlPath = join(opts.baseDir, "public", "projects.html");
|
|
167
|
-
if (existsSync(htmlPath)) {
|
|
168
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
169
|
-
res.sendFile(htmlPath);
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
res.status(404).send("Projects page not found.");
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
// ─── Serve the Lab page ──────────────────────────────────────────
|
|
176
|
-
app.get("/lab", (_req, res) => {
|
|
177
|
-
const htmlPath = join(opts.baseDir, "public", "lab.html");
|
|
178
|
-
if (existsSync(htmlPath)) {
|
|
179
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
180
|
-
res.sendFile(htmlPath);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
res.status(404).send("Lab page not found.");
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
// /gym route removed — AI Gym is now integrated into the home2 Work/AI Gym toggle
|
|
187
|
-
// /apps route removed — Apps are now managed in the Registry (marketplace) Apps tab
|
|
188
|
-
// ─── Serve the Agent Dashboard page ────────────────────────────
|
|
189
|
-
app.get("/agent-dashboard", (_req, res) => {
|
|
190
|
-
const htmlPath = join(opts.baseDir, "public", "agent-dashboard.html");
|
|
191
|
-
if (existsSync(htmlPath)) {
|
|
192
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
193
|
-
res.sendFile(htmlPath);
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
res.redirect("/org");
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
app.get("/mini", (_req, res) => {
|
|
200
|
-
const htmlPath = join(opts.baseDir, "public", "mini.html");
|
|
201
|
-
if (existsSync(htmlPath)) {
|
|
202
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
203
|
-
res.sendFile(htmlPath);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
res.status(404).send("Mini bar not found.");
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
app.get("/settings", (_req, res) => {
|
|
210
|
-
res.redirect("/admin?tab=settings");
|
|
211
|
-
});
|
|
212
|
-
app.get("/mcp-docs", (_req, res) => {
|
|
213
|
-
const htmlPath = join(opts.baseDir, "public", "mcp-docs.html");
|
|
214
|
-
if (existsSync(htmlPath)) {
|
|
215
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
216
|
-
res.sendFile(htmlPath);
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
res.status(404).send("MCP docs not found.");
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
app.get("/api-docs", (_req, res) => {
|
|
223
|
-
const htmlPath = join(opts.baseDir, "public", "api-docs.html");
|
|
224
|
-
if (existsSync(htmlPath)) {
|
|
225
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
226
|
-
res.sendFile(htmlPath);
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
res.status(404).send("API docs not found.");
|
|
230
|
-
}
|
|
231
|
-
});
|
|
65
|
+
app.get("/home-legacy", (_req, res) => servePage(res, "home.html", "/org"));
|
|
66
|
+
app.get("/home2", (_req, res) => servePage(res, "home2.html", "/"));
|
|
67
|
+
app.get("/activity", (_req, res) => res.redirect("/admin?tab=activity"));
|
|
68
|
+
app.get("/ui", (_req, res) => servePage(res, "index.html"));
|
|
69
|
+
app.get("/library", (_req, res) => servePage(res, "library.html", "/marketplace"));
|
|
70
|
+
app.get("/marketplace", (_req, res) => servePage(res, "marketplace.html"));
|
|
71
|
+
app.get("/org", (_req, res) => servePage(res, "org.html"));
|
|
72
|
+
app.get("/monitor", (_req, res) => servePage(res, "monitor.html"));
|
|
73
|
+
app.get("/admin", (_req, res) => servePage(res, "admin.html"));
|
|
74
|
+
app.get("/channels", (_req, res) => res.redirect("/admin?tab=channels"));
|
|
75
|
+
app.get("/tasks", (_req, res) => servePage(res, "tasks.html"));
|
|
76
|
+
app.get("/projects", (_req, res) => servePage(res, "projects.html"));
|
|
77
|
+
app.get("/lab", (_req, res) => servePage(res, "lab.html"));
|
|
78
|
+
app.get("/agent-dashboard", (_req, res) => servePage(res, "agent-dashboard.html", "/org"));
|
|
79
|
+
app.get("/mini", (_req, res) => servePage(res, "mini.html"));
|
|
80
|
+
app.get("/settings", (_req, res) => res.redirect("/admin?tab=settings"));
|
|
81
|
+
app.get("/mcp-docs", (_req, res) => servePage(res, "mcp-docs.html"));
|
|
82
|
+
app.get("/api-docs", (_req, res) => servePage(res, "api-docs.html"));
|
|
232
83
|
// ─── API: Open folder in Finder / Explorer ─────────────────────────
|
|
233
84
|
app.post("/api/open-folder", (req, res) => {
|
|
234
85
|
const { path: filePath } = req.body;
|
|
@@ -3763,16 +3614,7 @@ export function startWebUI(opts) {
|
|
|
3763
3614
|
}
|
|
3764
3615
|
});
|
|
3765
3616
|
// ─── Serve Automations page ───────────────────────────────────────
|
|
3766
|
-
app.get("/automations", (_req, res) =>
|
|
3767
|
-
const htmlPath = join(opts.baseDir, "public", "automations.html");
|
|
3768
|
-
if (existsSync(htmlPath)) {
|
|
3769
|
-
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
3770
|
-
res.sendFile(htmlPath);
|
|
3771
|
-
}
|
|
3772
|
-
else {
|
|
3773
|
-
res.redirect("/ui");
|
|
3774
|
-
}
|
|
3775
|
-
});
|
|
3617
|
+
app.get("/automations", (_req, res) => servePage(res, "automations.html", "/ui"));
|
|
3776
3618
|
// ─── Task helpers ──────────────────────────────────────────────────
|
|
3777
3619
|
const resolveTildeGlobal = (p) => {
|
|
3778
3620
|
const h = homedir();
|
|
@@ -5635,14 +5477,13 @@ Project context and credentials are at: ${projectDir}/context.md and ${projectDi
|
|
|
5635
5477
|
res.status(500).json({ error: e.message });
|
|
5636
5478
|
}
|
|
5637
5479
|
});
|
|
5638
|
-
app.get("/changelog", (_req, res) =>
|
|
5639
|
-
|
|
5640
|
-
});
|
|
5641
|
-
app.get("/user-guide", (_req, res) => {
|
|
5642
|
-
res.sendFile(resolve(opts.baseDir, "public", "user-guide.html"));
|
|
5643
|
-
});
|
|
5480
|
+
app.get("/changelog", (_req, res) => servePage(res, "changelog.html"));
|
|
5481
|
+
app.get("/user-guide", (_req, res) => servePage(res, "user-guide.html"));
|
|
5644
5482
|
app.get("/docs/user-guide.md", (_req, res) => {
|
|
5645
|
-
res.type("text/markdown").sendFile(
|
|
5483
|
+
res.type("text/markdown").sendFile("user-guide.md", { root: join(opts.baseDir, "docs") }, (err) => {
|
|
5484
|
+
if (err && !res.headersSent)
|
|
5485
|
+
res.status(404).send("User guide not found.");
|
|
5486
|
+
});
|
|
5646
5487
|
});
|
|
5647
5488
|
// ─── API: User Guide ────────────────────────────────────────────
|
|
5648
5489
|
app.get("/api/user-guide", (_req, res) => {
|