omnius 1.0.319 → 1.0.320

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 CHANGED
@@ -694343,6 +694343,29 @@ function tokensMatch(a2, b) {
694343
694343
  return false;
694344
694344
  }
694345
694345
  }
694346
+ function cookieValue(req3, name10) {
694347
+ const raw = req3.headers["cookie"];
694348
+ if (typeof raw !== "string" || !raw) return null;
694349
+ for (const part of raw.split(";")) {
694350
+ const idx = part.indexOf("=");
694351
+ if (idx <= 0) continue;
694352
+ const k = part.slice(0, idx).trim();
694353
+ if (k !== name10) continue;
694354
+ try {
694355
+ return decodeURIComponent(part.slice(idx + 1).trim());
694356
+ } catch {
694357
+ return part.slice(idx + 1).trim();
694358
+ }
694359
+ }
694360
+ return null;
694361
+ }
694362
+ function isLoopbackRequest(req3) {
694363
+ const remoteIp = (req3.socket?.remoteAddress || "").replace(/^::ffff:/, "");
694364
+ return isLoopbackIP(remoteIp);
694365
+ }
694366
+ function hasLocalUiSession(req3) {
694367
+ return isLoopbackRequest(req3) && tokensMatch(cookieValue(req3, LOCAL_UI_SESSION_COOKIE), LOCAL_UI_SESSION_TOKEN);
694368
+ }
694346
694369
  function scopedEnvKeySources() {
694347
694370
  const pick = (...names) => {
694348
694371
  for (const n2 of names) {
@@ -694442,6 +694465,9 @@ function resolveAuth(req3) {
694442
694465
  } catch {
694443
694466
  }
694444
694467
  }
694468
+ if (hasLocalUiSession(req3)) {
694469
+ return { authenticated: true, scope: "admin", user: "local-ui" };
694470
+ }
694445
694471
  if (!anyEnvAuthKeyConfigured()) {
694446
694472
  const insecureLoopbackAdmin = process.env["OMNIUS_INSECURE_LOOPBACK_ADMIN"] === "1";
694447
694473
  const remoteIp = (req3.socket?.remoteAddress || "").replace(/^::ffff:/, "");
@@ -697894,12 +697920,16 @@ async function handleRequest(req3, res, ollamaUrl, verbose, runtimeDefaults = {}
697894
697920
  "/config"
697895
697921
  ]);
697896
697922
  if (guiRoutes.has(pathname) && method === "GET" && req3.headers.accept?.includes("text/html")) {
697897
- res.writeHead(200, {
697923
+ const htmlHeaders = {
697898
697924
  "Content-Type": "text/html; charset=utf-8",
697899
697925
  "Cache-Control": "no-cache, no-store, must-revalidate, max-age=0",
697900
697926
  Pragma: "no-cache",
697901
697927
  Expires: "0"
697902
- });
697928
+ };
697929
+ if (isLoopbackRequest(req3)) {
697930
+ htmlHeaders["Set-Cookie"] = LOCAL_UI_SESSION_COOKIE + "=" + encodeURIComponent(LOCAL_UI_SESSION_TOKEN) + "; Path=/; HttpOnly; SameSite=Strict; Max-Age=86400" + (req3.socket.encrypted ? "; Secure" : "");
697931
+ }
697932
+ res.writeHead(200, htmlHeaders);
697903
697933
  res.end(getWebUI());
697904
697934
  return;
697905
697935
  }
@@ -702819,7 +702849,7 @@ function setTimerEnabled(name10, enabled2) {
702819
702849
  return false;
702820
702850
  }
702821
702851
  }
702822
- var require4, NEXUS_DIRECTORY_ORIGIN2, NEXUS_SPONSORS_URL2, endpointRegistry, modelRouteMap, endpointUsage, _lastEndpointDiagnostics, BACKEND_TIMEOUT_DEFAULT_MS, BACKEND_TIMEOUT_MAX_MS, MODEL_LIST_TIMEOUT_DEFAULT_MS, metrics, startedAt, realtimeOllamaFallbackCache, runningProcesses, perKeyUsage, CRON_MARKER2;
702852
+ var require4, NEXUS_DIRECTORY_ORIGIN2, NEXUS_SPONSORS_URL2, endpointRegistry, modelRouteMap, endpointUsage, _lastEndpointDiagnostics, BACKEND_TIMEOUT_DEFAULT_MS, BACKEND_TIMEOUT_MAX_MS, MODEL_LIST_TIMEOUT_DEFAULT_MS, metrics, startedAt, realtimeOllamaFallbackCache, runningProcesses, LOCAL_UI_SESSION_COOKIE, LOCAL_UI_SESSION_TOKEN, perKeyUsage, CRON_MARKER2;
702823
702853
  var init_serve = __esm({
702824
702854
  "packages/cli/src/api/serve.ts"() {
702825
702855
  "use strict";
@@ -702870,6 +702900,8 @@ var init_serve = __esm({
702870
702900
  startedAt = Date.now();
702871
702901
  realtimeOllamaFallbackCache = /* @__PURE__ */ new Map();
702872
702902
  runningProcesses = /* @__PURE__ */ new Map();
702903
+ LOCAL_UI_SESSION_COOKIE = "omnius_ui_session";
702904
+ LOCAL_UI_SESSION_TOKEN = randomBytes28(32).toString("base64url");
702873
702905
  perKeyUsage = /* @__PURE__ */ new Map();
702874
702906
  CRON_MARKER2 = "# OMNIUS-SCHEDULED:";
702875
702907
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.319",
3
+ "version": "1.0.320",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.319",
9
+ "version": "1.0.320",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.319",
3
+ "version": "1.0.320",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",