omnius 1.0.935 → 1.0.937
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/daemon-environment.cjs +139 -0
- package/dist/index.js +2 -2
- package/dist/postinstall-daemon.cjs +39 -5
- package/dist/update-worker-runtime.js +64 -3
- package/npm-shrinkwrap.json +2 -20
- package/package.json +1 -5
- package/node_modules/image-to-ascii/bin/image-to-ascii.cjs +0 -18
- package/node_modules/image-to-ascii/index.cjs +0 -308
- package/node_modules/image-to-ascii/index.d.ts +0 -48
- package/node_modules/image-to-ascii/package.json +0 -22
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
function decode(value) {
|
|
7
|
+
if ((value[0] === '"' || value[0] === "'") && value[value.length - 1] === value[0]) value = value.slice(1, -1);
|
|
8
|
+
return value.replace(/\\(?:x([a-f0-9]{2})|([\\"'\s])|([snrt]))/gi, (_, hex, literal, escaped) =>
|
|
9
|
+
hex ? String.fromCharCode(parseInt(hex, 16)) : literal || ({ s: " ", n: "\n", r: "\r", t: "\t" })[escaped]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function entry(value, optional) {
|
|
13
|
+
let file = decode(value.trim());
|
|
14
|
+
if (file[0] === "-") { optional = true; file = file.slice(1); }
|
|
15
|
+
if (!path.isAbsolute(file) || /[\x00-\x1f\x7f]/.test(file)) throw new Error("Daemon environment file paths must be absolute and contain no control characters");
|
|
16
|
+
return { path: path.resolve(file), optional: Boolean(optional) };
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Parse systemctl's EnvironmentFiles value, including its ignore_errors flags. */
|
|
20
|
+
function parseEnvironmentFiles(value) {
|
|
21
|
+
if (typeof value !== "string" || value.length > 128 * 1024) throw new Error("Invalid daemon EnvironmentFiles value");
|
|
22
|
+
value = value.replace(/^EnvironmentFiles=/, "").trim();
|
|
23
|
+
if (!value) return [];
|
|
24
|
+
const result = [];
|
|
25
|
+
const marker = /\s+\(ignore_errors=(yes|no)\)/g;
|
|
26
|
+
let at = 0, match;
|
|
27
|
+
while ((match = marker.exec(value))) {
|
|
28
|
+
result.push(entry(value.slice(at, match.index), match[1] === "yes"));
|
|
29
|
+
at = marker.lastIndex;
|
|
30
|
+
}
|
|
31
|
+
const remainder = value.slice(at).trim();
|
|
32
|
+
if (remainder) {
|
|
33
|
+
const tokens = remainder.match(/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\\.|[^\s"'\\])+/g) || [];
|
|
34
|
+
if (tokens.join(" ").replace(/\s+/g, " ") !== remainder.replace(/\s+/g, " ")) throw new Error("Invalid daemon EnvironmentFiles quoting");
|
|
35
|
+
for (const token of tokens) result.push(entry(token, false));
|
|
36
|
+
}
|
|
37
|
+
if (result.length > 256) throw new Error("Too many daemon environment files");
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const inside = (root, file) => file !== root && !path.relative(root, file).startsWith(".." + path.sep) && path.relative(root, file) !== ".." && !path.isAbsolute(path.relative(root, file));
|
|
42
|
+
|
|
43
|
+
/** Missing declared files become empty private configuration, never inferred values.
|
|
44
|
+
* Linux operations stay anchored to open directories, including symlinked data roots.
|
|
45
|
+
*/
|
|
46
|
+
function ensureEnvironmentFiles(options) {
|
|
47
|
+
if (!options || !path.isAbsolute(options.homeDir || "")) throw new Error("Daemon environment migration requires an absolute owner home");
|
|
48
|
+
const home = path.resolve(options.homeDir);
|
|
49
|
+
const roots = [path.join(home, ".omnius"), path.join(home, ".config", "omnius")];
|
|
50
|
+
if (options.dataDir !== undefined) {
|
|
51
|
+
if (!path.isAbsolute(options.dataDir)) throw new Error("Daemon data directory must be absolute");
|
|
52
|
+
roots.push(path.resolve(options.dataDir));
|
|
53
|
+
}
|
|
54
|
+
const uid = options.uid === undefined ? process.getuid?.() : options.uid;
|
|
55
|
+
const gid = options.gid === undefined ? process.getgid?.() : options.gid;
|
|
56
|
+
if (uid !== undefined && (!Number.isSafeInteger(uid) || uid < 0) || gid !== undefined && (!Number.isSafeInteger(gid) || gid < 0)) throw new Error("Invalid daemon environment owner");
|
|
57
|
+
const values = typeof options.environmentFiles === "string" ? parseEnvironmentFiles(options.environmentFiles) : options.environmentFiles;
|
|
58
|
+
if (!Array.isArray(values) || values.length > 256) throw new Error("Invalid daemon environment file entries");
|
|
59
|
+
const result = { created: [], existing: [], unmanagedMissing: [] };
|
|
60
|
+
const seen = new Set();
|
|
61
|
+
const descriptors = [];
|
|
62
|
+
const anchored = process.platform === "linux";
|
|
63
|
+
const fdPath = (fd, name, fallback) => anchored ? `/proc/self/fd/${fd}/${name}` : fallback;
|
|
64
|
+
const owner = (stat, label) => {
|
|
65
|
+
if (!stat.isDirectory() || process.platform !== "win32" && uid !== undefined && stat.uid !== uid) throw new Error(`Daemon environment directory is not owned by the service user: ${label}`);
|
|
66
|
+
};
|
|
67
|
+
const openDirectory = (location, label) => {
|
|
68
|
+
const fd = fs.openSync(location, fs.constants.O_RDONLY | (fs.constants.O_DIRECTORY || 0) | (fs.constants.O_NOFOLLOW || 0));
|
|
69
|
+
try { owner(fs.fstatSync(fd), label); } catch (error) { fs.closeSync(fd); throw error; }
|
|
70
|
+
descriptors.push(fd); return fd;
|
|
71
|
+
};
|
|
72
|
+
const walk = (initialFd, initialPath, components) => {
|
|
73
|
+
let fd = initialFd, location = initialPath;
|
|
74
|
+
for (const component of components) {
|
|
75
|
+
if (!component || component === "." || component === "..") throw new Error("Invalid daemon environment directory component");
|
|
76
|
+
location = path.join(location, component);
|
|
77
|
+
const next = fdPath(fd, component, location);
|
|
78
|
+
let created = false;
|
|
79
|
+
try { fs.mkdirSync(next, { mode: 0o700 }); created = true; }
|
|
80
|
+
catch (error) { if (error.code !== "EEXIST") throw error; }
|
|
81
|
+
const nextFd = fs.openSync(next, fs.constants.O_RDONLY | (fs.constants.O_DIRECTORY || 0) | (fs.constants.O_NOFOLLOW || 0));
|
|
82
|
+
try {
|
|
83
|
+
if (created) {
|
|
84
|
+
fs.fchmodSync(nextFd, 0o700);
|
|
85
|
+
if (process.platform !== "win32" && process.getuid?.() === 0 && uid !== undefined && gid !== undefined) fs.fchownSync(nextFd, uid, gid);
|
|
86
|
+
}
|
|
87
|
+
owner(fs.fstatSync(nextFd), location);
|
|
88
|
+
} catch (error) { fs.closeSync(nextFd); throw error; }
|
|
89
|
+
descriptors.push(nextFd); fd = nextFd;
|
|
90
|
+
}
|
|
91
|
+
return fd;
|
|
92
|
+
};
|
|
93
|
+
const openRoot = root => {
|
|
94
|
+
try { return openDirectory(fs.realpathSync(root), root); }
|
|
95
|
+
catch (error) {
|
|
96
|
+
if (error.code !== "ENOENT") throw error;
|
|
97
|
+
if (inside(home, root)) {
|
|
98
|
+
const realHome = fs.realpathSync(home);
|
|
99
|
+
return walk(openDirectory(realHome, home), realHome, path.relative(home, root).split(path.sep));
|
|
100
|
+
}
|
|
101
|
+
const parent = fs.realpathSync(path.dirname(root));
|
|
102
|
+
return walk(openDirectory(parent, path.dirname(root)), parent, [path.basename(root)]);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
try {
|
|
106
|
+
for (const value of values) {
|
|
107
|
+
if (!value || typeof value.path !== "string" || typeof value.optional !== "boolean") throw new Error("Invalid daemon environment file entry");
|
|
108
|
+
const file = entry(value.path, value.optional).path;
|
|
109
|
+
if (seen.has(file)) continue;
|
|
110
|
+
seen.add(file);
|
|
111
|
+
const root = roots.find(candidate => inside(candidate, file));
|
|
112
|
+
if (!root) {
|
|
113
|
+
try { fs.lstatSync(file); result.existing.push(file); }
|
|
114
|
+
catch (error) { if (error.code !== "ENOENT") throw error; result.unmanagedMissing.push(file); }
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const rootFd = openRoot(root);
|
|
118
|
+
const relative = path.relative(root, file).split(path.sep), name = relative.pop();
|
|
119
|
+
const parentFd = walk(rootFd, root, relative);
|
|
120
|
+
const target = fdPath(parentFd, name, file);
|
|
121
|
+
let fd;
|
|
122
|
+
try { fd = fs.openSync(target, fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL | (fs.constants.O_NOFOLLOW || 0), 0o600); }
|
|
123
|
+
catch (error) { if (error.code === "EEXIST") { result.existing.push(file); continue; } throw error; }
|
|
124
|
+
try {
|
|
125
|
+
fs.fchmodSync(fd, 0o600);
|
|
126
|
+
if (process.platform !== "win32" && process.getuid?.() === 0 && uid !== undefined && gid !== undefined) fs.fchownSync(fd, uid, gid);
|
|
127
|
+
fs.writeFileSync(fd, "# Optional Omnius daemon runtime overrides (KEY=value).\n");
|
|
128
|
+
fs.fsyncSync(fd);
|
|
129
|
+
result.created.push(file);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
try { fs.unlinkSync(target); } catch {}
|
|
132
|
+
throw error;
|
|
133
|
+
} finally { fs.closeSync(fd); }
|
|
134
|
+
}
|
|
135
|
+
return result;
|
|
136
|
+
} finally { for (const fd of descriptors.reverse()) fs.closeSync(fd); }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
module.exports = { parseEnvironmentFiles, ensureEnvironmentFiles };
|
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:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 41412175 bytes
|
|
4
|
+
sha256: 4230b7f23c034a56aaca669cfb19e372153fb9a6445aa9b602ede3758fffa21f
|
|
@@ -725,17 +725,41 @@ function installDesktopCompanion(nodeBin, omniusScript, user) {
|
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
727
|
|
|
728
|
+
// Older builds and operator drop-ins (e.g. cygnus-env.conf) can declare
|
|
729
|
+
// EnvironmentFile= paths that were never created; systemd then refuses to
|
|
730
|
+
// start the unit. Create only the missing ones, empty and private, under the
|
|
731
|
+
// owner's Omnius directories. Existing contents are never touched.
|
|
732
|
+
function ensureDeclaredDaemonEnvironmentFiles(sysctl, userHome, user) {
|
|
733
|
+
try {
|
|
734
|
+
var shown = runCapture(sysctl + " show " + SERVICE_LABEL + ".service --property=EnvironmentFiles");
|
|
735
|
+
var lines = shown.split(/\r?\n/).filter(function (line) { return line.indexOf("EnvironmentFiles=") === 0; });
|
|
736
|
+
if (lines.length === 0) return;
|
|
737
|
+
var helper = require(path.join(__dirname, "daemon-environment.cjs"));
|
|
738
|
+
var entries = [];
|
|
739
|
+
lines.forEach(function (line) { entries = entries.concat(helper.parseEnvironmentFiles(line)); });
|
|
740
|
+
var ids = {};
|
|
741
|
+
if (user) {
|
|
742
|
+
var account = runCapture("getent passwd " + user).split(":");
|
|
743
|
+
if (account[0] === user && /^\d+$/.test(account[2] || "") && /^\d+$/.test(account[3] || "")) {
|
|
744
|
+
ids.uid = Number(account[2]); ids.gid = Number(account[3]);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
var result = helper.ensureEnvironmentFiles(Object.assign({ environmentFiles: entries, homeDir: userHome }, ids));
|
|
748
|
+
result.created.forEach(function (file) { log("Created missing daemon environment file: " + file); });
|
|
749
|
+
result.unmanagedMissing.forEach(function (file) {
|
|
750
|
+
warn("Daemon unit requires " + file + " outside the Omnius directories; create it manually.");
|
|
751
|
+
});
|
|
752
|
+
} catch (e) {
|
|
753
|
+
warn("Could not verify daemon environment files: " + (e && e.message));
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
728
757
|
function installSystemd(nodeBin, omniusScript, user) {
|
|
729
758
|
if (!IS_LINUX) return false;
|
|
730
759
|
if (!hasCmd("systemctl")) {
|
|
731
760
|
warn("systemctl not found — skipping systemd install.");
|
|
732
761
|
return false;
|
|
733
762
|
}
|
|
734
|
-
if (hasSystemDaemonUnit()) {
|
|
735
|
-
log("Native system daemon unit is installed; preserving its launcher and sole service ownership.");
|
|
736
|
-
return true;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
763
|
var userHome = user === process.env.USER ? HOME : path.join("/home", user);
|
|
740
764
|
try {
|
|
741
765
|
var pwdEntry = runCapture("getent passwd " + user);
|
|
@@ -745,6 +769,12 @@ function installSystemd(nodeBin, omniusScript, user) {
|
|
|
745
769
|
}
|
|
746
770
|
} catch (e) {}
|
|
747
771
|
|
|
772
|
+
if (hasSystemDaemonUnit()) {
|
|
773
|
+
log("Native system daemon unit is installed; preserving its launcher and sole service ownership.");
|
|
774
|
+
ensureDeclaredDaemonEnvironmentFiles("systemctl", userHome, user);
|
|
775
|
+
return true;
|
|
776
|
+
}
|
|
777
|
+
|
|
748
778
|
var unitDir = path.join(userHome, ".config", "systemd", "user");
|
|
749
779
|
var unitPath = path.join(unitDir, SERVICE_LABEL + ".service");
|
|
750
780
|
var envDir = path.join(userHome, ".config", "omnius");
|
|
@@ -837,6 +867,10 @@ function installSystemd(nodeBin, omniusScript, user) {
|
|
|
837
867
|
|
|
838
868
|
var sysctl = asUserPrefix + "systemctl --user";
|
|
839
869
|
runQuiet(sysctl + " daemon-reload");
|
|
870
|
+
ensureDeclaredDaemonEnvironmentFiles(sysctl, userHome, user);
|
|
871
|
+
// A unit that previously failed (e.g. a missing EnvironmentFile) can be
|
|
872
|
+
// rate-limited; clear that state so the restart below is actually attempted.
|
|
873
|
+
runQuiet(sysctl + " reset-failed " + SERVICE_LABEL + ".service");
|
|
840
874
|
var enabled = runQuiet(sysctl + " enable " + SERVICE_LABEL + ".service");
|
|
841
875
|
var restarted = runQuiet(sysctl + " restart " + SERVICE_LABEL + ".service");
|
|
842
876
|
|
|
@@ -304039,9 +304039,19 @@ var init_daemon_supervision = __esm({
|
|
|
304039
304039
|
|
|
304040
304040
|
// packages/cli/src/daemon-service.ts
|
|
304041
304041
|
import { spawn } from "node:child_process";
|
|
304042
|
+
import { createRequire } from "node:module";
|
|
304042
304043
|
import { chownSync, existsSync as existsSync5, mkdirSync as mkdirSync5, readFileSync as readFileSync5, realpathSync as realpathSync2, renameSync as renameSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
304043
304044
|
import { homedir as homedir14, userInfo } from "node:os";
|
|
304044
304045
|
import { dirname as dirname7, isAbsolute as isAbsolute6, join as join14, resolve as resolve10 } from "node:path";
|
|
304046
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
304047
|
+
async function serviceOwnerAccount(user) {
|
|
304048
|
+
const current = userInfo();
|
|
304049
|
+
if (!user || user === current.username) return { user: current.username, uid: current.uid, homeDir: homedir14() };
|
|
304050
|
+
const result = await runDaemonServiceCommand("getent", ["passwd", user], 5e3), fields = result.stdout.trim().split(":");
|
|
304051
|
+
if (result.code !== 0 || fields[0] !== user || !Number.isSafeInteger(Number(fields[2])) || !isAbsolute6(fields[5] || ""))
|
|
304052
|
+
throw new Error(`Cannot resolve service owner ${user}`);
|
|
304053
|
+
return { user, uid: Number(fields[2]), homeDir: fields[5] };
|
|
304054
|
+
}
|
|
304045
304055
|
function daemonSystemctlArgs(scope, args) {
|
|
304046
304056
|
return scope === "user" ? ["--user", ...args] : args;
|
|
304047
304057
|
}
|
|
@@ -304073,6 +304083,53 @@ async function runManagedDaemonSystemctl(args, timeoutMs = 2e4) {
|
|
|
304073
304083
|
const service = await discoverManagedDaemonService();
|
|
304074
304084
|
return runDaemonServiceControl(service?.scope ?? "user", args, timeoutMs);
|
|
304075
304085
|
}
|
|
304086
|
+
function daemonOwnerAwareRunner(owner, run2 = runDaemonServiceCommand) {
|
|
304087
|
+
return (command, args, timeoutMs) => command === "systemctl" && args.includes("--user") && process.getuid?.() === 0 && owner && owner.uid !== 0 ? run2("runuser", [
|
|
304088
|
+
"-u",
|
|
304089
|
+
owner.user,
|
|
304090
|
+
"--",
|
|
304091
|
+
"env",
|
|
304092
|
+
`XDG_RUNTIME_DIR=/run/user/${owner.uid}`,
|
|
304093
|
+
`DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${owner.uid}/bus`,
|
|
304094
|
+
command,
|
|
304095
|
+
...args
|
|
304096
|
+
], timeoutMs) : run2(command, args, timeoutMs);
|
|
304097
|
+
}
|
|
304098
|
+
function loadDaemonEnvironmentModule() {
|
|
304099
|
+
if (daemonEnvironmentModule) return daemonEnvironmentModule;
|
|
304100
|
+
const here = dirname7(fileURLToPath2(import.meta.url)), require2 = createRequire(import.meta.url);
|
|
304101
|
+
for (const candidate of [join14(here, "daemon-environment.cjs"), join14(here, "..", "scripts", "daemon-environment.cjs")])
|
|
304102
|
+
if (existsSync5(candidate)) return daemonEnvironmentModule = require2(candidate);
|
|
304103
|
+
throw new Error("The daemon environment helper is missing from this installation");
|
|
304104
|
+
}
|
|
304105
|
+
function daemonEnvironmentFilesFromShow(output) {
|
|
304106
|
+
const { parseEnvironmentFiles } = loadDaemonEnvironmentModule();
|
|
304107
|
+
return output.split(/\r?\n/).filter((line) => line.startsWith("EnvironmentFiles=")).flatMap((line) => parseEnvironmentFiles(line));
|
|
304108
|
+
}
|
|
304109
|
+
async function ensureManagedDaemonEnvironmentFiles(service, run2 = runDaemonServiceCommand) {
|
|
304110
|
+
const managed = service === void 0 ? await discoverManagedDaemonService(run2) : service;
|
|
304111
|
+
if (!managed || process.platform !== "linux") return null;
|
|
304112
|
+
const owner = await serviceOwnerAccount(managed.user || void 0);
|
|
304113
|
+
const shown = await daemonOwnerAwareRunner(owner, run2)("systemctl", daemonSystemctlArgs(
|
|
304114
|
+
managed.scope,
|
|
304115
|
+
["show", DAEMON_SERVICE_UNIT, "--property=EnvironmentFiles,Environment"]
|
|
304116
|
+
), 5e3);
|
|
304117
|
+
if (shown.code !== 0) return null;
|
|
304118
|
+
const environmentFiles = daemonEnvironmentFilesFromShow(shown.stdout);
|
|
304119
|
+
if (environmentFiles.length === 0) return { created: [], existing: [], unmanagedMissing: [] };
|
|
304120
|
+
const dataDir = shown.stdout.match(/(?:^|\s)OMNIUS_HOME=(?:"([^"]+)"|'([^']+)'|([^\s]+))/)?.slice(1).find(Boolean);
|
|
304121
|
+
const account = owner.user === userInfo().username ? { uid: userInfo().uid, gid: userInfo().gid } : await (async () => {
|
|
304122
|
+
const fields = (await run2("getent", ["passwd", owner.user], 5e3)).stdout.trim().split(":");
|
|
304123
|
+
return { uid: Number(fields[2]), gid: Number(fields[3]) };
|
|
304124
|
+
})();
|
|
304125
|
+
return loadDaemonEnvironmentModule().ensureEnvironmentFiles({
|
|
304126
|
+
environmentFiles,
|
|
304127
|
+
homeDir: owner.homeDir,
|
|
304128
|
+
...dataDir && isAbsolute6(dataDir) ? { dataDir } : {},
|
|
304129
|
+
uid: account.uid,
|
|
304130
|
+
gid: account.gid
|
|
304131
|
+
});
|
|
304132
|
+
}
|
|
304076
304133
|
async function runDaemonServiceControl(scope, args, timeoutMs = 2e4, run2 = runDaemonServiceCommand) {
|
|
304077
304134
|
const commandArgs = daemonSystemctlArgs(scope, ["--no-ask-password", ...args]);
|
|
304078
304135
|
const result = await run2("systemctl", commandArgs, timeoutMs);
|
|
@@ -304189,7 +304246,7 @@ async function resolveDaemonServiceDefinition(options, run2 = runDaemonServiceCo
|
|
|
304189
304246
|
workingDirectory: resolve10(options.workingDirectory || homeDir)
|
|
304190
304247
|
};
|
|
304191
304248
|
}
|
|
304192
|
-
var DAEMON_SERVICE_UNIT, DAEMON_SERVICE_STOP_GRACE_MS, DAEMON_SERVICE_COMMAND_TIMEOUT_MS, runDaemonServiceCommand;
|
|
304249
|
+
var DAEMON_SERVICE_UNIT, DAEMON_SERVICE_STOP_GRACE_MS, DAEMON_SERVICE_COMMAND_TIMEOUT_MS, runDaemonServiceCommand, daemonEnvironmentModule;
|
|
304193
304250
|
var init_daemon_service = __esm({
|
|
304194
304251
|
"packages/cli/src/daemon-service.ts"() {
|
|
304195
304252
|
DAEMON_SERVICE_UNIT = "omnius-daemon.service";
|
|
@@ -304233,7 +304290,7 @@ import { existsSync as existsSync6, readFileSync as readFileSync6, writeFileSync
|
|
|
304233
304290
|
import { join as join15 } from "node:path";
|
|
304234
304291
|
import { homedir as homedir15 } from "node:os";
|
|
304235
304292
|
import { createServer as createNetServer } from "node:net";
|
|
304236
|
-
import { fileURLToPath as
|
|
304293
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
304237
304294
|
import { dirname as dirname8 } from "node:path";
|
|
304238
304295
|
function getDaemonPort() {
|
|
304239
304296
|
const env = process.env["OMNIUS_HOST"];
|
|
@@ -304691,6 +304748,10 @@ async function restartDaemon(port, expectedVersion, preferredEntrypoint) {
|
|
|
304691
304748
|
if (!reclaimed2.ok) return false;
|
|
304692
304749
|
await reclaimStaleDaemonEndpointClaim(p, new Set(reclaimed2.clearedPids));
|
|
304693
304750
|
}
|
|
304751
|
+
try {
|
|
304752
|
+
await ensureManagedDaemonEnvironmentFiles();
|
|
304753
|
+
} catch {
|
|
304754
|
+
}
|
|
304694
304755
|
await runUserSystemctl(["reset-failed", "omnius-daemon.service"]);
|
|
304695
304756
|
const restarted = await runUserSystemctl(["restart", "omnius-daemon.service"]);
|
|
304696
304757
|
if (restarted.ok && (await waitForDaemonReady(p, expectedVersion)).ok) return true;
|
|
@@ -304735,7 +304796,7 @@ function commandForEntrypoint(path3, nodeExe) {
|
|
|
304735
304796
|
async function resolveDaemonCommand(nodeExe, preferredEntrypoint) {
|
|
304736
304797
|
const candidates = [];
|
|
304737
304798
|
if (preferredEntrypoint) candidates.push(preferredEntrypoint);
|
|
304738
|
-
const thisDir = dirname8(
|
|
304799
|
+
const thisDir = dirname8(fileURLToPath3(import.meta.url));
|
|
304739
304800
|
candidates.push(join15(thisDir, "index.js"));
|
|
304740
304801
|
if (process.argv[1]) candidates.push(process.argv[1]);
|
|
304741
304802
|
const which = await runUtilityCommand(
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.937",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
10
|
-
"bundleDependencies": [
|
|
11
|
-
"image-to-ascii"
|
|
12
|
-
],
|
|
9
|
+
"version": "1.0.937",
|
|
13
10
|
"hasInstallScript": true,
|
|
14
11
|
"license": "CC-BY-NC-4.0",
|
|
15
12
|
"dependencies": {
|
|
@@ -29,7 +26,6 @@
|
|
|
29
26
|
"bun": "1.3.14",
|
|
30
27
|
"glob": "^13.0.6",
|
|
31
28
|
"ignore": "^7.0.5",
|
|
32
|
-
"image-to-ascii": "file:vendor/image-to-ascii",
|
|
33
29
|
"libp2p": "3.3.0",
|
|
34
30
|
"nats.ws": "1.30.3",
|
|
35
31
|
"open-agents-nexus": "1.17.3",
|
|
@@ -6985,10 +6981,6 @@
|
|
|
6985
6981
|
"integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==",
|
|
6986
6982
|
"license": "MIT"
|
|
6987
6983
|
},
|
|
6988
|
-
"node_modules/image-to-ascii": {
|
|
6989
|
-
"resolved": "vendor/image-to-ascii",
|
|
6990
|
-
"link": true
|
|
6991
|
-
},
|
|
6992
6984
|
"node_modules/imurmurhash": {
|
|
6993
6985
|
"version": "0.1.4",
|
|
6994
6986
|
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
|
@@ -10860,16 +10852,6 @@
|
|
|
10860
10852
|
"url": "https://github.com/sponsors/colinhacks"
|
|
10861
10853
|
}
|
|
10862
10854
|
},
|
|
10863
|
-
"vendor/image-to-ascii": {
|
|
10864
|
-
"version": "3.3.0-omnius.1",
|
|
10865
|
-
"license": "MIT",
|
|
10866
|
-
"bin": {
|
|
10867
|
-
"image-to-ascii": "bin/image-to-ascii.cjs"
|
|
10868
|
-
},
|
|
10869
|
-
"engines": {
|
|
10870
|
-
"node": ">=22.0.0"
|
|
10871
|
-
}
|
|
10872
|
-
},
|
|
10873
10855
|
"vendor/moondream": {
|
|
10874
10856
|
"version": "0.2.0-omnius.1",
|
|
10875
10857
|
"license": "MIT",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.937",
|
|
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/library.js",
|
|
@@ -107,7 +107,6 @@
|
|
|
107
107
|
"better-sqlite3": "^12.10.0",
|
|
108
108
|
"glob": "^13.0.6",
|
|
109
109
|
"ignore": "^7.0.5",
|
|
110
|
-
"image-to-ascii": "file:vendor/image-to-ascii",
|
|
111
110
|
"nats.ws": "1.30.3",
|
|
112
111
|
"open-agents-nexus": "1.17.3",
|
|
113
112
|
"ws": "^8.20.0",
|
|
@@ -130,9 +129,6 @@
|
|
|
130
129
|
"rea-agents": "6.7.0",
|
|
131
130
|
"@types/node": "^22.19.19"
|
|
132
131
|
},
|
|
133
|
-
"bundledDependencies": [
|
|
134
|
-
"image-to-ascii"
|
|
135
|
-
],
|
|
136
132
|
"overrides": {
|
|
137
133
|
"@helia/dag-json": "5.0.7",
|
|
138
134
|
"@helia/json": "5.0.7",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
var imageToAscii = require("../index.cjs");
|
|
5
|
-
|
|
6
|
-
var source = process.argv[2];
|
|
7
|
-
if (!source) {
|
|
8
|
-
process.stderr.write("Usage: image-to-ascii <image-path-or-url>\n");
|
|
9
|
-
process.exit(2);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
imageToAscii(source, { colored: false }, function (err, converted) {
|
|
13
|
-
if (err) {
|
|
14
|
-
process.stderr.write((err && err.message ? err.message : String(err)) + "\n");
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
process.stdout.write(String(converted || "") + "\n");
|
|
18
|
-
});
|
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var childProcess = require("node:child_process");
|
|
4
|
-
var crypto = require("node:crypto");
|
|
5
|
-
var fs = require("node:fs");
|
|
6
|
-
var os = require("node:os");
|
|
7
|
-
var path = require("node:path");
|
|
8
|
-
|
|
9
|
-
var DEFAULT_PIXELS = " .,:;i1tfLCG08@";
|
|
10
|
-
|
|
11
|
-
function isObject(value) {
|
|
12
|
-
return value !== null && typeof value === "object" && !Buffer.isBuffer(value);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function clamp(value, min, max) {
|
|
16
|
-
var n = Number(value);
|
|
17
|
-
if (!Number.isFinite(n)) return min;
|
|
18
|
-
n = Math.floor(n);
|
|
19
|
-
return Math.max(min, Math.min(max, n));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function clampByte(value, fallback) {
|
|
23
|
-
var n = Number(value);
|
|
24
|
-
if (!Number.isFinite(n)) return fallback;
|
|
25
|
-
return clamp(n, 0, 255);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function normalizeRgb(value, fallback) {
|
|
29
|
-
if (!isObject(value)) return fallback || null;
|
|
30
|
-
return {
|
|
31
|
-
r: clampByte(value.r, fallback ? fallback.r : 0),
|
|
32
|
-
g: clampByte(value.g, fallback ? fallback.g : 0),
|
|
33
|
-
b: clampByte(value.b, fallback ? fallback.b : 0)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function rgbToFfmpegColor(rgb) {
|
|
38
|
-
if (!rgb) return "black";
|
|
39
|
-
function hex(value) {
|
|
40
|
-
return clampByte(value, 0).toString(16).padStart(2, "0");
|
|
41
|
-
}
|
|
42
|
-
return "0x" + hex(rgb.r) + hex(rgb.g) + hex(rgb.b);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function luminance(r, g, b) {
|
|
46
|
-
return clampByte(Math.round((0.2126 * r) + (0.7152 * g) + (0.0722 * b)), 0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function percentOrNumber(value, basis, fallback) {
|
|
50
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
51
|
-
if (typeof value === "string") {
|
|
52
|
-
var trimmed = value.trim();
|
|
53
|
-
if (trimmed.endsWith("%")) {
|
|
54
|
-
var pct = Number(trimmed.slice(0, -1));
|
|
55
|
-
if (Number.isFinite(pct)) return Math.max(1, Math.floor((basis * pct) / 100));
|
|
56
|
-
}
|
|
57
|
-
var parsed = Number(trimmed);
|
|
58
|
-
if (Number.isFinite(parsed)) return parsed;
|
|
59
|
-
}
|
|
60
|
-
return fallback;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function resolveSize(options) {
|
|
64
|
-
var size = isObject(options.size) ? options.size : {};
|
|
65
|
-
var sizeOptions = isObject(options.size_options) ? options.size_options : {};
|
|
66
|
-
var screen = isObject(sizeOptions.screen_size) ? sizeOptions.screen_size : {};
|
|
67
|
-
var screenWidth = clamp(screen.width || process.stdout.columns || 80, 20, 240);
|
|
68
|
-
var screenHeight = clamp(screen.height || process.stdout.rows || 32, 8, 120);
|
|
69
|
-
var width = percentOrNumber(size.width, screenWidth, Math.min(80, screenWidth));
|
|
70
|
-
var height = percentOrNumber(size.height, screenHeight, Math.max(8, Math.round(width * 0.42)));
|
|
71
|
-
return {
|
|
72
|
-
width: clamp(width, 8, 240),
|
|
73
|
-
height: clamp(height, 4, 120)
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function normalizeOptions(options) {
|
|
78
|
-
if (!isObject(options)) options = {};
|
|
79
|
-
var pixels = options.pixels;
|
|
80
|
-
if (Array.isArray(pixels)) pixels = pixels.join("");
|
|
81
|
-
if (typeof pixels !== "string" || pixels.length < 2) pixels = DEFAULT_PIXELS;
|
|
82
|
-
if (options.reverse === true) pixels = pixels.split("").reverse().join("");
|
|
83
|
-
var pxBackground = null;
|
|
84
|
-
if (options.white_bg === true) pxBackground = { r: 255, g: 255, b: 255 };
|
|
85
|
-
if (isObject(options.px_background)) pxBackground = normalizeRgb(options.px_background, pxBackground);
|
|
86
|
-
return {
|
|
87
|
-
pixels: pixels,
|
|
88
|
-
colored: options.colored === true,
|
|
89
|
-
colorBackground: options.bg === true,
|
|
90
|
-
pxBackground: pxBackground,
|
|
91
|
-
concat: options.concat !== false,
|
|
92
|
-
stringify: options.stringify !== false,
|
|
93
|
-
timeoutMs: clamp(options.timeoutMs || options.timeout || 5000, 500, 60000),
|
|
94
|
-
preserveAspectRatio: !options.size_options || options.size_options.preserve_aspect_ratio !== false,
|
|
95
|
-
size: resolveSize(options),
|
|
96
|
-
stringifyFn: typeof options.stringify_fn === "function" ? options.stringify_fn : null
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function tempFilePath(ext) {
|
|
101
|
-
var suffix = ext || ".img";
|
|
102
|
-
if (!suffix.startsWith(".")) suffix = "." + suffix;
|
|
103
|
-
return path.join(os.tmpdir(), "omnius-image-to-ascii-" + crypto.randomUUID() + suffix);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function extensionFromUrl(url) {
|
|
107
|
-
try {
|
|
108
|
-
var parsed = new URL(url);
|
|
109
|
-
var ext = path.extname(parsed.pathname || "");
|
|
110
|
-
return ext || ".img";
|
|
111
|
-
} catch (e) {
|
|
112
|
-
return ".img";
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function sourceToFile(source, callback) {
|
|
117
|
-
if (Buffer.isBuffer(source)) {
|
|
118
|
-
var bufPath = tempFilePath(".img");
|
|
119
|
-
fs.writeFile(bufPath, source, function (err) {
|
|
120
|
-
callback(err, bufPath, true);
|
|
121
|
-
});
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (typeof source !== "string" || source.trim().length === 0) {
|
|
126
|
-
callback(new Error("image-to-ascii source must be a file path, URL, or Buffer"));
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (/^https?:\/\//i.test(source)) {
|
|
131
|
-
if (typeof fetch !== "function") {
|
|
132
|
-
callback(new Error("image-to-ascii URL input requires Node fetch support"));
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
fetch(source).then(function (res) {
|
|
136
|
-
if (!res.ok) throw new Error("image-to-ascii failed to fetch image: HTTP " + res.status);
|
|
137
|
-
return res.arrayBuffer();
|
|
138
|
-
}).then(function (arrayBuffer) {
|
|
139
|
-
var urlPath = tempFilePath(extensionFromUrl(source));
|
|
140
|
-
fs.writeFile(urlPath, Buffer.from(arrayBuffer), function (err) {
|
|
141
|
-
callback(err, urlPath, true);
|
|
142
|
-
});
|
|
143
|
-
}).catch(function (err) {
|
|
144
|
-
callback(err);
|
|
145
|
-
});
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
callback(null, source, false);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function buildFilter(width, height, preserveAspectRatio, pxBackground) {
|
|
153
|
-
if (preserveAspectRatio) {
|
|
154
|
-
var padColor = rgbToFfmpegColor(pxBackground);
|
|
155
|
-
return [
|
|
156
|
-
"scale=" + width + ":" + height + ":force_original_aspect_ratio=decrease",
|
|
157
|
-
"pad=" + width + ":" + height + ":(ow-iw)/2:(oh-ih)/2:color=" + padColor,
|
|
158
|
-
"format=rgba"
|
|
159
|
-
].join(",");
|
|
160
|
-
}
|
|
161
|
-
return "scale=" + width + ":" + height + ",format=rgba";
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function matrixFromRaw(raw, width, height, pxBackground) {
|
|
165
|
-
var matrix = [];
|
|
166
|
-
for (var y = 0; y < height; y++) {
|
|
167
|
-
var row = [];
|
|
168
|
-
for (var x = 0; x < width; x++) {
|
|
169
|
-
var offset = ((y * width) + x) * 4;
|
|
170
|
-
var r = raw[offset] || 0;
|
|
171
|
-
var g = raw[offset + 1] || 0;
|
|
172
|
-
var b = raw[offset + 2] || 0;
|
|
173
|
-
var a = raw[offset + 3];
|
|
174
|
-
if (a == null) a = 255;
|
|
175
|
-
if (pxBackground && a < 255) {
|
|
176
|
-
var alpha = a / 255;
|
|
177
|
-
r = Math.round((r * alpha) + (pxBackground.r * (1 - alpha)));
|
|
178
|
-
g = Math.round((g * alpha) + (pxBackground.g * (1 - alpha)));
|
|
179
|
-
b = Math.round((b * alpha) + (pxBackground.b * (1 - alpha)));
|
|
180
|
-
a = 255;
|
|
181
|
-
}
|
|
182
|
-
var value = luminance(r, g, b);
|
|
183
|
-
row.push({ r: r, g: g, b: b, a: a, value: value });
|
|
184
|
-
}
|
|
185
|
-
matrix.push(row);
|
|
186
|
-
}
|
|
187
|
-
return matrix;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function stringifyMatrix(matrix, options) {
|
|
191
|
-
var lines = [];
|
|
192
|
-
var pixels = options.pixels;
|
|
193
|
-
var maxIdx = pixels.length - 1;
|
|
194
|
-
for (var y = 0; y < matrix.length; y++) {
|
|
195
|
-
var line = "";
|
|
196
|
-
for (var x = 0; x < matrix[y].length; x++) {
|
|
197
|
-
var pixel = matrix[y][x] || {};
|
|
198
|
-
var value = pixel.value || 0;
|
|
199
|
-
var idx = Math.round((value / 255) * maxIdx);
|
|
200
|
-
var ch = pixels[idx] || " ";
|
|
201
|
-
if (options.colored) {
|
|
202
|
-
var r = pixel.r == null ? value : pixel.r;
|
|
203
|
-
var g = pixel.g == null ? value : pixel.g;
|
|
204
|
-
var b = pixel.b == null ? value : pixel.b;
|
|
205
|
-
var mode = options.colorBackground ? "48" : "38";
|
|
206
|
-
line += "\x1b[" + mode + ";2;" + r + ";" + g + ";" + b + "m" + ch + "\x1b[0m";
|
|
207
|
-
} else {
|
|
208
|
-
line += ch;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
lines.push(line.replace(/\s+$/g, ""));
|
|
212
|
-
}
|
|
213
|
-
return options.concat ? lines.join("\n") : lines;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function renderFile(filePath, options, callback) {
|
|
217
|
-
var width = options.size.width;
|
|
218
|
-
var height = options.size.height;
|
|
219
|
-
var args = [
|
|
220
|
-
"-hide_banner",
|
|
221
|
-
"-loglevel",
|
|
222
|
-
"error",
|
|
223
|
-
"-i",
|
|
224
|
-
filePath,
|
|
225
|
-
"-vf",
|
|
226
|
-
buildFilter(width, height, options.preserveAspectRatio, options.pxBackground),
|
|
227
|
-
"-frames:v",
|
|
228
|
-
"1",
|
|
229
|
-
"-f",
|
|
230
|
-
"rawvideo",
|
|
231
|
-
"-pix_fmt",
|
|
232
|
-
"rgba",
|
|
233
|
-
"-"
|
|
234
|
-
];
|
|
235
|
-
|
|
236
|
-
childProcess.execFile("ffmpeg", args, {
|
|
237
|
-
encoding: "buffer",
|
|
238
|
-
maxBuffer: (width * height * 4) + 4096,
|
|
239
|
-
timeout: options.timeoutMs
|
|
240
|
-
}, function (err, stdout, stderr) {
|
|
241
|
-
if (err) {
|
|
242
|
-
var detail = stderr && stderr.length ? String(stderr).trim() : err.message;
|
|
243
|
-
callback(new Error("image-to-ascii failed via ffmpeg: " + detail));
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (!stdout || stdout.length < width * height * 4) {
|
|
247
|
-
callback(new Error("image-to-ascii decoded too few pixels for " + width + "x" + height));
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
var matrix = matrixFromRaw(stdout, width, height, options.pxBackground);
|
|
251
|
-
if (!options.stringify) {
|
|
252
|
-
callback(null, matrix);
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
if (options.stringifyFn) {
|
|
256
|
-
try {
|
|
257
|
-
callback(null, options.stringifyFn(matrix, options));
|
|
258
|
-
} catch (stringifyErr) {
|
|
259
|
-
callback(stringifyErr);
|
|
260
|
-
}
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
callback(null, stringifyMatrix(matrix, options));
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function imageToAscii(source, options, callback) {
|
|
268
|
-
if (typeof options === "function") {
|
|
269
|
-
callback = options;
|
|
270
|
-
options = {};
|
|
271
|
-
}
|
|
272
|
-
if (typeof callback !== "function") {
|
|
273
|
-
return new Promise(function (resolve, reject) {
|
|
274
|
-
imageToAscii(source, options || {}, function (err, converted) {
|
|
275
|
-
if (err) reject(err);
|
|
276
|
-
else resolve(converted);
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
var normalized = normalizeOptions(options || {});
|
|
282
|
-
sourceToFile(source, function (sourceErr, filePath, cleanup) {
|
|
283
|
-
if (sourceErr) {
|
|
284
|
-
callback(sourceErr);
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
renderFile(filePath, normalized, function (renderErr, converted) {
|
|
288
|
-
if (cleanup) {
|
|
289
|
-
fs.unlink(filePath, function () {});
|
|
290
|
-
}
|
|
291
|
-
callback(renderErr, converted);
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
imageToAscii.defaults = {
|
|
297
|
-
size_options: {
|
|
298
|
-
px_size: { width: 1 }
|
|
299
|
-
},
|
|
300
|
-
stringify: true,
|
|
301
|
-
concat: true,
|
|
302
|
-
size: {
|
|
303
|
-
height: "100%"
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
module.exports = imageToAscii;
|
|
308
|
-
module.exports.default = imageToAscii;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
declare namespace imageToAscii {
|
|
2
|
-
interface Size {
|
|
3
|
-
width?: number | string;
|
|
4
|
-
height?: number | string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface SizeOptions {
|
|
8
|
-
screen_size?: {
|
|
9
|
-
width?: number;
|
|
10
|
-
height?: number;
|
|
11
|
-
};
|
|
12
|
-
preserve_aspect_ratio?: boolean;
|
|
13
|
-
fit_screen?: boolean;
|
|
14
|
-
px_size?: {
|
|
15
|
-
width?: number;
|
|
16
|
-
height?: number;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface Options {
|
|
21
|
-
pxWidth?: number;
|
|
22
|
-
size?: Size;
|
|
23
|
-
size_options?: SizeOptions;
|
|
24
|
-
stringify?: boolean;
|
|
25
|
-
concat?: boolean;
|
|
26
|
-
pixels?: string | string[];
|
|
27
|
-
reverse?: boolean;
|
|
28
|
-
colored?: boolean;
|
|
29
|
-
bg?: boolean;
|
|
30
|
-
fg?: boolean;
|
|
31
|
-
white_bg?: boolean;
|
|
32
|
-
px_background?: { r: number; g: number; b: number };
|
|
33
|
-
image_type?: string;
|
|
34
|
-
timeout?: number;
|
|
35
|
-
timeoutMs?: number;
|
|
36
|
-
stringify_fn?: (pixels: unknown, options: Options) => unknown;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type Callback = (err: Error | null, converted?: unknown) => void;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
declare function imageToAscii(
|
|
43
|
-
source: string | Buffer,
|
|
44
|
-
options: imageToAscii.Options | imageToAscii.Callback,
|
|
45
|
-
callback?: imageToAscii.Callback,
|
|
46
|
-
): void | Promise<unknown>;
|
|
47
|
-
|
|
48
|
-
export = imageToAscii;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "image-to-ascii",
|
|
3
|
-
"version": "3.3.0-omnius.1",
|
|
4
|
-
"description": "Omnius bundled image-to-ascii compatibility renderer without the legacy lwip native dependency chain.",
|
|
5
|
-
"main": "index.cjs",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"image-to-ascii": "bin/image-to-ascii.cjs"
|
|
9
|
-
},
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./index.d.ts",
|
|
13
|
-
"require": "./index.cjs",
|
|
14
|
-
"default": "./index.cjs"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=22.0.0"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {}
|
|
22
|
-
}
|