agentlife 1.1.4 → 1.1.5
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/index.js +16 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4852,14 +4852,13 @@ function mintBootstrapToken() {
|
|
|
4852
4852
|
function registerWebApp(api) {
|
|
4853
4853
|
const pluginRoot = path9.resolve(path9.dirname(api.source), "..");
|
|
4854
4854
|
const appRoot = path9.join(pluginRoot, "web-build");
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
if (!
|
|
4861
|
-
api.logger.warn("[agentlife] web-build/index.html missing — /agentlife/
|
|
4862
|
-
return;
|
|
4855
|
+
const hasWebBuild = fs7.existsSync(appRoot);
|
|
4856
|
+
const indexPath = hasWebBuild ? path9.join(appRoot, "index.html") : null;
|
|
4857
|
+
const hasIndex = !!(indexPath && fs7.existsSync(indexPath));
|
|
4858
|
+
if (!hasWebBuild) {
|
|
4859
|
+
api.logger.info("[agentlife] web-build/ not found — /agentlife/pair will still register; static dashboard disabled");
|
|
4860
|
+
} else if (!hasIndex) {
|
|
4861
|
+
api.logger.warn("[agentlife] web-build/index.html missing — /agentlife/pair will still register; static dashboard disabled");
|
|
4863
4862
|
}
|
|
4864
4863
|
let gatewayToken = "";
|
|
4865
4864
|
try {
|
|
@@ -4971,6 +4970,14 @@ function registerWebApp(api) {
|
|
|
4971
4970
|
res.end(JSON.stringify(payload));
|
|
4972
4971
|
return true;
|
|
4973
4972
|
}
|
|
4973
|
+
if (!hasWebBuild || !hasIndex) {
|
|
4974
|
+
res.writeHead(404, {
|
|
4975
|
+
"Content-Type": "text/plain",
|
|
4976
|
+
...corsHeaders(req)
|
|
4977
|
+
});
|
|
4978
|
+
res.end("AgentLife WASM dashboard not bundled with this plugin install. Use /agentlife/pair for QR pairing, or install the web build separately.");
|
|
4979
|
+
return true;
|
|
4980
|
+
}
|
|
4974
4981
|
const relative = urlPath.replace(/^\/agentlife\/?/, "") || "index.html";
|
|
4975
4982
|
const filePath = path9.resolve(appRoot, relative);
|
|
4976
4983
|
if (!filePath.startsWith(appRoot)) {
|
|
@@ -5012,7 +5019,7 @@ function registerWebApp(api) {
|
|
|
5012
5019
|
return true;
|
|
5013
5020
|
}
|
|
5014
5021
|
});
|
|
5015
|
-
api.logger.info("[agentlife] /agentlife/ route registered — serving WASM web app");
|
|
5022
|
+
api.logger.info(hasWebBuild && hasIndex ? "[agentlife] /agentlife/ route registered — serving WASM web app + /agentlife/pair" : "[agentlife] /agentlife/ route registered — /agentlife/pair only (no web-build)");
|
|
5016
5023
|
}
|
|
5017
5024
|
|
|
5018
5025
|
// services/pairing.ts
|