myaiforone 1.1.21 → 1.1.23
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 +76 -0
- package/dist/web-ui.js.map +1 -1
- package/package.json +1 -1
- package/public/admin.html +144 -1
- package/src/web-ui.ts +78 -0
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,CAgzLnD"}
|
package/dist/web-ui.js
CHANGED
|
@@ -5400,6 +5400,82 @@ Project context and credentials are at: ${projectDir}/context.md and ${projectDi
|
|
|
5400
5400
|
process.exit(0);
|
|
5401
5401
|
}, 500);
|
|
5402
5402
|
});
|
|
5403
|
+
// ─── API: Platform Updates ──────────────────────────────────────────
|
|
5404
|
+
// GET /api/version — current + latest version
|
|
5405
|
+
app.get("/api/version", async (_req, res) => {
|
|
5406
|
+
try {
|
|
5407
|
+
const pkgPath = join(opts.baseDir, "package.json");
|
|
5408
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
5409
|
+
const current = pkg.version || "unknown";
|
|
5410
|
+
// Fetch latest from npm registry
|
|
5411
|
+
let latest = current;
|
|
5412
|
+
let updateAvailable = false;
|
|
5413
|
+
try {
|
|
5414
|
+
const resp = await fetch("https://registry.npmjs.org/myaiforone/latest");
|
|
5415
|
+
if (resp.ok) {
|
|
5416
|
+
const data = await resp.json();
|
|
5417
|
+
latest = data.version || current;
|
|
5418
|
+
updateAvailable = latest !== current;
|
|
5419
|
+
}
|
|
5420
|
+
}
|
|
5421
|
+
catch { /* offline — just report current */ }
|
|
5422
|
+
res.json({ ok: true, current, latest, updateAvailable });
|
|
5423
|
+
}
|
|
5424
|
+
catch (e) {
|
|
5425
|
+
res.status(500).json({ error: e.message });
|
|
5426
|
+
}
|
|
5427
|
+
});
|
|
5428
|
+
// POST /api/update — clear npx cache and restart with latest version
|
|
5429
|
+
app.post("/api/update", async (_req, res) => {
|
|
5430
|
+
try {
|
|
5431
|
+
const platform = process.platform;
|
|
5432
|
+
log.info("[Update] Platform update triggered via API");
|
|
5433
|
+
// Clear npx cache for myaiforone
|
|
5434
|
+
if (platform === "win32") {
|
|
5435
|
+
const npxDir = join(process.env.LOCALAPPDATA || "", "npm-cache", "_npx");
|
|
5436
|
+
if (existsSync(npxDir)) {
|
|
5437
|
+
for (const d of readdirSync(npxDir)) {
|
|
5438
|
+
const candidate = join(npxDir, d, "node_modules", "myaiforone");
|
|
5439
|
+
if (existsSync(candidate)) {
|
|
5440
|
+
rmSync(join(npxDir, d), { recursive: true, force: true });
|
|
5441
|
+
log.info(`[Update] Cleared npx cache: ${d}`);
|
|
5442
|
+
}
|
|
5443
|
+
}
|
|
5444
|
+
}
|
|
5445
|
+
}
|
|
5446
|
+
else {
|
|
5447
|
+
// macOS/Linux: ~/.npm/_npx
|
|
5448
|
+
const home = process.env.HOME || "";
|
|
5449
|
+
const npxDir = join(home, ".npm", "_npx");
|
|
5450
|
+
if (existsSync(npxDir)) {
|
|
5451
|
+
for (const d of readdirSync(npxDir)) {
|
|
5452
|
+
const candidate = join(npxDir, d, "node_modules", "myaiforone");
|
|
5453
|
+
if (existsSync(candidate)) {
|
|
5454
|
+
rmSync(join(npxDir, d), { recursive: true, force: true });
|
|
5455
|
+
log.info(`[Update] Cleared npx cache: ${d}`);
|
|
5456
|
+
}
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
5459
|
+
}
|
|
5460
|
+
res.json({ ok: true, message: "Cache cleared. Restarting with latest version..." });
|
|
5461
|
+
// Respawn via npx to pull latest, then exit current process
|
|
5462
|
+
setTimeout(() => {
|
|
5463
|
+
log.info("[Update] Spawning npx myaiforone to pull latest...");
|
|
5464
|
+
const child = cpSpawn("npx", ["myaiforone"], {
|
|
5465
|
+
cwd: process.cwd(),
|
|
5466
|
+
env: { ...process.env },
|
|
5467
|
+
stdio: "ignore",
|
|
5468
|
+
detached: true,
|
|
5469
|
+
shell: true,
|
|
5470
|
+
});
|
|
5471
|
+
child.unref();
|
|
5472
|
+
process.exit(0);
|
|
5473
|
+
}, 1000);
|
|
5474
|
+
}
|
|
5475
|
+
catch (e) {
|
|
5476
|
+
res.status(500).json({ error: e.message });
|
|
5477
|
+
}
|
|
5478
|
+
});
|
|
5403
5479
|
// ─── API: Skills ────────────────────────────────────────────────────
|
|
5404
5480
|
// GET /api/agents/:agentId/skills — list all skills available to an agent
|
|
5405
5481
|
app.get("/api/agents/:agentId/skills", (req, res) => {
|