@beastmode-develeap/beastmode 0.1.141 → 0.1.143
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 +52 -5
- package/dist/index.js.map +1 -1
- package/dist/web/board.html +1 -1
- package/dist/web/build-commit.txt +1 -1
- package/dist/web/build-stamp.txt +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4599,15 +4599,22 @@ function proxyToBoard(boardUrl, method, path, body, query) {
|
|
|
4599
4599
|
...postData ? { "Content-Length": Buffer.byteLength(postData).toString() } : {}
|
|
4600
4600
|
}
|
|
4601
4601
|
}, (res) => {
|
|
4602
|
+
const statusCode = res.statusCode ?? 200;
|
|
4602
4603
|
let data = "";
|
|
4603
4604
|
res.on("data", (chunk) => {
|
|
4604
4605
|
data += chunk.toString();
|
|
4605
4606
|
});
|
|
4606
4607
|
res.on("end", () => {
|
|
4608
|
+
let parsed;
|
|
4607
4609
|
try {
|
|
4608
|
-
|
|
4610
|
+
parsed = JSON.parse(data);
|
|
4609
4611
|
} catch {
|
|
4610
|
-
|
|
4612
|
+
parsed = { raw: data };
|
|
4613
|
+
}
|
|
4614
|
+
if (statusCode >= 400) {
|
|
4615
|
+
reject(new HttpError(statusCode, parsed));
|
|
4616
|
+
} else {
|
|
4617
|
+
resolve20(parsed);
|
|
4611
4618
|
}
|
|
4612
4619
|
});
|
|
4613
4620
|
});
|
|
@@ -5051,6 +5058,34 @@ function getBoardRoutes(factoryDir) {
|
|
|
5051
5058
|
return proxyToBoard(boardUrl, "GET", "/api/telemetry/status", void 0, scopedQuery(query));
|
|
5052
5059
|
}
|
|
5053
5060
|
},
|
|
5061
|
+
// ── Environment config (Story 1 / multi-env lifecycle epic — Gap 17) ──
|
|
5062
|
+
// Direct passthrough proxies so browser_any scenarios can verify
|
|
5063
|
+
// the resolver at http://ui:8080/api/environments and
|
|
5064
|
+
// /api/debug/env-config. Skipping these entries is the exact
|
|
5065
|
+
// failure mode documented in Gap 8 ("UI proxy allowlist is an
|
|
5066
|
+
// invisible contract the planner ignores") — do NOT remove.
|
|
5067
|
+
//
|
|
5068
|
+
// These endpoints use the `project` query param (not `board`) to
|
|
5069
|
+
// select which project's env config to return. scopedQuery() only
|
|
5070
|
+
// forwards the `board` param, so we extract `project` explicitly.
|
|
5071
|
+
{
|
|
5072
|
+
method: "GET",
|
|
5073
|
+
pattern: "/api/environments",
|
|
5074
|
+
handler: async (_body, _params, query) => {
|
|
5075
|
+
const boardUrl = getBoardUrl2(factoryDir);
|
|
5076
|
+
const fwd = query?.project ? { project: query.project } : void 0;
|
|
5077
|
+
return proxyToBoard(boardUrl, "GET", "/api/environments", void 0, fwd);
|
|
5078
|
+
}
|
|
5079
|
+
},
|
|
5080
|
+
{
|
|
5081
|
+
method: "GET",
|
|
5082
|
+
pattern: "/api/debug/env-config",
|
|
5083
|
+
handler: async (_body, _params, query) => {
|
|
5084
|
+
const boardUrl = getBoardUrl2(factoryDir);
|
|
5085
|
+
const fwd = query?.project ? { project: query.project } : void 0;
|
|
5086
|
+
return proxyToBoard(boardUrl, "GET", "/api/debug/env-config", void 0, fwd);
|
|
5087
|
+
}
|
|
5088
|
+
},
|
|
5054
5089
|
// ── Board Items (proxy to existing board at :8080) ──
|
|
5055
5090
|
// Every proxy forwards the `board` query param so the Python server
|
|
5056
5091
|
// can route to the correct per-project SQLite database. `"all"` is
|
|
@@ -6279,7 +6314,7 @@ function matchBoardRoute(routes, method, url) {
|
|
|
6279
6314
|
}
|
|
6280
6315
|
return null;
|
|
6281
6316
|
}
|
|
6282
|
-
var BinaryResponse, _TERMINAL_STAGES;
|
|
6317
|
+
var BinaryResponse, HttpError, _TERMINAL_STAGES;
|
|
6283
6318
|
var init_board_api_routes = __esm({
|
|
6284
6319
|
"src/cli/ui/board-api-routes.ts"() {
|
|
6285
6320
|
"use strict";
|
|
@@ -6293,6 +6328,14 @@ var init_board_api_routes = __esm({
|
|
|
6293
6328
|
this.filename = filename;
|
|
6294
6329
|
}
|
|
6295
6330
|
};
|
|
6331
|
+
HttpError = class extends Error {
|
|
6332
|
+
constructor(statusCode, body) {
|
|
6333
|
+
super(`Board returned HTTP ${statusCode}`);
|
|
6334
|
+
this.statusCode = statusCode;
|
|
6335
|
+
this.body = body;
|
|
6336
|
+
this.name = "HttpError";
|
|
6337
|
+
}
|
|
6338
|
+
};
|
|
6296
6339
|
_TERMINAL_STAGES = /* @__PURE__ */ new Set([
|
|
6297
6340
|
"done",
|
|
6298
6341
|
"shipped",
|
|
@@ -6609,8 +6652,12 @@ async function startServer(options = {}) {
|
|
|
6609
6652
|
sendJson(res, 200, result);
|
|
6610
6653
|
}
|
|
6611
6654
|
} catch (err) {
|
|
6612
|
-
|
|
6613
|
-
|
|
6655
|
+
if (err instanceof HttpError) {
|
|
6656
|
+
sendJson(res, err.statusCode, err.body);
|
|
6657
|
+
} else {
|
|
6658
|
+
const message = err instanceof Error ? err.message : "Internal server error";
|
|
6659
|
+
sendJson(res, 500, { error: message });
|
|
6660
|
+
}
|
|
6614
6661
|
}
|
|
6615
6662
|
return;
|
|
6616
6663
|
}
|