omnius 1.0.768 → 1.0.771

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/README.md CHANGED
@@ -15,6 +15,24 @@ npm install -g omnius
15
15
  omnius
16
16
  ```
17
17
 
18
+ The base install is compiler-free: a fresh machine does not need `make`, a C++
19
+ toolchain, or Python just to install and launch Omnius. The installer provisions
20
+ the AIWG companion separately without its optional native semantic-index addon,
21
+ so an unavailable native build cannot roll back the Omnius CLI.
22
+
23
+ If npm succeeds but a new terminal reports `omnius: command not found`, inspect
24
+ the global prefix and add its command directory to `PATH`:
25
+
26
+ ```bash
27
+ npm prefix -g
28
+ export PATH="$(npm prefix -g)/bin:$PATH"
29
+ hash -r
30
+ omnius --version
31
+ ```
32
+
33
+ Persist that export in the profile used by your shell, or open a new terminal
34
+ after an nvm/fnm setup change. `npx omnius@latest` is an immediate fallback.
35
+
18
36
  Requirements:
19
37
 
20
38
  - Node.js 22 or newer
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/index.js
3
- size: 38785240 bytes
4
- sha256: 72da91979e97b08216dc4c9599a9d1645a5cf1013a2b634db7f1a01aef3b38ed
3
+ size: 38792980 bytes
4
+ sha256: 74e5704561862e66d5a143bb3cea5d636898b86df38585f460081379ad7a49e3
@@ -12,8 +12,8 @@
12
12
  * Windows → Scheduled Task "OmniusDaemon" (onlogon)
13
13
  * 3. Start (or restart) the service so the daemon is live IMMEDIATELY —
14
14
  * no need to launch `omnius` in any terminal.
15
- * 4. Never exit non-zero. npm install must not fail because of a service
16
- * manager quirk or a permission quirk. We warn and move on.
15
+ * 4. Keep optional companion/service failures non-fatal. Only a corrupt
16
+ * core install (for example a missing launcher) fails npm installation.
17
17
  *
18
18
  * Opt-out: set env OMNIUS_SKIP_DAEMON_INSTALL=1 before `npm i -g`.
19
19
  *
@@ -37,10 +37,22 @@ var PORT = parseInt(process.env.OMNIUS_PORT || "11435", 10);
37
37
  var SERVICE_LABEL = "omnius-daemon";
38
38
  var LAUNCHD_LABEL = "ai.omnius.daemon";
39
39
  var WIN_TASK_NAME = "OmniusDaemon";
40
- var REQUIRED_AIWG_VERSION = "2026.5.11";
40
+ var REQUIRED_AIWG_VERSION = readCompanionAiwgVersion();
41
41
  var INSTALL_STEPS = 8;
42
42
  var DISCOVERY_NOTICE_PRINTED = false;
43
43
 
44
+ function readCompanionAiwgVersion() {
45
+ try {
46
+ var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"));
47
+ var version = pkg && pkg.omniusInstall && pkg.omniusInstall.aiwgVersion;
48
+ return typeof version === "string" && /^\d{4}\.\d+\.\d+(?:[-.][0-9A-Za-z]+)?$/.test(version)
49
+ ? version
50
+ : "";
51
+ } catch (e) {
52
+ return "";
53
+ }
54
+ }
55
+
44
56
  // ─── Helpers ────────────────────────────────────────────────────────────────
45
57
 
46
58
  function log(msg) {
@@ -303,6 +315,10 @@ function ensureGlobalAiwgInstall() {
303
315
  log("OMNIUS_SKIP_AIWG_INSTALL=1 — skipping AIWG CLI install.");
304
316
  return;
305
317
  }
318
+ if (!REQUIRED_AIWG_VERSION) {
319
+ warn("Package metadata is missing omniusInstall.aiwgVersion; optional AIWG CLI setup was skipped.");
320
+ return;
321
+ }
306
322
  if (!hasCmd("npm")) {
307
323
  warn("npm not found; cannot ensure aiwg@" + REQUIRED_AIWG_VERSION + ".");
308
324
  return;
@@ -316,13 +332,13 @@ function ensureGlobalAiwgInstall() {
316
332
  log("Ensuring global AIWG CLI: " + target + (installed ? " (was " + installed + ")" : ""));
317
333
  try {
318
334
  cp.execSync(
319
- "npm install -g " + shellQuote(target) + " --prefer-online --cache-min=0 --no-audit --fund=false",
335
+ "npm install -g " + shellQuote(target) + " --omit=optional --ignore-scripts --prefer-online --cache-min=0 --no-audit --fund=false",
320
336
  { stdio: quietInstall() ? "pipe" : "inherit", timeout: 180000 }
321
337
  );
322
338
  log("AIWG CLI ready: " + target);
323
339
  } catch (e) {
324
340
  warn("Could not install " + target + " globally (non-fatal): " + (e && e.message ? e.message : String(e)));
325
- warn("Manual fix: npm install -g " + target);
341
+ warn("Manual fix: npm install -g " + target + " --omit=optional --ignore-scripts");
326
342
  }
327
343
  }
328
344
 
@@ -419,6 +435,73 @@ function resolveOmniusBinary() {
419
435
  return null;
420
436
  }
421
437
 
438
+ function normalizedPath(value) {
439
+ try {
440
+ var resolved = path.resolve(String(value || "")).replace(/[\\/]+$/, "");
441
+ return IS_WIN ? resolved.toLowerCase() : resolved;
442
+ } catch (e) {
443
+ return "";
444
+ }
445
+ }
446
+
447
+ function pathContainsDirectory(directory) {
448
+ var target = normalizedPath(directory);
449
+ if (!target) return false;
450
+ return String(process.env.PATH || "").split(path.delimiter).some(function (entry) {
451
+ return normalizedPath(entry) === target;
452
+ });
453
+ }
454
+
455
+ // npm normally creates the global bin entry before postinstall. Verify that
456
+ // core contract and repair a missing POSIX symlink when the prefix is writable.
457
+ // This intentionally does not edit shell profiles: a child installer cannot
458
+ // change its parent shell, and guessing nvm/fnm/asdf ownership is unsafe.
459
+ function ensureCoreCommandAvailable() {
460
+ var launcher = path.resolve(__dirname, "launcher.cjs");
461
+ if (!fs.existsSync(launcher)) {
462
+ warn("Core launcher is missing from the installed package: " + launcher);
463
+ return false;
464
+ }
465
+ try { fs.chmodSync(launcher, 0o755); } catch (e) {}
466
+
467
+ var prefix = process.env.npm_config_prefix || process.env.NPM_CONFIG_PREFIX || runCapture("npm prefix -g");
468
+ if (!prefix) {
469
+ warn("Could not resolve npm's global prefix; launcher is available at " + launcher + ".");
470
+ return true;
471
+ }
472
+
473
+ var binDir = IS_WIN ? prefix : path.join(prefix, "bin");
474
+ var commandPath = path.join(binDir, IS_WIN ? "omnius.cmd" : "omnius");
475
+ if (!IS_WIN && !fs.existsSync(commandPath)) {
476
+ try {
477
+ fs.mkdirSync(binDir, { recursive: true });
478
+ try {
479
+ var existingEntry = fs.lstatSync(commandPath);
480
+ if (existingEntry.isSymbolicLink()) fs.unlinkSync(commandPath);
481
+ } catch (e) {}
482
+ fs.symlinkSync(launcher, commandPath);
483
+ log("Repaired missing global command link: " + commandPath);
484
+ } catch (e) {
485
+ warn("Could not repair global command link " + commandPath + ": " + (e && e.message ? e.message : String(e)));
486
+ }
487
+ }
488
+
489
+ if (fs.existsSync(commandPath)) log("Omnius command installed: " + commandPath);
490
+ else warn("npm did not create the expected Omnius command entry: " + commandPath);
491
+
492
+ if (!pathContainsDirectory(binDir)) {
493
+ warn("npm's global command directory is not on PATH: " + binDir);
494
+ if (IS_WIN) {
495
+ warn("Add that directory to your user PATH, open a new terminal, then run `omnius`.");
496
+ } else {
497
+ warn("For this shell: export PATH=" + shellQuote(binDir) + ":\"$PATH\"");
498
+ warn("Then run `hash -r` and `omnius`. Add the same export to your shell profile for future terminals.");
499
+ }
500
+ warn("Immediate fallback: npx omnius@latest");
501
+ }
502
+ return fs.existsSync(commandPath) || fs.existsSync(launcher);
503
+ }
504
+
422
505
  // Find a Node binary we can use in the service ExecStart.
423
506
  // On nvm systems this is important — /usr/bin/node is often too old.
424
507
  function resolveNodeBinary() {
@@ -1008,6 +1091,8 @@ function repairBrokenWrappers() {
1008
1091
  }
1009
1092
 
1010
1093
  function main() {
1094
+ if (!ensureCoreCommandAvailable()) return fatalExit(1);
1095
+
1011
1096
  // Always do the nexus cleanup first, regardless of opt-out.
1012
1097
  progress(1, INSTALL_STEPS, "Cleaning stale Nexus runtime state");
1013
1098
  cleanNexus();
@@ -1122,11 +1207,15 @@ function runMainAfterKill() {
1122
1207
  }
1123
1208
 
1124
1209
  function safeExit(code) {
1125
- // Never exit non-zero from postinstall — it breaks `npm i -g`.
1210
+ // Optional setup failures must not break `npm i -g`.
1126
1211
  printDiscoveryPrimer();
1127
1212
  process.exit(typeof code === "number" ? 0 : 0);
1128
1213
  }
1129
1214
 
1215
+ function fatalExit(code) {
1216
+ process.exit(typeof code === "number" && code !== 0 ? code : 1);
1217
+ }
1218
+
1130
1219
  // Guard against any unhandled throw — postinstall must not crash npm.
1131
1220
  try {
1132
1221
  main();
@@ -13,6 +13,19 @@
13
13
 
14
14
  "use strict";
15
15
 
16
+ // npm's `engines` field is advisory unless the user enables engine-strict.
17
+ // Fail before touching any running daemon so an unsupported runtime cannot
18
+ // leave the existing installation stopped or half-replaced.
19
+ var NODE_MAJOR = parseInt(String(process.versions && process.versions.node || "").split(".")[0], 10);
20
+ if (!NODE_MAJOR || NODE_MAJOR < 22) {
21
+ process.stderr.write(
22
+ "\n [preinstall] Omnius requires Node.js 22 or newer; detected " +
23
+ String(process.versions && process.versions.node || "unknown") + ".\n" +
24
+ " Install a current Node.js release, then run `npm install -g omnius` again.\n\n"
25
+ );
26
+ process.exit(1);
27
+ }
28
+
16
29
  // A coordinated self-update owns the exact PID/service lifecycle and verifies
17
30
  // the replacement runtime afterward. The generic install hook must not race
18
31
  // it by sweeping the configured port or killing an unattested process.
@@ -89,18 +102,32 @@ function killPidFile(pidFile) {
89
102
  if (!fs.existsSync(pidFile)) return false;
90
103
  var n = parseInt(fs.readFileSync(pidFile, "utf8").trim(), 10);
91
104
  if (!n || n <= 0) return false;
105
+ if (!isAttestedOmniusDaemon(n)) return false;
92
106
  try { process.kill(n, "SIGTERM"); log("SIGTERM " + pidFile + " (pid " + n + ")"); return true; }
93
107
  catch (e) { /* dead */ }
94
108
  } catch (e) {}
95
109
  return false;
96
110
  }
97
111
 
112
+ function processCommandLine(pid) {
113
+ if (IS_WIN) return "";
114
+ try { return fs.readFileSync("/proc/" + pid + "/cmdline", "utf8").replace(/\0/g, " "); } catch (e) {}
115
+ return "";
116
+ }
117
+
118
+ function isAttestedOmniusDaemon(pid) {
119
+ var cmd = processCommandLine(pid);
120
+ return /(?:^|[\\/\s])omnius(?:[\\/\s]|$)|[\\/]omnius[\\/]dist[\\/]index\.js\b|launcher\.cjs\b/i.test(cmd) &&
121
+ /\bserve\b/.test(cmd) && /--daemon\b/.test(cmd);
122
+ }
123
+
98
124
  progress(1, 3, "Preparing Omnius service handoff");
99
125
  stopServiceManager();
100
126
  killPidFile(path.join(HOME, ".omnius", "daemon.pid"));
101
127
  progress(2, 3, "Stopped old daemon handles");
102
128
 
103
- // Final: lsof-based sweep for any process still holding 11435.
129
+ // Final: stop only an attested Omnius daemon still holding 11435. A generic
130
+ // package lifecycle hook must never kill an unrelated service on this port.
104
131
  try {
105
132
  var port = parseInt(process.env.OMNIUS_PORT || "11435", 10);
106
133
  var out = "";
@@ -112,7 +139,7 @@ try {
112
139
  if (out) {
113
140
  out.split(/\s+/).forEach(function (s) {
114
141
  var n = parseInt(s, 10);
115
- if (Number.isFinite(n) && n > 0 && n !== process.pid) {
142
+ if (Number.isFinite(n) && n > 0 && n !== process.pid && isAttestedOmniusDaemon(n)) {
116
143
  try { process.kill(n, "SIGTERM"); log("SIGTERM port-holder pid " + n); } catch (e) {}
117
144
  }
118
145
  });
@@ -16,6 +16,23 @@ npm install -g omnius
16
16
  omnius
17
17
  ```
18
18
 
19
+ No compiler toolchain is required for the base install. Omnius installs its
20
+ AIWG companion separately without optional native indexing modules, so missing
21
+ `make`, C++, or Python cannot abort installation of the CLI.
22
+
23
+ If npm completes but the shell cannot find `omnius`, npm's global command
24
+ directory is not on that shell's `PATH`. Repair the current shell with:
25
+
26
+ ```bash
27
+ export PATH="$(npm prefix -g)/bin:$PATH"
28
+ hash -r
29
+ omnius --version
30
+ ```
31
+
32
+ Persist the same export in your shell profile (or open a new terminal after
33
+ configuring nvm/fnm). You can use `npx omnius@latest` immediately without
34
+ waiting for a profile reload.
35
+
19
36
  The first launch opens the setup flow, probes local capabilities, and asks which endpoint and model path to use.
20
37
 
21
38
  The installer prints a short agent-discovery primer. It does not print keys or