omnius 1.0.331 → 1.0.333

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
@@ -623254,8 +623254,11 @@ __export(daemon_exports, {
623254
623254
  ensureDaemon: () => ensureDaemon,
623255
623255
  forceKillDaemon: () => forceKillDaemon,
623256
623256
  getDaemonPid: () => getDaemonPid,
623257
+ getDaemonReportedVersion: () => getDaemonReportedVersion,
623257
623258
  getDaemonStatus: () => getDaemonStatus,
623259
+ getLocalCliVersion: () => getLocalCliVersion,
623258
623260
  isDaemonRunning: () => isDaemonRunning,
623261
+ restartDaemon: () => restartDaemon,
623259
623262
  startDaemon: () => startDaemon,
623260
623263
  stopDaemon: () => stopDaemon
623261
623264
  });
@@ -623285,6 +623288,48 @@ async function isDaemonRunning(port) {
623285
623288
  return false;
623286
623289
  }
623287
623290
  }
623291
+ function getLocalCliVersion() {
623292
+ try {
623293
+ const here = dirname42(fileURLToPath17(import.meta.url));
623294
+ for (const rel of ["../package.json", "../../package.json", "./package.json", "../../../package.json"]) {
623295
+ const p2 = join135(here, rel);
623296
+ if (existsSync123(p2)) {
623297
+ const v = JSON.parse(readFileSync100(p2, "utf8"))?.version;
623298
+ if (v) return String(v);
623299
+ }
623300
+ }
623301
+ } catch {
623302
+ }
623303
+ return "0.0.0";
623304
+ }
623305
+ async function getDaemonReportedVersion(port) {
623306
+ const p2 = port ?? getDaemonPort();
623307
+ try {
623308
+ const resp = await fetch(`http://127.0.0.1:${p2}/health`, { signal: AbortSignal.timeout(2e3) });
623309
+ if (!resp.ok) return null;
623310
+ const data = await resp.json();
623311
+ return data.version ?? null;
623312
+ } catch {
623313
+ return null;
623314
+ }
623315
+ }
623316
+ async function restartDaemon(port) {
623317
+ const p2 = port ?? getDaemonPort();
623318
+ try {
623319
+ const { spawnSync: spawnSync10 } = await import("node:child_process");
623320
+ const enabled2 = spawnSync10("systemctl", ["--user", "is-enabled", "omnius-daemon.service"], {
623321
+ stdio: "ignore",
623322
+ timeout: 5e3
623323
+ });
623324
+ if (enabled2.status === 0) {
623325
+ spawnSync10("systemctl", ["--user", "restart", "omnius-daemon.service"], { stdio: "ignore", timeout: 2e4 });
623326
+ return;
623327
+ }
623328
+ } catch {
623329
+ }
623330
+ await forceKillDaemon(p2);
623331
+ await startDaemon();
623332
+ }
623288
623333
  function getDaemonPid() {
623289
623334
  if (!existsSync123(PID_FILE2)) return null;
623290
623335
  try {
@@ -623479,6 +623524,20 @@ async function forceKillDaemon(port) {
623479
623524
  async function ensureDaemon() {
623480
623525
  const port = getDaemonPort();
623481
623526
  if (await isDaemonRunning(port)) {
623527
+ if (process.env["OMNIUS_NO_VERSION_GUARD"] !== "1") {
623528
+ const running = await getDaemonReportedVersion(port);
623529
+ const local = getLocalCliVersion();
623530
+ if (running && local !== "0.0.0" && running !== local) {
623531
+ await restartDaemon(port);
623532
+ for (let i2 = 0; i2 < 24; i2++) {
623533
+ await new Promise((r2) => setTimeout(r2, 500));
623534
+ if (await isDaemonRunning(port) && await getDaemonReportedVersion(port) === local) {
623535
+ return true;
623536
+ }
623537
+ }
623538
+ return await isDaemonRunning(port);
623539
+ }
623540
+ }
623482
623541
  return true;
623483
623542
  }
623484
623543
  const stalePid = getDaemonPid();
@@ -697759,7 +697818,7 @@ function getVersion3() {
697759
697818
  for (const pkgPath of candidates) {
697760
697819
  try {
697761
697820
  if (!existsSync157(pkgPath)) continue;
697762
- const pkg = require4(pkgPath);
697821
+ const pkg = JSON.parse(readFileSync128(pkgPath, "utf8"));
697763
697822
  if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
697764
697823
  return pkg.version ?? "0.0.0";
697765
697824
  }
@@ -707241,6 +707300,39 @@ function startApiServer(options2 = {}) {
707241
707300
  log22(`
707242
707301
  omnius API server v${version4}
707243
707302
  `);
707303
+ if (process.env["OMNIUS_DAEMON"] === "1" && process.env["OMNIUS_NO_VERSION_GUARD"] !== "1") {
707304
+ const readDiskVersion = () => {
707305
+ try {
707306
+ const here = dirname50(fileURLToPath20(import.meta.url));
707307
+ for (const rel of ["../package.json", "../../package.json", "../../../package.json", "../../../../package.json"]) {
707308
+ const p2 = join169(here, rel);
707309
+ if (existsSync157(p2)) {
707310
+ const pkg = JSON.parse(readFileSync128(p2, "utf8"));
707311
+ if (pkg.name === "omnius" || pkg.name === "@omnius/cli" || pkg.name === "@omnius/monorepo") {
707312
+ return pkg.version ?? null;
707313
+ }
707314
+ }
707315
+ }
707316
+ } catch {
707317
+ }
707318
+ return null;
707319
+ };
707320
+ const bootVersion = readDiskVersion() ?? version4;
707321
+ const versionWatch = setInterval(() => {
707322
+ const disk = readDiskVersion();
707323
+ if (disk && disk !== bootVersion) {
707324
+ log22(` [daemon] version changed on disk ${bootVersion} -> ${disk}; restarting for the new version…
707325
+ `);
707326
+ try {
707327
+ server2.close(() => process.exit(0));
707328
+ } catch {
707329
+ process.exit(0);
707330
+ }
707331
+ setTimeout(() => process.exit(0), 3e3).unref();
707332
+ }
707333
+ }, 1e4);
707334
+ versionWatch.unref();
707335
+ }
707244
707336
  const proto = useTls ? "https" : "http";
707245
707337
  log22(` Listening on ${proto}://${host}:${port}
707246
707338
  `);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.331",
3
+ "version": "1.0.333",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.331",
9
+ "version": "1.0.333",
10
10
  "bundleDependencies": [
11
11
  "image-to-ascii"
12
12
  ],
@@ -2393,9 +2393,9 @@
2393
2393
  "license": "MIT"
2394
2394
  },
2395
2395
  "node_modules/axios": {
2396
- "version": "1.18.0",
2397
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.0.tgz",
2398
- "integrity": "sha512-E32NzpYKp++W7XRe52rHiXV2ehxmh3wbdgO7MHeFM+vqxLBYHzt0ElkiImtOBxtOmyp0yoC8C6uESVV84Y2/hw==",
2396
+ "version": "1.18.1",
2397
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz",
2398
+ "integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==",
2399
2399
  "license": "MIT",
2400
2400
  "dependencies": {
2401
2401
  "follow-redirects": "^1.16.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.331",
3
+ "version": "1.0.333",
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",