@songsid/agend 2.3.5-alpha.13 → 2.3.5-alpha.14
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-export.d.ts +74 -0
- package/dist/agent-export.js +362 -0
- package/dist/agent-export.js.map +1 -0
- package/dist/build-provenance.json +1 -1
- package/dist/cli.js +27 -12
- package/dist/cli.js.map +1 -1
- package/dist/fleet-manager.d.ts +7 -0
- package/dist/fleet-manager.js +20 -1
- package/dist/fleet-manager.js.map +1 -1
- package/dist/hub/join/local.d.ts +1 -0
- package/dist/hub/join/local.js +8 -3
- package/dist/hub/join/local.js.map +1 -1
- package/dist/install-user-systemd.d.ts +20 -0
- package/dist/install-user-systemd.js +55 -0
- package/dist/install-user-systemd.js.map +1 -0
- package/dist/linux-launchers.d.ts +88 -0
- package/dist/linux-launchers.js +296 -0
- package/dist/linux-launchers.js.map +1 -0
- package/dist/locale.js +85 -2
- package/dist/locale.js.map +1 -1
- package/dist/service-installer.js +11 -2
- package/dist/service-installer.js.map +1 -1
- package/dist/ui/agent-export-dialog.js +169 -0
- package/dist/ui/agent-export-strings.js +81 -0
- package/dist/ui/settings-dialogs.js +3 -1
- package/dist/update-dispatch.d.ts +12 -0
- package/dist/update-dispatch.js +11 -0
- package/dist/update-dispatch.js.map +1 -1
- package/dist/web-api.d.ts +2 -0
- package/dist/web-api.js +49 -0
- package/dist/web-api.js.map +1 -1
- package/dist/windows-shortcuts.d.ts +29 -5
- package/dist/windows-shortcuts.js +52 -9
- package/dist/windows-shortcuts.js.map +1 -1
- package/launcher/agend-install.cjs +7 -1
- package/package.json +1 -1
- package/templates/icons/agend-restart.ico +0 -0
- package/templates/icons/agend.ico +0 -0
- package/templates/windows-shortcuts.ps1 +45 -12
package/dist/web-api.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { buildAgentExport, parseAgentExport } from "./agent-export.js";
|
|
1
2
|
import { hubModeOf, hubNameOf } from "./hub-mode.js";
|
|
2
3
|
import { validCredentialProfileName } from "./runtime-credential-profiles.js";
|
|
3
4
|
import { CANVAS_WORKER_EXPERIMENTAL_MESSAGE } from "./web-experimental.js";
|
|
@@ -2657,6 +2658,54 @@ export function handleWebRequest(req, res, url, ctx) {
|
|
|
2657
2658
|
json(res, 500, { error: "model_refresh_failed" }); });
|
|
2658
2659
|
return true;
|
|
2659
2660
|
}
|
|
2661
|
+
// AGEND-163: an agent's portable settings as a file, and the way back. Both only compute (nothing is written: loading a
|
|
2662
|
+
// file fills the Settings form, and the person still saves it there), and both are for the admin, as Settings is.
|
|
2663
|
+
if (method === "POST" && (path === "/ui/agent-export/build" || path === "/ui/agent-export/parse")) {
|
|
2664
|
+
const admission = adminAdmissionOf(req, url, ctx);
|
|
2665
|
+
if (!admission) {
|
|
2666
|
+
json(res, 403, { error: "admin_required" });
|
|
2667
|
+
return true;
|
|
2668
|
+
}
|
|
2669
|
+
void (async () => {
|
|
2670
|
+
let body;
|
|
2671
|
+
try {
|
|
2672
|
+
body = await parseBody(req);
|
|
2673
|
+
}
|
|
2674
|
+
catch {
|
|
2675
|
+
json(res, 400, { error: "Invalid JSON" });
|
|
2676
|
+
return;
|
|
2677
|
+
}
|
|
2678
|
+
if (!permitWebContinuation(req, res, ctx))
|
|
2679
|
+
return;
|
|
2680
|
+
if (adminAdmissionOf(req, url, ctx) !== admission) {
|
|
2681
|
+
json(res, 403, { error: "admin_required" });
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2684
|
+
if (!body || Array.isArray(body) || typeof body !== "object") {
|
|
2685
|
+
json(res, 400, { error: "invalid_request" });
|
|
2686
|
+
return;
|
|
2687
|
+
}
|
|
2688
|
+
if (path === "/ui/agent-export/parse") {
|
|
2689
|
+
json(res, 200, parseAgentExport(body.text));
|
|
2690
|
+
return;
|
|
2691
|
+
}
|
|
2692
|
+
const name = body.instance, include = body.include;
|
|
2693
|
+
if (typeof name !== "string" || !isSafeInstanceName(name) || !Array.isArray(include) || include.some(g => typeof g !== "string")) {
|
|
2694
|
+
json(res, 400, { error: "invalid_request" });
|
|
2695
|
+
return;
|
|
2696
|
+
}
|
|
2697
|
+
// The agent's own saved settings: `ctx.fleetConfig.instances[name]` has the fleet's defaults merged into it, and an export
|
|
2698
|
+
// must hold only what this agent itself sets.
|
|
2699
|
+
const inst = Object.hasOwn(ctx.fleetConfig?.instances ?? {}, name) ? ctx.rawInstanceConfig?.(name) : undefined;
|
|
2700
|
+
if (!inst) {
|
|
2701
|
+
json(res, 404, { error: "unknown_instance" });
|
|
2702
|
+
return;
|
|
2703
|
+
}
|
|
2704
|
+
json(res, 200, buildAgentExport(name, inst, include));
|
|
2705
|
+
})().catch(() => { if (!res.headersSent)
|
|
2706
|
+
json(res, 500, { error: "agent_export_failed" }); });
|
|
2707
|
+
return true;
|
|
2708
|
+
}
|
|
2660
2709
|
if (method === "GET" && path === "/ui/models") {
|
|
2661
2710
|
const backend = url.searchParams.get("backend") ?? "";
|
|
2662
2711
|
const instance = url.searchParams.get("instance");
|