omnius 1.0.106 → 1.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +32 -20
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -578035,6 +578035,14 @@ function parseNvidiaSmi(stdout) {
|
|
|
578035
578035
|
}
|
|
578036
578036
|
return { total, free, name: name10 };
|
|
578037
578037
|
}
|
|
578038
|
+
function parseFreeBytes(stdout) {
|
|
578039
|
+
const memLine = stdout.split("\n").find((l2) => /^Mem:/i.test(l2)) ?? "";
|
|
578040
|
+
const nums = memLine.match(/\d+/g);
|
|
578041
|
+
if (!nums || nums.length === 0) return { total: 0, available: 0 };
|
|
578042
|
+
const total = parseInt(nums[0], 10) || 0;
|
|
578043
|
+
const available = nums.length >= 6 ? parseInt(nums[5], 10) || 0 : 0;
|
|
578044
|
+
return { total, available };
|
|
578045
|
+
}
|
|
578038
578046
|
function parseRocmSmi(stdout) {
|
|
578039
578047
|
let total = 0;
|
|
578040
578048
|
let used = 0;
|
|
@@ -578064,14 +578072,14 @@ function detectSystemSpecs() {
|
|
|
578064
578072
|
timeout: 5e3
|
|
578065
578073
|
});
|
|
578066
578074
|
if (memInfo.includes("Mem:")) {
|
|
578067
|
-
const
|
|
578068
|
-
if (
|
|
578069
|
-
totalRamGB =
|
|
578070
|
-
availableRamGB =
|
|
578075
|
+
const { total, available } = parseFreeBytes(memInfo);
|
|
578076
|
+
if (total > 0) {
|
|
578077
|
+
totalRamGB = total / 1024 ** 3;
|
|
578078
|
+
availableRamGB = available > 0 ? available / 1024 ** 3 : totalRamGB * 0.75;
|
|
578071
578079
|
}
|
|
578072
578080
|
} else {
|
|
578073
578081
|
const bytes = parseInt(memInfo.trim(), 10);
|
|
578074
|
-
if (!isNaN(bytes)) {
|
|
578082
|
+
if (!isNaN(bytes) && bytes > 0) {
|
|
578075
578083
|
totalRamGB = bytes / 1024 ** 3;
|
|
578076
578084
|
availableRamGB = totalRamGB * 0.7;
|
|
578077
578085
|
}
|
|
@@ -578122,14 +578130,14 @@ async function detectSystemSpecsAsync() {
|
|
|
578122
578130
|
{ timeout: 5e3 }
|
|
578123
578131
|
);
|
|
578124
578132
|
if (memInfo.includes("Mem:")) {
|
|
578125
|
-
const
|
|
578126
|
-
if (
|
|
578127
|
-
totalRamGB =
|
|
578128
|
-
availableRamGB =
|
|
578133
|
+
const { total, available } = parseFreeBytes(memInfo);
|
|
578134
|
+
if (total > 0) {
|
|
578135
|
+
totalRamGB = total / 1024 ** 3;
|
|
578136
|
+
availableRamGB = available > 0 ? available / 1024 ** 3 : totalRamGB * 0.75;
|
|
578129
578137
|
}
|
|
578130
578138
|
} else {
|
|
578131
578139
|
const bytes = parseInt(memInfo.trim(), 10);
|
|
578132
|
-
if (!isNaN(bytes)) {
|
|
578140
|
+
if (!isNaN(bytes) && bytes > 0) {
|
|
578133
578141
|
totalRamGB = bytes / 1024 ** 3;
|
|
578134
578142
|
availableRamGB = totalRamGB * 0.7;
|
|
578135
578143
|
}
|
|
@@ -578179,7 +578187,7 @@ function recommendModel(specs) {
|
|
|
578179
578187
|
}
|
|
578180
578188
|
return QWEN_VARIANTS.find((v) => v.tag === "qwen3.5:cloud");
|
|
578181
578189
|
}
|
|
578182
|
-
function
|
|
578190
|
+
function calculateMemoryBoundedNumCtx(specs, modelSizeGB2, kvBytesPerToken, archMax) {
|
|
578183
578191
|
const ramBudget = specs.availableRamGB > 0 ? specs.availableRamGB : specs.totalRamGB;
|
|
578184
578192
|
const vramBudget = specs.availableVramGB > 0 ? specs.availableVramGB : specs.gpuVramGB;
|
|
578185
578193
|
const totalAvail = Math.max(vramBudget, ramBudget);
|
|
@@ -578194,7 +578202,6 @@ function calculateContextWindow(specs, modelSizeGB2, kvBytesPerToken, archMax) {
|
|
|
578194
578202
|
const maxTokens = Math.floor(usableGB * 1024 ** 3 / kvEstimate);
|
|
578195
578203
|
numCtx = Math.max(2048, Math.floor(maxTokens / 1024) * 1024);
|
|
578196
578204
|
}
|
|
578197
|
-
numCtx = Math.min(numCtx, 131072);
|
|
578198
578205
|
if (archMax && archMax > 0) numCtx = Math.min(numCtx, archMax);
|
|
578199
578206
|
if (kvBytesPerToken && kvBytesPerToken > 0 && modelSizeGB2 > 0) {
|
|
578200
578207
|
const maxKVBytes = modelSizeGB2 * 4 * 1024 ** 3;
|
|
@@ -578202,6 +578209,11 @@ function calculateContextWindow(specs, modelSizeGB2, kvBytesPerToken, archMax) {
|
|
|
578202
578209
|
const budgetCap = Math.max(2048, Math.floor(maxTokensFromBudget / 1024) * 1024);
|
|
578203
578210
|
numCtx = Math.min(numCtx, budgetCap);
|
|
578204
578211
|
}
|
|
578212
|
+
return numCtx;
|
|
578213
|
+
}
|
|
578214
|
+
function calculateContextWindow(specs, modelSizeGB2, kvBytesPerToken, archMax) {
|
|
578215
|
+
let numCtx = calculateMemoryBoundedNumCtx(specs, modelSizeGB2, kvBytesPerToken, archMax);
|
|
578216
|
+
numCtx = Math.min(numCtx, 131072);
|
|
578205
578217
|
const label = numCtx >= 1024 ? `${Math.floor(numCtx / 1024)}K` : String(numCtx);
|
|
578206
578218
|
return { numCtx, label };
|
|
578207
578219
|
}
|
|
@@ -578209,18 +578221,17 @@ function formatContextLabel(numCtx) {
|
|
|
578209
578221
|
return numCtx >= 1024 ? `${Math.floor(numCtx / 1024)}K` : String(numCtx);
|
|
578210
578222
|
}
|
|
578211
578223
|
function calculateExpandedVariantContextWindow(specs, modelSizeGB2, kvBytesPerToken, archMax) {
|
|
578212
|
-
const
|
|
578224
|
+
const memoryFit = calculateMemoryBoundedNumCtx(
|
|
578213
578225
|
specs,
|
|
578214
578226
|
modelSizeGB2,
|
|
578215
578227
|
kvBytesPerToken,
|
|
578216
578228
|
archMax
|
|
578217
578229
|
);
|
|
578218
|
-
|
|
578219
|
-
|
|
578220
|
-
|
|
578221
|
-
|
|
578222
|
-
}
|
|
578223
|
-
return memoryBudget;
|
|
578230
|
+
const archCtx = archMax && archMax > 0 ? Math.max(2048, Math.floor(archMax / 1024) * 1024) : Number.POSITIVE_INFINITY;
|
|
578231
|
+
const floor = Math.min(EXPANDED_VARIANT_MIN_NUM_CTX, archCtx);
|
|
578232
|
+
const fits = Math.min(memoryFit, archCtx);
|
|
578233
|
+
const numCtx = Math.max(floor, fits);
|
|
578234
|
+
return { numCtx, label: formatContextLabel(numCtx) };
|
|
578224
578235
|
}
|
|
578225
578236
|
function ask(rl, question) {
|
|
578226
578237
|
return new Promise((resolve52) => {
|
|
@@ -580412,7 +580423,7 @@ export PATH="${binDir}:$PATH" # Added by omnius for nvim
|
|
|
580412
580423
|
} catch {
|
|
580413
580424
|
}
|
|
580414
580425
|
}
|
|
580415
|
-
var execAsync2, OMNIUS_FIRST_RUN_BANNER, ANSI_RE, visibleLen2, QWEN_VARIANTS, _toolSupportCache, _cloudflaredInstallPromise;
|
|
580426
|
+
var execAsync2, OMNIUS_FIRST_RUN_BANNER, ANSI_RE, visibleLen2, QWEN_VARIANTS, _toolSupportCache, EXPANDED_VARIANT_MIN_NUM_CTX, _cloudflaredInstallPromise;
|
|
580416
580427
|
var init_setup = __esm({
|
|
580417
580428
|
"packages/cli/src/tui/setup.ts"() {
|
|
580418
580429
|
"use strict";
|
|
@@ -580445,6 +580456,7 @@ var init_setup = __esm({
|
|
|
580445
580456
|
{ tag: "qwen3.5:397b-cloud", sizeGB: 0, label: "397B Cloud (Ollama Cloud)", cloud: true }
|
|
580446
580457
|
];
|
|
580447
580458
|
_toolSupportCache = /* @__PURE__ */ new Map();
|
|
580459
|
+
EXPANDED_VARIANT_MIN_NUM_CTX = 32768;
|
|
580448
580460
|
_cloudflaredInstallPromise = null;
|
|
580449
580461
|
}
|
|
580450
580462
|
});
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.107",
|
|
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.107",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
package/package.json
CHANGED