@mindstudio-ai/local-model-tunnel 0.5.61 → 0.5.62
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/{chunk-2SN73FAD.js → chunk-DUBWH45L.js} +2 -2
- package/dist/{chunk-I7V6U5FS.js → chunk-KMLWNINV.js} +2 -2
- package/dist/{chunk-45DC6K4V.js → chunk-Y6UJ5YX5.js} +103 -1
- package/dist/chunk-Y6UJ5YX5.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/headless.js +2 -2
- package/dist/index.js +3 -3
- package/dist/{tui-5DJ7XDDK.js → tui-DYAZN744.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-45DC6K4V.js.map +0 -1
- /package/dist/{chunk-2SN73FAD.js.map → chunk-DUBWH45L.js.map} +0 -0
- /package/dist/{chunk-I7V6U5FS.js.map → chunk-KMLWNINV.js.map} +0 -0
- /package/dist/{tui-5DJ7XDDK.js.map → tui-DYAZN744.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
setProviderInstallPath,
|
|
8
8
|
submitProgress,
|
|
9
9
|
submitResult
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Y6UJ5YX5.js";
|
|
11
11
|
|
|
12
12
|
// src/providers/ollama/index.ts
|
|
13
13
|
import { Ollama } from "ollama";
|
|
@@ -1395,4 +1395,4 @@ export {
|
|
|
1395
1395
|
requestEvents,
|
|
1396
1396
|
TunnelRunner
|
|
1397
1397
|
};
|
|
1398
|
-
//# sourceMappingURL=chunk-
|
|
1398
|
+
//# sourceMappingURL=chunk-DUBWH45L.js.map
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
syncSchema,
|
|
27
27
|
watchManifestFiles,
|
|
28
28
|
watchTableFiles
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-Y6UJ5YX5.js";
|
|
30
30
|
|
|
31
31
|
// src/dev/browser/launcher.ts
|
|
32
32
|
import puppeteer from "puppeteer-core";
|
|
@@ -1336,4 +1336,4 @@ async function startHeadless(opts = {}) {
|
|
|
1336
1336
|
export {
|
|
1337
1337
|
startHeadless
|
|
1338
1338
|
};
|
|
1339
|
-
//# sourceMappingURL=chunk-
|
|
1339
|
+
//# sourceMappingURL=chunk-KMLWNINV.js.map
|
|
@@ -2245,6 +2245,96 @@ var ClientRegistry = class {
|
|
|
2245
2245
|
}
|
|
2246
2246
|
};
|
|
2247
2247
|
|
|
2248
|
+
// src/dev/proxy/telemetry-mock.ts
|
|
2249
|
+
var MAX_BODY_BYTES = 1048576;
|
|
2250
|
+
var SSE_KEEPALIVE_MS = 25e3;
|
|
2251
|
+
function tryHandleTelemetry(req, res, sseConnections) {
|
|
2252
|
+
const url = req.url ?? "";
|
|
2253
|
+
if (!url.startsWith("/_/telemetry/")) return false;
|
|
2254
|
+
if (!req.headers.authorization) {
|
|
2255
|
+
res.writeHead(401, { "Content-Type": "application/json" });
|
|
2256
|
+
res.end(
|
|
2257
|
+
JSON.stringify({
|
|
2258
|
+
error: "missing_authorization",
|
|
2259
|
+
code: "missing_authorization"
|
|
2260
|
+
})
|
|
2261
|
+
);
|
|
2262
|
+
return true;
|
|
2263
|
+
}
|
|
2264
|
+
if (url === "/_/telemetry/errors" && req.method === "POST") {
|
|
2265
|
+
handleBatchPost(req, res);
|
|
2266
|
+
return true;
|
|
2267
|
+
}
|
|
2268
|
+
if (url === "/_/telemetry/events" && req.method === "POST") {
|
|
2269
|
+
handleBatchPost(req, res);
|
|
2270
|
+
return true;
|
|
2271
|
+
}
|
|
2272
|
+
if (url === "/_/telemetry/presence" && req.method === "GET") {
|
|
2273
|
+
handlePresence(req, res, sseConnections);
|
|
2274
|
+
return true;
|
|
2275
|
+
}
|
|
2276
|
+
return false;
|
|
2277
|
+
}
|
|
2278
|
+
function handleBatchPost(req, res) {
|
|
2279
|
+
let total = 0;
|
|
2280
|
+
const chunks = [];
|
|
2281
|
+
let aborted = false;
|
|
2282
|
+
req.on("data", (chunk) => {
|
|
2283
|
+
total += chunk.length;
|
|
2284
|
+
if (total > MAX_BODY_BYTES) {
|
|
2285
|
+
aborted = true;
|
|
2286
|
+
req.destroy();
|
|
2287
|
+
return;
|
|
2288
|
+
}
|
|
2289
|
+
chunks.push(chunk);
|
|
2290
|
+
});
|
|
2291
|
+
req.on("end", () => {
|
|
2292
|
+
if (aborted) {
|
|
2293
|
+
res.writeHead(413, { "Content-Type": "application/json" });
|
|
2294
|
+
res.end(JSON.stringify({ accepted: 0, rejected: 0 }));
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
let accepted = 0;
|
|
2298
|
+
try {
|
|
2299
|
+
const body = JSON.parse(Buffer.concat(chunks).toString("utf-8"));
|
|
2300
|
+
if (Array.isArray(body?.events)) accepted = body.events.length;
|
|
2301
|
+
} catch {
|
|
2302
|
+
}
|
|
2303
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
2304
|
+
res.end(JSON.stringify({ accepted, rejected: 0 }));
|
|
2305
|
+
});
|
|
2306
|
+
req.on("error", () => {
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
function handlePresence(req, res, sseConnections) {
|
|
2310
|
+
res.writeHead(200, {
|
|
2311
|
+
"Content-Type": "text/event-stream",
|
|
2312
|
+
"Cache-Control": "no-cache",
|
|
2313
|
+
Connection: "keep-alive",
|
|
2314
|
+
"X-Accel-Buffering": "no"
|
|
2315
|
+
});
|
|
2316
|
+
res.flushHeaders?.();
|
|
2317
|
+
sseConnections.add(res);
|
|
2318
|
+
const keepalive = setInterval(() => {
|
|
2319
|
+
try {
|
|
2320
|
+
res.write(": keepalive\n\n");
|
|
2321
|
+
} catch {
|
|
2322
|
+
}
|
|
2323
|
+
}, SSE_KEEPALIVE_MS);
|
|
2324
|
+
let cleaned = false;
|
|
2325
|
+
const cleanup = () => {
|
|
2326
|
+
if (cleaned) return;
|
|
2327
|
+
cleaned = true;
|
|
2328
|
+
clearInterval(keepalive);
|
|
2329
|
+
sseConnections.delete(res);
|
|
2330
|
+
log.debug("telemetry-mock", "SSE closed", { open: sseConnections.size });
|
|
2331
|
+
};
|
|
2332
|
+
req.on("close", cleanup);
|
|
2333
|
+
res.on("close", cleanup);
|
|
2334
|
+
res.on("error", cleanup);
|
|
2335
|
+
log.debug("telemetry-mock", "SSE opened", { open: sseConnections.size });
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2248
2338
|
// src/dev/stdin-commands/types.ts
|
|
2249
2339
|
var CommandError = class extends Error {
|
|
2250
2340
|
constructor(message, code) {
|
|
@@ -2276,6 +2366,8 @@ var DevProxy = class _DevProxy {
|
|
|
2276
2366
|
commandQueue = [];
|
|
2277
2367
|
/** Last mirror snapshot — sent to new mirror viewers so they don't wait for the next checkout. */
|
|
2278
2368
|
lastMirrorSnapshot = null;
|
|
2369
|
+
/** Open /_/telemetry/presence SSE responses, drained on stop(). */
|
|
2370
|
+
sseConnections = /* @__PURE__ */ new Set();
|
|
2279
2371
|
/** Upstream dev server health tracking. */
|
|
2280
2372
|
upstreamUp = true;
|
|
2281
2373
|
healthCheckTimer = null;
|
|
@@ -2473,6 +2565,13 @@ var DevProxy = class _DevProxy {
|
|
|
2473
2565
|
this.wss.close();
|
|
2474
2566
|
this.wss = null;
|
|
2475
2567
|
}
|
|
2568
|
+
for (const sseRes of this.sseConnections) {
|
|
2569
|
+
try {
|
|
2570
|
+
sseRes.end();
|
|
2571
|
+
} catch {
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
this.sseConnections.clear();
|
|
2476
2575
|
if (this.server) {
|
|
2477
2576
|
log.info("proxy", "Dev proxy stopping");
|
|
2478
2577
|
this.server.close();
|
|
@@ -2791,6 +2890,9 @@ var DevProxy = class _DevProxy {
|
|
|
2791
2890
|
clientRes.end();
|
|
2792
2891
|
return;
|
|
2793
2892
|
}
|
|
2893
|
+
if (tryHandleTelemetry(clientReq, clientRes, this.sseConnections)) {
|
|
2894
|
+
return;
|
|
2895
|
+
}
|
|
2794
2896
|
if (clientReq.url?.startsWith("/_/")) {
|
|
2795
2897
|
this.forwardToApi(clientReq, clientRes);
|
|
2796
2898
|
return;
|
|
@@ -3541,4 +3643,4 @@ export {
|
|
|
3541
3643
|
watchConfigFile,
|
|
3542
3644
|
watchManifestFiles
|
|
3543
3645
|
};
|
|
3544
|
-
//# sourceMappingURL=chunk-
|
|
3646
|
+
//# sourceMappingURL=chunk-Y6UJ5YX5.js.map
|