openmagic 0.14.2 → 0.15.0
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/cli.js +12 -7
- package/dist/cli.js.map +1 -1
- package/dist/toolbar/index.global.js +1 -1
- package/dist/toolbar/index.global.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1356,16 +1356,17 @@ async function handleLlmChat(params, onChunk, onDone, onError) {
|
|
|
1356
1356
|
}
|
|
1357
1357
|
|
|
1358
1358
|
// src/server.ts
|
|
1359
|
-
var VERSION = "0.
|
|
1359
|
+
var VERSION = "0.15.0";
|
|
1360
1360
|
var __dirname = dirname2(fileURLToPath(import.meta.url));
|
|
1361
1361
|
function attachOpenMagic(httpServer, roots) {
|
|
1362
1362
|
function handleRequest(req, res) {
|
|
1363
1363
|
if (!req.url?.startsWith("/__openmagic__/")) return false;
|
|
1364
|
-
|
|
1364
|
+
const urlPath = req.url.split("?")[0];
|
|
1365
|
+
if (urlPath === "/__openmagic__/toolbar.js") {
|
|
1365
1366
|
serveToolbarBundle(res);
|
|
1366
1367
|
return true;
|
|
1367
1368
|
}
|
|
1368
|
-
if (
|
|
1369
|
+
if (urlPath === "/__openmagic__/health") {
|
|
1369
1370
|
res.writeHead(200, {
|
|
1370
1371
|
"Content-Type": "application/json",
|
|
1371
1372
|
"Access-Control-Allow-Origin": "*"
|
|
@@ -1604,12 +1605,15 @@ function serveToolbarBundle(res) {
|
|
|
1604
1605
|
function createProxyServer(targetHost, targetPort, roots) {
|
|
1605
1606
|
const proxy = httpProxy.createProxyServer({
|
|
1606
1607
|
target: `http://${targetHost}:${targetPort}`,
|
|
1607
|
-
ws: true,
|
|
1608
1608
|
selfHandleResponse: true
|
|
1609
|
+
// ws: false — we handle WebSocket upgrades manually in server.on("upgrade")
|
|
1609
1610
|
});
|
|
1610
1611
|
const token = getSessionToken();
|
|
1611
|
-
proxy.on("proxyReq", (proxyReq) => {
|
|
1612
|
-
|
|
1612
|
+
proxy.on("proxyReq", (proxyReq, req) => {
|
|
1613
|
+
const accept = req.headers.accept || "";
|
|
1614
|
+
if (accept.includes("text/html") || accept.includes("*/*") || !accept) {
|
|
1615
|
+
proxyReq.removeHeader("Accept-Encoding");
|
|
1616
|
+
}
|
|
1613
1617
|
});
|
|
1614
1618
|
proxy.on("proxyRes", (proxyRes, req, res) => {
|
|
1615
1619
|
const contentType = proxyRes.headers["content-type"] || "";
|
|
@@ -1747,6 +1751,7 @@ async function detectDevServer() {
|
|
|
1747
1751
|
return { port, host: "127.0.0.1" };
|
|
1748
1752
|
}
|
|
1749
1753
|
}
|
|
1754
|
+
return null;
|
|
1750
1755
|
}
|
|
1751
1756
|
const checks = COMMON_DEV_PORTS.map(async (port) => {
|
|
1752
1757
|
const isOpen = await checkPort(port);
|
|
@@ -1870,7 +1875,7 @@ process.on("uncaughtException", (err) => {
|
|
|
1870
1875
|
process.exit(1);
|
|
1871
1876
|
});
|
|
1872
1877
|
var childProcesses = [];
|
|
1873
|
-
var VERSION2 = "0.
|
|
1878
|
+
var VERSION2 = "0.15.0";
|
|
1874
1879
|
function ask(question) {
|
|
1875
1880
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
1876
1881
|
return new Promise((resolve3) => {
|