agentdev 0.1.3 → 0.1.4
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.
|
@@ -6258,6 +6258,10 @@ var ViewerWorker = class {
|
|
|
6258
6258
|
this.handleNpmFeatureTemplate(req, res, url);
|
|
6259
6259
|
return;
|
|
6260
6260
|
}
|
|
6261
|
+
if (/^\/(chunk-|BasicAgent-|ExplorerAgent-|notification-|resolver-|types-|index\.js).*$/.test(url)) {
|
|
6262
|
+
this.handleStaticAsset(req, res, url);
|
|
6263
|
+
return;
|
|
6264
|
+
}
|
|
6261
6265
|
res.writeHead(404);
|
|
6262
6266
|
res.end("Not Found");
|
|
6263
6267
|
}
|
|
@@ -7502,6 +7506,28 @@ var ViewerWorker = class {
|
|
|
7502
7506
|
res.end("Internal server error");
|
|
7503
7507
|
}
|
|
7504
7508
|
}
|
|
7509
|
+
/**
|
|
7510
|
+
* 处理静态资源文件(chunk、js、css 等)
|
|
7511
|
+
* 支持 agentdev npm 包中的共享模块
|
|
7512
|
+
*/
|
|
7513
|
+
handleStaticAsset(req, res, url) {
|
|
7514
|
+
try {
|
|
7515
|
+
const session = this.currentAgentId ? this.agentSessions.get(this.currentAgentId) : void 0;
|
|
7516
|
+
const projectRoot = session?.projectRoot || process.cwd();
|
|
7517
|
+
const fileName = url.substring(1);
|
|
7518
|
+
const searchPaths = [
|
|
7519
|
+
// npm 包模式:node_modules/agentdev/dist/{file}
|
|
7520
|
+
join(projectRoot, "node_modules", "agentdev", "dist", fileName),
|
|
7521
|
+
// 开发模式:项目根目录 dist/{file}
|
|
7522
|
+
join(projectRoot, "dist", fileName)
|
|
7523
|
+
];
|
|
7524
|
+
this.tryReadFile(searchPaths, 0, res, url);
|
|
7525
|
+
} catch (err) {
|
|
7526
|
+
console.error("[Viewer Worker] \u9759\u6001\u8D44\u6E90\u5904\u7406\u9519\u8BEF:", err.message);
|
|
7527
|
+
res.writeHead(500, { "Content-Type": "text/plain; charset=utf-8" });
|
|
7528
|
+
res.end("Internal server error");
|
|
7529
|
+
}
|
|
7530
|
+
}
|
|
7505
7531
|
// ========== HTML 生成(复用原有代码)==========
|
|
7506
7532
|
getHtml() {
|
|
7507
7533
|
return generateViewerHtml(this.port);
|
|
@@ -7575,4 +7601,4 @@ if (isMainModule(import.meta.url)) {
|
|
|
7575
7601
|
export {
|
|
7576
7602
|
ViewerWorker
|
|
7577
7603
|
};
|
|
7578
|
-
//# sourceMappingURL=chunk-
|
|
7604
|
+
//# sourceMappingURL=chunk-VYY63N2T.js.map
|