omnius 1.0.2 → 1.0.4
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 +158 -158
- package/dist/index.js +2510 -2327
- package/dist/launcher.cjs +1 -1
- package/dist/postinstall-daemon.cjs +78 -78
- package/dist/preinstall.cjs +8 -8
- package/dist/scripts/ocr-advanced.py +2 -2
- package/dist/scripts/start-moondream.py +1 -1
- package/dist/scripts/tor/tor_setup.sh +1 -1
- package/npm-shrinkwrap.json +3 -7
- package/package.json +3 -7
- package/prompts/agentic/system-large.md +10 -10
- package/prompts/agentic/system-medium.md +2 -2
- package/prompts/agentic/system-small.md +2 -2
- package/prompts/tui/dream-consolidate.md +1 -1
- package/prompts/tui/dream-lucid-eval.md +1 -1
- package/prompts/tui/dream-lucid-implement.md +1 -1
- package/prompts/tui/dream-stages.md +1 -1
package/dist/launcher.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Robust launcher for
|
|
2
|
+
// Robust launcher for omnius CLI.
|
|
3
3
|
// - Runs the ESM entry as a child process
|
|
4
4
|
// - On exit code 120 (update), resets terminal and restarts child
|
|
5
5
|
// - Prevents raw-mode/mouse-tracking bleedthrough on restart or crash
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* postinstall-daemon.cjs — system-service installer for the
|
|
4
|
+
* postinstall-daemon.cjs — system-service installer for the Omnius API daemon.
|
|
5
5
|
*
|
|
6
|
-
* Runs after `npm install -g
|
|
6
|
+
* Runs after `npm install -g omnius`. Responsibilities:
|
|
7
7
|
* 1. Clean up stale nexus daemon files (preserving prior postinstall behaviour).
|
|
8
|
-
* 2. Register a per-user system service that runs `
|
|
8
|
+
* 2. Register a per-user system service that runs `omnius serve --daemon`
|
|
9
9
|
* on port 11435, surviving reboots/logins.
|
|
10
|
-
* Linux → ~/.config/systemd/user/
|
|
11
|
-
* macOS → ~/Library/LaunchAgents/ai.
|
|
12
|
-
* Windows → Scheduled Task "
|
|
10
|
+
* Linux → ~/.config/systemd/user/omnius-daemon.service
|
|
11
|
+
* macOS → ~/Library/LaunchAgents/ai.omnius.daemon.plist
|
|
12
|
+
* Windows → Scheduled Task "OmniusDaemon" (onlogon)
|
|
13
13
|
* 3. Start (or restart) the service so the daemon is live IMMEDIATELY —
|
|
14
|
-
* no need to launch `
|
|
14
|
+
* no need to launch `omnius` in any terminal.
|
|
15
15
|
* 4. Never exit non-zero. npm install must not fail because of a service
|
|
16
16
|
* manager quirk or a permission quirk. We warn and move on.
|
|
17
17
|
*
|
|
18
|
-
* Opt-out: set env
|
|
18
|
+
* Opt-out: set env OMNIUS_SKIP_DAEMON_INSTALL=1 before `npm i -g`.
|
|
19
19
|
*
|
|
20
20
|
* ES5-safe pure CommonJS — runs on any Node version that survived preinstall.
|
|
21
21
|
*/
|
|
@@ -33,10 +33,10 @@ var IS_WIN = PLATFORM === "win32";
|
|
|
33
33
|
var IS_MAC = PLATFORM === "darwin";
|
|
34
34
|
var IS_LINUX = PLATFORM === "linux";
|
|
35
35
|
|
|
36
|
-
var PORT = parseInt(process.env.
|
|
37
|
-
var SERVICE_LABEL = "
|
|
38
|
-
var LAUNCHD_LABEL = "ai.
|
|
39
|
-
var WIN_TASK_NAME = "
|
|
36
|
+
var PORT = parseInt(process.env.OMNIUS_PORT || "11435", 10);
|
|
37
|
+
var SERVICE_LABEL = "omnius-daemon";
|
|
38
|
+
var LAUNCHD_LABEL = "ai.omnius.daemon";
|
|
39
|
+
var WIN_TASK_NAME = "OmniusDaemon";
|
|
40
40
|
|
|
41
41
|
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
42
42
|
|
|
@@ -70,7 +70,7 @@ function hasCmd(name) {
|
|
|
70
70
|
return runQuiet("which " + name);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
// Pre-check: is the port already serving an
|
|
73
|
+
// Pre-check: is the port already serving an Omnius daemon?
|
|
74
74
|
function tryHealth(port, cb) {
|
|
75
75
|
var http = require("http");
|
|
76
76
|
var req = http.request(
|
|
@@ -85,16 +85,16 @@ function tryHealth(port, cb) {
|
|
|
85
85
|
req.end();
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
// Resolve the `
|
|
88
|
+
// Resolve the `omnius` launcher script.
|
|
89
89
|
//
|
|
90
90
|
// PRIORITY ORDER (most stable first):
|
|
91
91
|
// 1. Sibling launcher.cjs — guaranteed to live next to this postinstall,
|
|
92
92
|
// survives across upgrades because it's part of the package itself.
|
|
93
93
|
// Avoids the npx cache trap and the fnm shim trap.
|
|
94
94
|
// 2. npm-global bin (if npm_config_prefix is set) — stable across reboots.
|
|
95
|
-
// 3. PATH-resolved
|
|
95
|
+
// 3. PATH-resolved omnius — works in dev installs but can resolve to ephemeral
|
|
96
96
|
// shims (npx cache, fnm multishell symlinks).
|
|
97
|
-
function
|
|
97
|
+
function resolveOmniusBinary() {
|
|
98
98
|
var candidates = [];
|
|
99
99
|
|
|
100
100
|
// 1. Self-relative — IDEAL: the launcher ships in the same directory as
|
|
@@ -109,15 +109,15 @@ function resolveOaBinary() {
|
|
|
109
109
|
if (!prefix) prefix = runCapture("npm prefix -g");
|
|
110
110
|
if (prefix) {
|
|
111
111
|
if (IS_WIN) {
|
|
112
|
-
candidates.push(path.join(prefix, "
|
|
113
|
-
candidates.push(path.join(prefix, "
|
|
112
|
+
candidates.push(path.join(prefix, "omnius.cmd"));
|
|
113
|
+
candidates.push(path.join(prefix, "omnius"));
|
|
114
114
|
} else {
|
|
115
|
-
candidates.push(path.join(prefix, "bin", "
|
|
116
|
-
candidates.push(path.join(prefix, "bin", "
|
|
115
|
+
candidates.push(path.join(prefix, "bin", "omnius"));
|
|
116
|
+
candidates.push(path.join(prefix, "bin", "omnius"));
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
// 3. PATH fallback (last resort — can resolve to npx cache or fnm shim).
|
|
120
|
-
var found = runCapture(IS_WIN ? "where
|
|
120
|
+
var found = runCapture(IS_WIN ? "where omnius" : "which omnius").split(/\r?\n/)[0];
|
|
121
121
|
if (found && !/_npx|fnm_multishells/.test(found)) candidates.push(found);
|
|
122
122
|
|
|
123
123
|
for (var i = 0; i < candidates.length; i++) {
|
|
@@ -156,22 +156,22 @@ function effectiveUser() {
|
|
|
156
156
|
// install) is running, it holds port 11435 with stale in-memory code. The
|
|
157
157
|
// systemctl/launchctl `restart` calls below CANNOT reach it because the
|
|
158
158
|
// service manager doesn't own that process — it was started detached by
|
|
159
|
-
// `
|
|
159
|
+
// `omnius serve --daemon` from a previous TUI session.
|
|
160
160
|
//
|
|
161
161
|
// Result without this kill: postinstall tries to start a NEW systemd
|
|
162
162
|
// daemon, port-bind fails, old daemon stays alive serving stale code,
|
|
163
163
|
// and the user's runs continue with broken patches.
|
|
164
164
|
//
|
|
165
165
|
// Strategy (matches packages/cli/src/daemon.ts:forceKillDaemon):
|
|
166
|
-
// 1. SIGTERM via known PID files (~/.
|
|
166
|
+
// 1. SIGTERM via known PID files (~/.omnius/daemon.pid + .omnius/nexus/daemon.pid)
|
|
167
167
|
// 2. lsof / fuser port probe — find ANY other holder
|
|
168
168
|
// 3. 2s graceful grace, then SIGKILL stragglers
|
|
169
169
|
// 4. Poll /health up to 5s for confirmation
|
|
170
170
|
//
|
|
171
|
-
// Skips when
|
|
171
|
+
// Skips when OMNIUS_DISABLE_FORCE_KILL_DAEMON=1 (escape valve).
|
|
172
172
|
function forceKillPortHolder(port, cb) {
|
|
173
|
-
if (process.env.
|
|
174
|
-
log("
|
|
173
|
+
if (process.env.OMNIUS_DISABLE_FORCE_KILL_DAEMON === "1") {
|
|
174
|
+
log("OMNIUS_DISABLE_FORCE_KILL_DAEMON=1 — skipping port-holder kill (upgrades may not pick up new code).");
|
|
175
175
|
return cb(0);
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -179,8 +179,8 @@ function forceKillPortHolder(port, cb) {
|
|
|
179
179
|
|
|
180
180
|
// Step 1: SIGTERM via PID files (graceful)
|
|
181
181
|
var pidFiles = [
|
|
182
|
-
path.join(HOME, ".
|
|
183
|
-
path.join(process.cwd(), ".
|
|
182
|
+
path.join(HOME, ".omnius", "daemon.pid"),
|
|
183
|
+
path.join(process.cwd(), ".omnius", "nexus", "daemon.pid"),
|
|
184
184
|
];
|
|
185
185
|
pidFiles.forEach(function (pidFile) {
|
|
186
186
|
try {
|
|
@@ -254,8 +254,8 @@ function forceKillPortHolder(port, cb) {
|
|
|
254
254
|
function cleanNexus() {
|
|
255
255
|
try {
|
|
256
256
|
var dirs = [
|
|
257
|
-
path.join(HOME, ".
|
|
258
|
-
path.join(process.cwd(), ".
|
|
257
|
+
path.join(HOME, ".omnius", "nexus"),
|
|
258
|
+
path.join(process.cwd(), ".omnius", "nexus"),
|
|
259
259
|
];
|
|
260
260
|
dirs.forEach(function (d) {
|
|
261
261
|
var stale = path.join(d, "nexus-daemon.mjs");
|
|
@@ -282,7 +282,7 @@ function cleanNexus() {
|
|
|
282
282
|
|
|
283
283
|
// ─── Linux: systemd user unit ───────────────────────────────────────────────
|
|
284
284
|
|
|
285
|
-
function installSystemd(nodeBin,
|
|
285
|
+
function installSystemd(nodeBin, omniusScript, user) {
|
|
286
286
|
if (!IS_LINUX) return false;
|
|
287
287
|
if (!hasCmd("systemctl")) {
|
|
288
288
|
warn("systemctl not found — skipping systemd install.");
|
|
@@ -300,26 +300,26 @@ function installSystemd(nodeBin, oaScript, user) {
|
|
|
300
300
|
|
|
301
301
|
var unitDir = path.join(userHome, ".config", "systemd", "user");
|
|
302
302
|
var unitPath = path.join(unitDir, SERVICE_LABEL + ".service");
|
|
303
|
-
var logDir = path.join(userHome, ".
|
|
303
|
+
var logDir = path.join(userHome, ".omnius");
|
|
304
304
|
|
|
305
305
|
try { fs.mkdirSync(unitDir, { recursive: true }); } catch (e) {}
|
|
306
306
|
try { fs.mkdirSync(logDir, { recursive: true }); } catch (e) {}
|
|
307
307
|
|
|
308
|
-
// The unit runs: <node> <
|
|
309
|
-
// with
|
|
308
|
+
// The unit runs: <node> <omniusScript> serve --daemon --quiet
|
|
309
|
+
// with OMNIUS_DAEMON=1 so the serve command picks the daemon path.
|
|
310
310
|
var unit = [
|
|
311
311
|
"[Unit]",
|
|
312
|
-
"Description=
|
|
313
|
-
"Documentation=https://github.com/robit-man/
|
|
312
|
+
"Description=Omnius API Daemon (port " + PORT + ")",
|
|
313
|
+
"Documentation=https://github.com/robit-man/omnius",
|
|
314
314
|
"After=network-online.target",
|
|
315
315
|
"Wants=network-online.target",
|
|
316
316
|
"",
|
|
317
317
|
"[Service]",
|
|
318
318
|
"Type=simple",
|
|
319
|
-
"Environment=
|
|
320
|
-
"Environment=
|
|
319
|
+
"Environment=OMNIUS_DAEMON=1",
|
|
320
|
+
"Environment=OMNIUS_PORT=" + PORT,
|
|
321
321
|
"Environment=NODE_ENV=production",
|
|
322
|
-
"ExecStart=" + nodeBin + " " +
|
|
322
|
+
"ExecStart=" + nodeBin + " " + omniusScript + " serve --daemon --quiet",
|
|
323
323
|
// Restart=always (was on-failure) — also relaunch on clean exit.
|
|
324
324
|
// Some upgrade flows trigger process.exit(0) (e.g. /update reload,
|
|
325
325
|
// SIGTERM during npm install), which Restart=on-failure ignores.
|
|
@@ -378,7 +378,7 @@ function installSystemd(nodeBin, oaScript, user) {
|
|
|
378
378
|
|
|
379
379
|
// ─── macOS: launchd user agent ──────────────────────────────────────────────
|
|
380
380
|
|
|
381
|
-
function installLaunchd(nodeBin,
|
|
381
|
+
function installLaunchd(nodeBin, omniusScript, user) {
|
|
382
382
|
if (!IS_MAC) return false;
|
|
383
383
|
|
|
384
384
|
var userHome = HOME;
|
|
@@ -391,7 +391,7 @@ function installLaunchd(nodeBin, oaScript, user) {
|
|
|
391
391
|
|
|
392
392
|
var agentDir = path.join(userHome, "Library", "LaunchAgents");
|
|
393
393
|
var plistPath = path.join(agentDir, LAUNCHD_LABEL + ".plist");
|
|
394
|
-
var logDir = path.join(userHome, ".
|
|
394
|
+
var logDir = path.join(userHome, ".omnius");
|
|
395
395
|
|
|
396
396
|
try { fs.mkdirSync(agentDir, { recursive: true }); } catch (e) {}
|
|
397
397
|
try { fs.mkdirSync(logDir, { recursive: true }); } catch (e) {}
|
|
@@ -405,15 +405,15 @@ function installLaunchd(nodeBin, oaScript, user) {
|
|
|
405
405
|
' <key>ProgramArguments</key>',
|
|
406
406
|
' <array>',
|
|
407
407
|
' <string>' + nodeBin + '</string>',
|
|
408
|
-
' <string>' +
|
|
408
|
+
' <string>' + omniusScript + '</string>',
|
|
409
409
|
' <string>serve</string>',
|
|
410
410
|
' <string>--daemon</string>',
|
|
411
411
|
' <string>--quiet</string>',
|
|
412
412
|
' </array>',
|
|
413
413
|
' <key>EnvironmentVariables</key>',
|
|
414
414
|
' <dict>',
|
|
415
|
-
' <key>
|
|
416
|
-
' <key>
|
|
415
|
+
' <key>OMNIUS_DAEMON</key><string>1</string>',
|
|
416
|
+
' <key>OMNIUS_PORT</key><string>' + PORT + '</string>',
|
|
417
417
|
' <key>PATH</key><string>/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin</string>',
|
|
418
418
|
' </dict>',
|
|
419
419
|
' <key>RunAtLoad</key><true/>',
|
|
@@ -449,7 +449,7 @@ function installLaunchd(nodeBin, oaScript, user) {
|
|
|
449
449
|
|
|
450
450
|
// ─── Windows: Scheduled Task ────────────────────────────────────────────────
|
|
451
451
|
|
|
452
|
-
function installWindows(nodeBin,
|
|
452
|
+
function installWindows(nodeBin, omniusScript) {
|
|
453
453
|
if (!IS_WIN) return false;
|
|
454
454
|
if (!hasCmd("schtasks")) {
|
|
455
455
|
warn("schtasks not found — skipping Windows scheduled task install.");
|
|
@@ -457,7 +457,7 @@ function installWindows(nodeBin, oaScript) {
|
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
// Build the task command — quote the paths.
|
|
460
|
-
var trCmd = '"' + nodeBin + '" "' +
|
|
460
|
+
var trCmd = '"' + nodeBin + '" "' + omniusScript + '" serve --daemon --quiet';
|
|
461
461
|
|
|
462
462
|
// Delete any existing task first (idempotent).
|
|
463
463
|
runQuiet('schtasks /Delete /TN "' + WIN_TASK_NAME + '" /F');
|
|
@@ -466,7 +466,7 @@ function installWindows(nodeBin, oaScript) {
|
|
|
466
466
|
'schtasks /Create /F /SC ONLOGON /RL HIGHEST /TN "' + WIN_TASK_NAME + '" /TR ' + JSON.stringify(trCmd)
|
|
467
467
|
);
|
|
468
468
|
if (!created) {
|
|
469
|
-
warn("Failed to create scheduled task. Try running `
|
|
469
|
+
warn("Failed to create scheduled task. Try running `omnius daemon install` from an elevated shell.");
|
|
470
470
|
return false;
|
|
471
471
|
}
|
|
472
472
|
log("Created scheduled task: " + WIN_TASK_NAME);
|
|
@@ -477,12 +477,12 @@ function installWindows(nodeBin, oaScript) {
|
|
|
477
477
|
|
|
478
478
|
// ─── Fallback: spawn detached now (no persistence) ─────────────────────────
|
|
479
479
|
|
|
480
|
-
function spawnDetached(nodeBin,
|
|
480
|
+
function spawnDetached(nodeBin, omniusScript) {
|
|
481
481
|
try {
|
|
482
|
-
var child = cp.spawn(nodeBin, [
|
|
482
|
+
var child = cp.spawn(nodeBin, [omniusScript, "serve", "--daemon", "--quiet"], {
|
|
483
483
|
detached: true,
|
|
484
484
|
stdio: "ignore",
|
|
485
|
-
env: Object.assign({}, process.env, {
|
|
485
|
+
env: Object.assign({}, process.env, { OMNIUS_DAEMON: "1", OMNIUS_PORT: String(PORT) }),
|
|
486
486
|
});
|
|
487
487
|
child.unref();
|
|
488
488
|
if (child.pid) {
|
|
@@ -512,16 +512,16 @@ function waitForHealth(timeoutMs, cb) {
|
|
|
512
512
|
// ─── Main ───────────────────────────────────────────────────────────────────
|
|
513
513
|
|
|
514
514
|
// ─── Wrapper-modelfile self-heal ───────────────────────────────────────────
|
|
515
|
-
// Old
|
|
515
|
+
// Old Omnius versions wrote `FROM <blob-path>` into omnius-* wrappers,
|
|
516
516
|
// which strips TEMPLATE/RENDERER/PARSER metadata and breaks tools support.
|
|
517
517
|
// On upgrade, scan local Ollama for stale wrappers and rebuild them with
|
|
518
518
|
// `FROM <baseModel>`. Best-effort, silent on failure — postinstall must not
|
|
519
519
|
// fail npm install.
|
|
520
520
|
function repairBrokenWrappers() {
|
|
521
521
|
// Independent opt-out from daemon install — wrapper repair is a different
|
|
522
|
-
// concern and runs even when
|
|
522
|
+
// concern and runs even when OMNIUS_SKIP_DAEMON_INSTALL=1, unless explicitly
|
|
523
523
|
// disabled.
|
|
524
|
-
if (process.env.
|
|
524
|
+
if (process.env.OMNIUS_SKIP_WRAPPER_REPAIR === "1") return;
|
|
525
525
|
// Skip if ollama isn't on PATH.
|
|
526
526
|
var ollamaBin = "";
|
|
527
527
|
try {
|
|
@@ -542,17 +542,17 @@ function repairBrokenWrappers() {
|
|
|
542
542
|
// Skip header row if present.
|
|
543
543
|
if (lines.length > 0 && /^NAME\s/i.test(lines[0])) lines = lines.slice(1);
|
|
544
544
|
var allNames = lines.map(function (l) { return l.split(/\s+/)[0]; });
|
|
545
|
-
var wrappers = allNames.filter(function (n) { return /^
|
|
546
|
-
var bases = allNames.filter(function (n) { return !/^
|
|
545
|
+
var wrappers = allNames.filter(function (n) { return /^omnius-/i.test(n); });
|
|
546
|
+
var bases = allNames.filter(function (n) { return !/^omnius-/i.test(n); });
|
|
547
547
|
if (wrappers.length === 0) return;
|
|
548
548
|
|
|
549
549
|
function expandedName(base) {
|
|
550
550
|
// Mirror packages/cli/src/tui/setup.ts:expandedModelName.
|
|
551
551
|
var canonical = base.replace(/:latest$/i, "");
|
|
552
|
-
return "
|
|
552
|
+
return "omnius-" + canonical.replace(":", "-").replace(/\./g, "");
|
|
553
553
|
}
|
|
554
554
|
function legacyExpandedName(base) {
|
|
555
|
-
return "
|
|
555
|
+
return "omnius-" + base.replace(":", "-").replace(/\./g, "");
|
|
556
556
|
}
|
|
557
557
|
function stripTag(n) { return (n || "").replace(/:[^:]+$/, ""); }
|
|
558
558
|
function guessBase(wrapper) {
|
|
@@ -568,7 +568,7 @@ function repairBrokenWrappers() {
|
|
|
568
568
|
}
|
|
569
569
|
// Then fall back to stripped-tag base — this is the only way to match
|
|
570
570
|
// wrappers that were built from `<base>:latest` and got their canonical
|
|
571
|
-
// form (`
|
|
571
|
+
// form (`omnius-<base-stripped>`). Prefer bases tagged ":latest"
|
|
572
572
|
// so that ambiguity (qwen3.6:27b vs qwen3.6:35b vs qwen3.6:latest)
|
|
573
573
|
// resolves to the user-facing default.
|
|
574
574
|
var latestFirst = bases.slice().sort(function (a, b) {
|
|
@@ -617,7 +617,7 @@ function repairBrokenWrappers() {
|
|
|
617
617
|
} catch (e) { return false; }
|
|
618
618
|
}
|
|
619
619
|
|
|
620
|
-
var modelDir = path.join(HOME, ".
|
|
620
|
+
var modelDir = path.join(HOME, ".omnius", "models");
|
|
621
621
|
try { fs.mkdirSync(modelDir, { recursive: true }); } catch (e) {}
|
|
622
622
|
|
|
623
623
|
var rebuilt = 0;
|
|
@@ -663,7 +663,7 @@ function repairBrokenWrappers() {
|
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
if (rebuilt > 0) {
|
|
666
|
-
log("Rebuilt " + rebuilt + " stale
|
|
666
|
+
log("Rebuilt " + rebuilt + " stale Omnius wrapper(s); " + skipped + " unchanged.");
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
|
|
@@ -671,20 +671,20 @@ function main() {
|
|
|
671
671
|
// Always do the nexus cleanup first, regardless of opt-out.
|
|
672
672
|
cleanNexus();
|
|
673
673
|
|
|
674
|
-
// Auto-repair stale
|
|
674
|
+
// Auto-repair stale Omnius model wrappers BEFORE restarting the daemon, so the
|
|
675
675
|
// freshly-restarted daemon picks up the rebuilt models on first inference.
|
|
676
676
|
try { repairBrokenWrappers(); } catch (e) {
|
|
677
677
|
warn("wrapper auto-repair crashed (non-fatal): " + (e && e.message));
|
|
678
678
|
}
|
|
679
679
|
|
|
680
|
-
if (process.env.
|
|
681
|
-
log("
|
|
680
|
+
if (process.env.OMNIUS_SKIP_DAEMON_INSTALL === "1") {
|
|
681
|
+
log("OMNIUS_SKIP_DAEMON_INSTALL=1 — skipping daemon service install.");
|
|
682
682
|
return safeExit(0);
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
// Force-kill any process holding the daemon port BEFORE we try to install
|
|
686
686
|
// a service. This handles the orphan-detached-daemon case (started by
|
|
687
|
-
// `
|
|
687
|
+
// `omnius serve --daemon` from a previous TUI session) — systemctl/launchctl
|
|
688
688
|
// restart can't reach it, so we have to clean up explicitly. Without this,
|
|
689
689
|
// the new service-managed daemon fails to bind port 11435 and the user
|
|
690
690
|
// ends up running stale in-memory code from the previous version.
|
|
@@ -704,55 +704,55 @@ function runMainAfterKill() {
|
|
|
704
704
|
tryHealth(PORT, function (alreadyUp) {
|
|
705
705
|
var user = effectiveUser();
|
|
706
706
|
var nodeBin = resolveNodeBinary();
|
|
707
|
-
var
|
|
707
|
+
var omniusScript = resolveOmniusBinary();
|
|
708
708
|
|
|
709
|
-
if (!
|
|
710
|
-
warn("Could not resolve `
|
|
709
|
+
if (!omniusScript) {
|
|
710
|
+
warn("Could not resolve `omnius` launcher — daemon install skipped. After install completes, run `omnius daemon install` manually.");
|
|
711
711
|
return safeExit(0);
|
|
712
712
|
}
|
|
713
713
|
|
|
714
714
|
if (alreadyUp) {
|
|
715
|
-
log("
|
|
715
|
+
log("Omnius daemon answering /health on port " + PORT + " — re-checking version drift before service (re)install.");
|
|
716
716
|
// Note: we already force-killed any stale process — anything answering
|
|
717
717
|
// now is a fresh service-managed daemon. Service (re)install below is
|
|
718
718
|
// idempotent and ensures the unit file matches the current bundle.
|
|
719
719
|
}
|
|
720
720
|
|
|
721
|
-
log("Installing
|
|
721
|
+
log("Installing Omnius API daemon service for port " + PORT + " ...");
|
|
722
722
|
log(" node: " + nodeBin);
|
|
723
|
-
log("
|
|
723
|
+
log(" omnius script: " + omniusScript);
|
|
724
724
|
log(" user: " + (user || "(unknown)"));
|
|
725
725
|
|
|
726
726
|
if (!user) {
|
|
727
727
|
warn("Running as bare root with no SUDO_USER — skipping per-user service install.");
|
|
728
|
-
warn("Re-run as your user, or run:
|
|
728
|
+
warn("Re-run as your user, or run: OMNIUS_SKIP_DAEMON_INSTALL=0 npm i -g omnius");
|
|
729
729
|
// Still spawn detached so the port is live right now.
|
|
730
|
-
spawnDetached(nodeBin,
|
|
730
|
+
spawnDetached(nodeBin, omniusScript);
|
|
731
731
|
return safeExit(0);
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
var ok = false;
|
|
735
735
|
if (IS_LINUX) {
|
|
736
|
-
ok = installSystemd(nodeBin,
|
|
736
|
+
ok = installSystemd(nodeBin, omniusScript, user);
|
|
737
737
|
} else if (IS_MAC) {
|
|
738
|
-
ok = installLaunchd(nodeBin,
|
|
738
|
+
ok = installLaunchd(nodeBin, omniusScript, user);
|
|
739
739
|
} else if (IS_WIN) {
|
|
740
|
-
ok = installWindows(nodeBin,
|
|
740
|
+
ok = installWindows(nodeBin, omniusScript);
|
|
741
741
|
} else {
|
|
742
742
|
warn("Unsupported platform: " + PLATFORM + " — falling back to detached spawn.");
|
|
743
743
|
}
|
|
744
744
|
|
|
745
745
|
if (!ok) {
|
|
746
746
|
// Fallback: spawn a detached child so at least the port is live NOW.
|
|
747
|
-
spawnDetached(nodeBin,
|
|
747
|
+
spawnDetached(nodeBin, omniusScript);
|
|
748
748
|
}
|
|
749
749
|
|
|
750
750
|
// Wait up to 15s for /health to come up, but don't fail npm install.
|
|
751
751
|
waitForHealth(15000, function (healthy) {
|
|
752
752
|
if (healthy) {
|
|
753
|
-
log("
|
|
753
|
+
log("Omnius API daemon is live: http://127.0.0.1:" + PORT + "/health");
|
|
754
754
|
} else {
|
|
755
|
-
warn("
|
|
755
|
+
warn("Omnius API daemon did not answer /health within 15s. Check logs:");
|
|
756
756
|
if (IS_LINUX) warn(" systemctl --user status " + SERVICE_LABEL);
|
|
757
757
|
if (IS_MAC) warn(" launchctl print gui/$(id -u)/" + LAUNCHD_LABEL);
|
|
758
758
|
if (IS_WIN) warn(" schtasks /Query /TN " + WIN_TASK_NAME + " /V /FO LIST");
|
package/dist/preinstall.cjs
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
* preinstall — runs BEFORE npm replaces files on disk. Gracefully stops
|
|
5
|
-
* the running
|
|
5
|
+
* the running Omnius daemon so the install window doesn't strand it with
|
|
6
6
|
* a half-replaced binary that crashes on next relaunch.
|
|
7
7
|
*
|
|
8
8
|
* The postinstall hook restarts the daemon after install completes with
|
|
9
9
|
* the new code in place.
|
|
10
10
|
*
|
|
11
|
-
* Opt-out:
|
|
11
|
+
* Opt-out: OMNIUS_SKIP_DAEMON_INSTALL=1 (matches postinstall semantics).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
"use strict";
|
|
15
15
|
|
|
16
|
-
if (process.env.
|
|
16
|
+
if (process.env.OMNIUS_SKIP_DAEMON_INSTALL === "1") {
|
|
17
17
|
process.exit(0);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -26,9 +26,9 @@ var IS_WIN = os.platform() === "win32";
|
|
|
26
26
|
var IS_LINUX = os.platform() === "linux";
|
|
27
27
|
var IS_MAC = os.platform() === "darwin";
|
|
28
28
|
var HOME = os.homedir();
|
|
29
|
-
var SERVICE_LABEL = "
|
|
30
|
-
var LAUNCHD_LABEL = "ai.
|
|
31
|
-
var WIN_TASK_NAME = "
|
|
29
|
+
var SERVICE_LABEL = "omnius-daemon";
|
|
30
|
+
var LAUNCHD_LABEL = "ai.omnius.daemon";
|
|
31
|
+
var WIN_TASK_NAME = "OmniusDaemon";
|
|
32
32
|
|
|
33
33
|
function runQuiet(cmd) {
|
|
34
34
|
try { cp.execSync(cmd, { stdio: "pipe", timeout: 8000 }); return true; } catch (e) { return false; }
|
|
@@ -66,11 +66,11 @@ function killPidFile(pidFile) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
stopServiceManager();
|
|
69
|
-
killPidFile(path.join(HOME, ".
|
|
69
|
+
killPidFile(path.join(HOME, ".omnius", "daemon.pid"));
|
|
70
70
|
|
|
71
71
|
// Final: lsof-based sweep for any process still holding 11435.
|
|
72
72
|
try {
|
|
73
|
-
var port = parseInt(process.env.
|
|
73
|
+
var port = parseInt(process.env.OMNIUS_PORT || "11435", 10);
|
|
74
74
|
var out = "";
|
|
75
75
|
try {
|
|
76
76
|
out = cp.execSync("lsof -ti :" + port + " 2>/dev/null || true", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
ocr-advanced.py — Multi-variant, multi-PSM OCR pipeline for
|
|
3
|
+
ocr-advanced.py — Multi-variant, multi-PSM OCR pipeline for omnius.
|
|
4
4
|
|
|
5
5
|
Implements a full preprocessing + OCR + cross-reference pipeline:
|
|
6
6
|
1. Load image → grayscale → 2x upscale
|
|
@@ -490,7 +490,7 @@ def run_batch(images_dir, language="eng", do_regions=False, debug_dir=None,
|
|
|
490
490
|
|
|
491
491
|
def main():
|
|
492
492
|
parser = argparse.ArgumentParser(
|
|
493
|
-
description="Advanced multi-variant OCR pipeline for
|
|
493
|
+
description="Advanced multi-variant OCR pipeline for omnius"
|
|
494
494
|
)
|
|
495
495
|
parser.add_argument(
|
|
496
496
|
"image",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
Headless Moondream Station launcher for
|
|
3
|
+
Headless Moondream Station launcher for omnius.
|
|
4
4
|
|
|
5
5
|
Starts the Moondream vision model REST API server on port 2020 without
|
|
6
6
|
the interactive REPL. Designed to be auto-launched by the VisionTool.
|
|
@@ -6,7 +6,7 @@ HIDDEN_SERVICE_DIR="/var/lib/tor/hidden_service"
|
|
|
6
6
|
TORRC_PATH="/etc/tor/torrc"
|
|
7
7
|
BACKUP_DIR="/var/backups/tor"
|
|
8
8
|
LOG_FILE="/var/log/tor_setup.log"
|
|
9
|
-
LOCAL_SERVICE_PORT=${
|
|
9
|
+
LOCAL_SERVICE_PORT=${OMNIUS_API_PORT:-${LOCAL_SERVICE_PORT:-8080}}
|
|
10
10
|
TOR_SOCKS_PORT=${TOR_SOCKS_PORT:-9050}
|
|
11
11
|
|
|
12
12
|
# Function to log messages
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.4",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
|
@@ -19,11 +19,7 @@
|
|
|
19
19
|
"zod": "^3.24.1"
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
|
-
"
|
|
23
|
-
"hydra-ai": "dist/launcher.cjs",
|
|
24
|
-
"oa": "dist/launcher.cjs",
|
|
25
|
-
"omnius": "dist/launcher.cjs",
|
|
26
|
-
"open-agents": "dist/launcher.cjs"
|
|
22
|
+
"omnius": "dist/launcher.cjs"
|
|
27
23
|
},
|
|
28
24
|
"engines": {
|
|
29
25
|
"node": ">=22.0.0"
|