omnius 1.0.935 → 1.0.938

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.
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.935",
3
+ "version": "1.0.938",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "omnius",
9
- "version": "1.0.935",
10
- "bundleDependencies": [
11
- "image-to-ascii"
12
- ],
9
+ "version": "1.0.938",
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.935",
3
+ "version": "1.0.938",
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
- }