omnius 1.0.307 → 1.0.309
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 +139 -13
- package/npm-shrinkwrap.json +14 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -557607,6 +557607,17 @@ var init_ollama_pool = __esm({
|
|
|
557607
557607
|
return;
|
|
557608
557608
|
tryKill(pid, "SIGKILL");
|
|
557609
557609
|
}, 8e3).unref();
|
|
557610
|
+
},
|
|
557611
|
+
onExit: (cb) => {
|
|
557612
|
+
let fired = false;
|
|
557613
|
+
const fireOnce = () => {
|
|
557614
|
+
if (fired)
|
|
557615
|
+
return;
|
|
557616
|
+
fired = true;
|
|
557617
|
+
cb();
|
|
557618
|
+
};
|
|
557619
|
+
child.once("exit", fireOnce);
|
|
557620
|
+
child.once("error", fireOnce);
|
|
557610
557621
|
}
|
|
557611
557622
|
};
|
|
557612
557623
|
child.stdout?.on("data", () => {
|
|
@@ -558136,6 +558147,18 @@ var init_ollama_pool = __esm({
|
|
|
558136
558147
|
spawnedAtMs
|
|
558137
558148
|
}, proc);
|
|
558138
558149
|
this.instances.push(inst);
|
|
558150
|
+
proc.onExit?.(() => {
|
|
558151
|
+
const idx = this.instances.indexOf(inst);
|
|
558152
|
+
if (idx < 0)
|
|
558153
|
+
return;
|
|
558154
|
+
this.instances.splice(idx, 1);
|
|
558155
|
+
this.emit("instance-exited", {
|
|
558156
|
+
id: inst.state.id,
|
|
558157
|
+
pid: proc.pid,
|
|
558158
|
+
port
|
|
558159
|
+
});
|
|
558160
|
+
this.wakeNextSlotWaiter();
|
|
558161
|
+
});
|
|
558139
558162
|
this.emit("instance-spawned", {
|
|
558140
558163
|
id: inst.state.id,
|
|
558141
558164
|
pid: proc.pid,
|
|
@@ -565967,6 +565990,23 @@ function isOllamaModelNotFoundResponse(status, text2, model) {
|
|
|
565967
565990
|
const modelLower = model.toLowerCase();
|
|
565968
565991
|
return lower.includes("model") && lower.includes("not found") || lower.includes("not_found_error") || modelLower.length > 0 && lower.includes(modelLower) && lower.includes("not found");
|
|
565969
565992
|
}
|
|
565993
|
+
function isBackendConnectionError(err) {
|
|
565994
|
+
if (err instanceof Error && err.name === "AbortError")
|
|
565995
|
+
return false;
|
|
565996
|
+
const parts = [];
|
|
565997
|
+
if (err instanceof Error) {
|
|
565998
|
+
parts.push(err.message);
|
|
565999
|
+
const cause = err.cause;
|
|
566000
|
+
if (cause instanceof Error)
|
|
566001
|
+
parts.push(cause.message);
|
|
566002
|
+
const code8 = cause?.code;
|
|
566003
|
+
if (typeof code8 === "string")
|
|
566004
|
+
parts.push(code8);
|
|
566005
|
+
} else if (typeof err === "string") {
|
|
566006
|
+
parts.push(err);
|
|
566007
|
+
}
|
|
566008
|
+
return /fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EHOSTUNREACH|ENOTFOUND|EPIPE|socket hang up|UND_ERR/i.test(parts.join(" "));
|
|
566009
|
+
}
|
|
565970
566010
|
function computeEffectiveThink(params) {
|
|
565971
566011
|
if (process.env["OMNIUS_FORCE_NO_THINK"] === "1")
|
|
565972
566012
|
return false;
|
|
@@ -581606,7 +581646,25 @@ ${description}`
|
|
|
581606
581646
|
};
|
|
581607
581647
|
if (combinedAbortSignal)
|
|
581608
581648
|
fetchOpts.signal = combinedAbortSignal;
|
|
581609
|
-
let resp
|
|
581649
|
+
let resp;
|
|
581650
|
+
try {
|
|
581651
|
+
resp = await fetch(`${requestBaseUrl}/v1/chat/completions`, fetchOpts);
|
|
581652
|
+
} catch (err) {
|
|
581653
|
+
if (poolSlot?.poolOwned && isBackendConnectionError(err)) {
|
|
581654
|
+
const deadInstanceId = poolSlot.instanceId;
|
|
581655
|
+
releasePoolSlot(false);
|
|
581656
|
+
try {
|
|
581657
|
+
await getOllamaPool({
|
|
581658
|
+
baseInstanceUrl: this.baseUrl
|
|
581659
|
+
}).evictInstance(deadInstanceId);
|
|
581660
|
+
} catch {
|
|
581661
|
+
}
|
|
581662
|
+
requestBaseUrl = this.baseUrl;
|
|
581663
|
+
resp = await fetch(`${requestBaseUrl}/v1/chat/completions`, fetchOpts);
|
|
581664
|
+
} else {
|
|
581665
|
+
throw err;
|
|
581666
|
+
}
|
|
581667
|
+
}
|
|
581610
581668
|
if (!resp.ok) {
|
|
581611
581669
|
const text2 = await resp.text().catch(() => "");
|
|
581612
581670
|
if (poolSlot?.poolOwned && isOllamaModelNotFoundResponse(resp.status, text2, this.model)) {
|
|
@@ -581962,7 +582020,25 @@ ${description}`
|
|
|
581962
582020
|
body: JSON.stringify(body),
|
|
581963
582021
|
signal: streamAbort.signal
|
|
581964
582022
|
};
|
|
581965
|
-
let resp
|
|
582023
|
+
let resp;
|
|
582024
|
+
try {
|
|
582025
|
+
resp = await fetch(`${requestBaseUrl}/v1/chat/completions`, streamFetchOpts);
|
|
582026
|
+
} catch (err) {
|
|
582027
|
+
if (poolSlot?.poolOwned && isBackendConnectionError(err)) {
|
|
582028
|
+
const deadInstanceId = poolSlot.instanceId;
|
|
582029
|
+
releasePoolSlot(false);
|
|
582030
|
+
try {
|
|
582031
|
+
await getOllamaPool({
|
|
582032
|
+
baseInstanceUrl: this.baseUrl
|
|
582033
|
+
}).evictInstance(deadInstanceId);
|
|
582034
|
+
} catch {
|
|
582035
|
+
}
|
|
582036
|
+
requestBaseUrl = this.baseUrl;
|
|
582037
|
+
resp = await fetch(`${requestBaseUrl}/v1/chat/completions`, streamFetchOpts);
|
|
582038
|
+
} else {
|
|
582039
|
+
throw err;
|
|
582040
|
+
}
|
|
582041
|
+
}
|
|
581966
582042
|
if (!resp.ok) {
|
|
581967
582043
|
const text2 = await resp.text().catch(() => "");
|
|
581968
582044
|
if (poolSlot?.poolOwned && isOllamaModelNotFoundResponse(resp.status, text2, this.model)) {
|
|
@@ -607067,6 +607143,45 @@ __export(status_bar_exports, {
|
|
|
607067
607143
|
unlockFooterRedraws: () => unlockFooterRedraws
|
|
607068
607144
|
});
|
|
607069
607145
|
import { readFileSync as readFileSync91 } from "node:fs";
|
|
607146
|
+
function stripSubAgentPrefix(label) {
|
|
607147
|
+
const stripped = label.replace(/^\s*sub[-\s]?agents?\b[\s:_–—-]*/i, "").trim();
|
|
607148
|
+
return stripped.length > 0 ? stripped : label.trim();
|
|
607149
|
+
}
|
|
607150
|
+
function xterm256ToRgb(i2) {
|
|
607151
|
+
if (i2 >= 232) {
|
|
607152
|
+
const v = 8 + (i2 - 232) * 10;
|
|
607153
|
+
return [v, v, v];
|
|
607154
|
+
}
|
|
607155
|
+
if (i2 >= 16) {
|
|
607156
|
+
const n2 = i2 - 16;
|
|
607157
|
+
const conv = (c8) => c8 === 0 ? 0 : 55 + c8 * 40;
|
|
607158
|
+
return [conv(Math.floor(n2 / 36)), conv(Math.floor(n2 % 36 / 6)), conv(n2 % 6)];
|
|
607159
|
+
}
|
|
607160
|
+
const base3 = [
|
|
607161
|
+
[0, 0, 0],
|
|
607162
|
+
[128, 0, 0],
|
|
607163
|
+
[0, 128, 0],
|
|
607164
|
+
[128, 128, 0],
|
|
607165
|
+
[0, 0, 128],
|
|
607166
|
+
[128, 0, 128],
|
|
607167
|
+
[0, 128, 128],
|
|
607168
|
+
[192, 192, 192],
|
|
607169
|
+
[128, 128, 128],
|
|
607170
|
+
[255, 0, 0],
|
|
607171
|
+
[0, 255, 0],
|
|
607172
|
+
[255, 255, 0],
|
|
607173
|
+
[0, 0, 255],
|
|
607174
|
+
[255, 0, 255],
|
|
607175
|
+
[0, 255, 255],
|
|
607176
|
+
[255, 255, 255]
|
|
607177
|
+
];
|
|
607178
|
+
return base3[i2] ?? [0, 0, 0];
|
|
607179
|
+
}
|
|
607180
|
+
function contrastTextColor(colorIndex) {
|
|
607181
|
+
const [r2, g, b] = xterm256ToRgb(colorIndex);
|
|
607182
|
+
const luma = 0.299 * r2 + 0.587 * g + 0.114 * b;
|
|
607183
|
+
return luma >= 140 ? 16 : 231;
|
|
607184
|
+
}
|
|
607070
607185
|
function formatPoolAge(ms) {
|
|
607071
607186
|
if (ms < 6e4) return `${Math.max(0, Math.floor(ms / 1e3))}s`;
|
|
607072
607187
|
if (ms < 60 * 6e4) return `${Math.floor(ms / 6e4)}m`;
|
|
@@ -607298,7 +607413,7 @@ var init_status_bar = __esm({
|
|
|
607298
607413
|
BOX_FG = tuiBoxFg();
|
|
607299
607414
|
TEXT_PRIMARY = tuiTextPrimary() < 0 ? 252 : tuiTextPrimary();
|
|
607300
607415
|
TEXT_DIM = tuiTextDim();
|
|
607301
|
-
NO_SUB_AGENTS_HEADER_LABEL = " no
|
|
607416
|
+
NO_SUB_AGENTS_HEADER_LABEL = " no agents ";
|
|
607302
607417
|
HEADER_ACCENT_GREEN = 154;
|
|
607303
607418
|
HEADER_ACCENT_BOLD_FG = `\x1B[1;38;5;${HEADER_ACCENT_GREEN}m`;
|
|
607304
607419
|
HEADER_BUTTON_BG = `\x1B[48;5;${HEADER_ACCENT_GREEN}m`;
|
|
@@ -607775,6 +607890,12 @@ var init_status_bar = __esm({
|
|
|
607775
607890
|
const decorateMenuButton = (cmd, label) => {
|
|
607776
607891
|
return `\x1B[38;5;${HEADER_ACCENT_GREEN}m🭁\x1B[0m${HEADER_BUTTON_FG}${HEADER_BUTTON_BG}${label}\x1B[0m${PANEL_BG_SEQ}\x1B[38;5;${HEADER_ACCENT_GREEN}m🭝\x1B[0m${PANEL_BG_SEQ}`;
|
|
607777
607892
|
};
|
|
607893
|
+
const decorateAgentButton = (content, color, active) => {
|
|
607894
|
+
const bg = `\x1B[48;5;${color}m`;
|
|
607895
|
+
const fg2 = `\x1B[38;5;${contrastTextColor(color)}m`;
|
|
607896
|
+
const weight = active ? "\x1B[1m" : "";
|
|
607897
|
+
return `\x1B[38;5;${color}m🭁\x1B[0m${weight}${fg2}${bg}${content}\x1B[0m${PANEL_BG_SEQ}\x1B[38;5;${color}m🭝\x1B[0m${PANEL_BG_SEQ}`;
|
|
607898
|
+
};
|
|
607778
607899
|
const renderBtn = (cmd, label) => {
|
|
607779
607900
|
const fg2 = buttonFg(cmd);
|
|
607780
607901
|
const left = _isWindows ? "" : "🛁";
|
|
@@ -607868,12 +607989,14 @@ var init_status_bar = __esm({
|
|
|
607868
607989
|
for (const view of this._agentViews.values()) {
|
|
607869
607990
|
if (view.id === "main" && this._activeViewId === "main") continue;
|
|
607870
607991
|
const icon = view.status === "running" ? "●" : view.status === "completed" ? "✓" : view.status === "failed" ? "✗" : "○";
|
|
607871
|
-
const
|
|
607992
|
+
const content = ` ${trunc3(view.label)} ${icon} `;
|
|
607872
607993
|
const viewColor = view.colorCode ?? (view.type === "telegram" ? 45 : 213);
|
|
607873
|
-
const
|
|
607994
|
+
const active = view.id === this._activeViewId;
|
|
607995
|
+
const btn = decorateAgentButton(content, viewColor, active);
|
|
607874
607996
|
sysItems.push({
|
|
607875
|
-
render: () =>
|
|
607876
|
-
w:
|
|
607997
|
+
render: () => linkify(`view:${view.id}`, btn) + " ",
|
|
607998
|
+
w: content.length + 2 + 1
|
|
607999
|
+
// 2 border glyphs + trailing space
|
|
607877
608000
|
});
|
|
607878
608001
|
}
|
|
607879
608002
|
} else {
|
|
@@ -609212,7 +609335,7 @@ var init_status_bar = __esm({
|
|
|
609212
609335
|
registerAgentView(id, label, type, taskSummary) {
|
|
609213
609336
|
this._agentViews.set(id, {
|
|
609214
609337
|
id,
|
|
609215
|
-
label,
|
|
609338
|
+
label: stripSubAgentPrefix(label),
|
|
609216
609339
|
type,
|
|
609217
609340
|
contentLines: [],
|
|
609218
609341
|
scrollOffset: 0,
|
|
@@ -609345,8 +609468,9 @@ var init_status_bar = __esm({
|
|
|
609345
609468
|
for (const view of this._agentViews.values()) {
|
|
609346
609469
|
if (view.id === "main" && this._activeViewId === "main") continue;
|
|
609347
609470
|
const icon = view.status === "running" ? "●" : view.status === "completed" ? "✓" : view.status === "failed" ? "✗" : "○";
|
|
609348
|
-
const
|
|
609349
|
-
const
|
|
609471
|
+
const content = ` ${view.label} ${icon} `;
|
|
609472
|
+
const visW = content.length + 2;
|
|
609473
|
+
const endCol = testCol + visW - 1;
|
|
609350
609474
|
if (col >= testCol && col <= endCol) return view.id;
|
|
609351
609475
|
testCol = endCol + 2;
|
|
609352
609476
|
}
|
|
@@ -610479,8 +610603,10 @@ ${CONTENT_BG_SEQ}`);
|
|
|
610479
610603
|
if (rm4.ollamaPool?.enabled) {
|
|
610480
610604
|
const pool3 = rm4.ollamaPool;
|
|
610481
610605
|
const isConstrained = pool3.mode === "constrained";
|
|
610482
|
-
const
|
|
610483
|
-
const
|
|
610606
|
+
const baseCount = pool3.instances.some((i2) => !i2.poolOwned) ? 1 : 0;
|
|
610607
|
+
const spawnedReady = pool3.instances.filter((i2) => i2.poolOwned).length;
|
|
610608
|
+
const ready = isConstrained ? Math.max(1, baseCount + spawnedReady) : baseCount + spawnedReady;
|
|
610609
|
+
const target = isConstrained ? 1 : Math.max(ready, pool3.targetGpuInstances + baseCount);
|
|
610484
610610
|
const allReady = ready >= target;
|
|
610485
610611
|
const poolColor = allReady ? c3.green : c3.yellow;
|
|
610486
610612
|
const poolDetail = `${_StatusBar.digitBar(ready)}/${_StatusBar.digitBar(target)}`;
|
|
@@ -640856,7 +640982,7 @@ async function handleBroker(arg, _ctx) {
|
|
|
640856
640982
|
` ${c3.dim("Idle-evict threshold:")} ${Math.round(broker.idleEvictMs / 1e3)}s`
|
|
640857
640983
|
);
|
|
640858
640984
|
safeLog(
|
|
640859
|
-
` ${c3.dim("Slot capacity:")} ${snap.slots.inUse}/${snap.slots.capacity} active,
|
|
640985
|
+
` ${c3.dim("Slot capacity:")} ${snap.slots.inUse}/${snap.slots.capacity} active, QUEUE ${snap.slots.queueDepth}/${snap.slots.queueCapacity}`
|
|
640860
640986
|
);
|
|
640861
640987
|
safeLog("");
|
|
640862
640988
|
if (snap.loaded.length === 0) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.309",
|
|
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.309",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
|
@@ -2397,12 +2397,13 @@
|
|
|
2397
2397
|
}
|
|
2398
2398
|
},
|
|
2399
2399
|
"node_modules/bare-stream": {
|
|
2400
|
-
"version": "2.13.
|
|
2401
|
-
"resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.
|
|
2402
|
-
"integrity": "sha512-
|
|
2400
|
+
"version": "2.13.3",
|
|
2401
|
+
"resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.3.tgz",
|
|
2402
|
+
"integrity": "sha512-Kc+brLqvEqGkjyfiwJmImAOqLZL7OsoLKuavx+hJjgVV3nLTOjloJyPMFxjUPerGGHrNH0fLU06jjykMLWrERQ==",
|
|
2403
2403
|
"license": "Apache-2.0",
|
|
2404
2404
|
"optional": true,
|
|
2405
2405
|
"dependencies": {
|
|
2406
|
+
"b4a": "^1.8.1",
|
|
2406
2407
|
"streamx": "^2.25.0",
|
|
2407
2408
|
"teex": "^1.0.1"
|
|
2408
2409
|
},
|
|
@@ -3526,16 +3527,16 @@
|
|
|
3526
3527
|
}
|
|
3527
3528
|
},
|
|
3528
3529
|
"node_modules/form-data": {
|
|
3529
|
-
"version": "4.0.
|
|
3530
|
-
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.
|
|
3531
|
-
"integrity": "sha512-
|
|
3530
|
+
"version": "4.0.6",
|
|
3531
|
+
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.6.tgz",
|
|
3532
|
+
"integrity": "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==",
|
|
3532
3533
|
"license": "MIT",
|
|
3533
3534
|
"dependencies": {
|
|
3534
3535
|
"asynckit": "^0.4.0",
|
|
3535
3536
|
"combined-stream": "^1.0.8",
|
|
3536
3537
|
"es-set-tostringtag": "^2.1.0",
|
|
3537
|
-
"hasown": "^2.0.
|
|
3538
|
-
"mime-types": "^2.1.
|
|
3538
|
+
"hasown": "^2.0.4",
|
|
3539
|
+
"mime-types": "^2.1.35"
|
|
3539
3540
|
},
|
|
3540
3541
|
"engines": {
|
|
3541
3542
|
"node": ">= 6"
|
|
@@ -6690,9 +6691,9 @@
|
|
|
6690
6691
|
}
|
|
6691
6692
|
},
|
|
6692
6693
|
"node_modules/streamx": {
|
|
6693
|
-
"version": "2.
|
|
6694
|
-
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.
|
|
6695
|
-
"integrity": "sha512-
|
|
6694
|
+
"version": "2.28.0",
|
|
6695
|
+
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.28.0.tgz",
|
|
6696
|
+
"integrity": "sha512-1Yowhzjf0ivGMrTIkY9hav5TxobO9qIVqUE41fiCGMGgc3CLlf4MY+9AHmZqBWgDTue0fY9zWjYFVyf6Diuobw==",
|
|
6696
6697
|
"license": "MIT",
|
|
6697
6698
|
"optional": true,
|
|
6698
6699
|
"dependencies": {
|
package/package.json
CHANGED