site-agent-pro 1.0.3 → 1.0.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.
package/dist/bin.js CHANGED
File without changes
@@ -31,25 +31,6 @@ function resolveDashboardHost() {
31
31
  }
32
32
  return process.env.RENDER === "true" ? RENDER_HOST : DEFAULT_HOST;
33
33
  }
34
- function getClientScript() {
35
- // In production, we serve the pre-compiled .js file from the dist directory.
36
- // We look for it relative to the current file's location.
37
- const distPath = path.join(process.cwd(), "dist", "dashboard", "client.js");
38
- const srcPath = path.join(process.cwd(), "src", "dashboard", "client.ts");
39
- if (fs.existsSync(distPath)) {
40
- return fs.readFileSync(distPath, "utf8");
41
- }
42
- // Fallback for development if dist doesn't exist yet
43
- warn("Dashboard client.js not found in dist. Dashboard may not function correctly in production without a build.");
44
- return "// Dashboard client not found. Run 'npm run build' first.";
45
- }
46
- function getNarrativeScript() {
47
- const distPath = path.join(process.cwd(), "dist", "dashboard", "narrative.js");
48
- if (fs.existsSync(distPath)) {
49
- return fs.readFileSync(distPath, "utf8");
50
- }
51
- return "// Narrative script not found.";
52
- }
53
34
  function renderDashboardHtml() {
54
35
  return `<!doctype html>
55
36
  <html lang="en">
@@ -208,13 +189,17 @@ async function handleRequest(req, res, args) {
208
189
  sendText(res, 200, renderDashboardHtml(), "text/html");
209
190
  return;
210
191
  }
211
- if (requestUrl.pathname === "/app.js") {
212
- sendText(res, 200, getClientScript(), "application/javascript");
213
- return;
214
- }
215
- if (requestUrl.pathname === "/narrative.js") {
216
- sendText(res, 200, getNarrativeScript(), "application/javascript");
217
- return;
192
+ // Dynamic Static Asset Loader for Dashboard
193
+ // This allows the browser to fetch any .js files needed by the dashboard
194
+ const dashboardScripts = ["app.js", "narrative.js", "contracts.js", "theme.js"];
195
+ if (dashboardScripts.includes(pathParts[0] || "")) {
196
+ const requestedName = pathParts[0];
197
+ const diskName = requestedName === "app.js" ? "client.js" : requestedName;
198
+ const distPath = path.join(process.cwd(), "dist", "dashboard", diskName);
199
+ if (fs.existsSync(distPath)) {
200
+ sendText(res, 200, fs.readFileSync(distPath, "utf8"), "application/javascript");
201
+ return;
202
+ }
218
203
  }
219
204
  if (pathParts[0] === "submissions" && pathParts[1] && pathParts.length === 2) {
220
205
  const submission = await args.submissionService.getSubmission(decodeURIComponent(pathParts[1]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "site-agent-pro",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "AI-powered browser agent that tests websites like a real user and produces evidence-based, scored reports.",
6
6
  "bin": {