omnius 1.0.263 → 1.0.265
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 +187 -47
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -595374,12 +595374,11 @@ function wrapToolTextLine(text2, width, prefix = "") {
|
|
|
595374
595374
|
const avail = Math.max(4, width - prefixLen);
|
|
595375
595375
|
let remaining = text2;
|
|
595376
595376
|
while (visibleLen(remaining) > avail) {
|
|
595377
|
-
|
|
595378
|
-
let
|
|
595377
|
+
const breakOffset = findVisibleBreak(remaining, avail);
|
|
595378
|
+
let breakAt = breakOffset;
|
|
595379
|
+
let bestBreak = remaining.lastIndexOf(" ", breakOffset);
|
|
595379
595380
|
if (bestBreak > 0) {
|
|
595380
595381
|
breakAt = bestBreak;
|
|
595381
|
-
} else {
|
|
595382
|
-
breakAt = findVisibleBreak(remaining, avail);
|
|
595383
595382
|
}
|
|
595384
595383
|
const line = remaining.slice(0, breakAt).trimEnd();
|
|
595385
595384
|
out.push(prefix ? prefix + line : line);
|
|
@@ -595406,12 +595405,11 @@ function wrapLinesWithPrefix(content, prefix, maxWidth) {
|
|
|
595406
595405
|
}
|
|
595407
595406
|
let remaining = trimmed;
|
|
595408
595407
|
while (visibleLen(remaining) > avail) {
|
|
595409
|
-
|
|
595410
|
-
let
|
|
595408
|
+
const breakOffset = findVisibleBreak(remaining, avail);
|
|
595409
|
+
let breakAt = breakOffset;
|
|
595410
|
+
let bestBreak = remaining.lastIndexOf(" ", breakOffset);
|
|
595411
595411
|
if (bestBreak > 0) {
|
|
595412
595412
|
breakAt = bestBreak;
|
|
595413
|
-
} else {
|
|
595414
|
-
breakAt = findVisibleBreak(remaining, avail);
|
|
595415
595413
|
}
|
|
595416
595414
|
out.push(prefix + remaining.slice(0, breakAt).trimEnd());
|
|
595417
595415
|
remaining = remaining.slice(breakAt).trimStart();
|
|
@@ -606079,6 +606077,7 @@ var init_status_bar = __esm({
|
|
|
606079
606077
|
_autoScroll = true;
|
|
606080
606078
|
/** Cached click region for the spacer button */
|
|
606081
606079
|
_scrollBtnRegion = null;
|
|
606080
|
+
_copyBtnRegion = null;
|
|
606082
606081
|
stdinHooked = false;
|
|
606083
606082
|
/** COHERE distributed cognitive commons active flag */
|
|
606084
606083
|
_cohereActive = false;
|
|
@@ -607778,6 +607777,12 @@ var init_status_bar = __esm({
|
|
|
607778
607777
|
return;
|
|
607779
607778
|
}
|
|
607780
607779
|
}
|
|
607780
|
+
if (type === "press" && this._copyBtnRegion && row === this._copyBtnRegion.row) {
|
|
607781
|
+
if (col >= this._copyBtnRegion.start && col <= this._copyBtnRegion.end) {
|
|
607782
|
+
this.copySessionToClipboard();
|
|
607783
|
+
return;
|
|
607784
|
+
}
|
|
607785
|
+
}
|
|
607781
607786
|
const pos = this.rowPositions(termRows());
|
|
607782
607787
|
if (type === "press" && pos.tabBarRow > 0 && row === pos.tabBarRow) {
|
|
607783
607788
|
const viewId = this.hitTestTabBar(col);
|
|
@@ -608629,6 +608634,60 @@ ${CONTENT_BG_SEQ}`);
|
|
|
608629
608634
|
this._syncPagerScope();
|
|
608630
608635
|
this.repaintContent();
|
|
608631
608636
|
}
|
|
608637
|
+
/** Copy the visible session content to the system clipboard */
|
|
608638
|
+
copySessionToClipboard() {
|
|
608639
|
+
const lines = this._contentLines;
|
|
608640
|
+
if (!lines || lines.length === 0) return;
|
|
608641
|
+
const offset = this._contentScrollOffset;
|
|
608642
|
+
const visible = this.contentHeight;
|
|
608643
|
+
const startIdx = Math.max(0, offset);
|
|
608644
|
+
const endIdx = Math.min(lines.length, startIdx + visible);
|
|
608645
|
+
const visibleLines = lines.slice(startIdx, endIdx);
|
|
608646
|
+
const stripped = visibleLines.map(
|
|
608647
|
+
(line) => line.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "").replace(/\x1B\]?[^\x07]*\x07/g, "")
|
|
608648
|
+
);
|
|
608649
|
+
const text2 = stripped.join("\n");
|
|
608650
|
+
const clipboardCmds = [
|
|
608651
|
+
["wl-copy", text2],
|
|
608652
|
+
["xclip", ["-selection", "clipboard"], "-i"],
|
|
608653
|
+
["xsel", "--clipboard", "--input"]
|
|
608654
|
+
];
|
|
608655
|
+
let success = false;
|
|
608656
|
+
for (const [cmd, ...args] of clipboardCmds) {
|
|
608657
|
+
try {
|
|
608658
|
+
const { execSync: execSync63 } = __require("child_process");
|
|
608659
|
+
const child = __require("child_process").spawn(cmd, args, {
|
|
608660
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
608661
|
+
});
|
|
608662
|
+
if (child.stdin) {
|
|
608663
|
+
child.stdin.write(text2);
|
|
608664
|
+
child.stdin.end();
|
|
608665
|
+
}
|
|
608666
|
+
child.on("close", (code8) => {
|
|
608667
|
+
if (code8 === 0) success = true;
|
|
608668
|
+
});
|
|
608669
|
+
setTimeout(() => {
|
|
608670
|
+
if (!success) {
|
|
608671
|
+
try {
|
|
608672
|
+
child.kill();
|
|
608673
|
+
} catch {
|
|
608674
|
+
}
|
|
608675
|
+
}
|
|
608676
|
+
}, 500);
|
|
608677
|
+
break;
|
|
608678
|
+
} catch {
|
|
608679
|
+
continue;
|
|
608680
|
+
}
|
|
608681
|
+
}
|
|
608682
|
+
if (!success) {
|
|
608683
|
+
const fs11 = __require("fs");
|
|
608684
|
+
const os9 = __require("os");
|
|
608685
|
+
const tmpPath = __require("path").join(os9.tmpdir(), "omnius-session-copy.txt");
|
|
608686
|
+
fs11.writeFileSync(tmpPath, text2, "utf-8");
|
|
608687
|
+
process.stderr.write(`\x1B[38;5;208mClipboard unavailable — session saved to ${tmpPath}\x1B[0m
|
|
608688
|
+
`);
|
|
608689
|
+
}
|
|
608690
|
+
}
|
|
608632
608691
|
/**
|
|
608633
608692
|
* WO-TASK-02 — sync the tasks panel "pager" scope flag with the current
|
|
608634
608693
|
* scroll-back state. While the user is scrolled back through content
|
|
@@ -608694,8 +608753,19 @@ ${CONTENT_BG_SEQ}`);
|
|
|
608694
608753
|
start: startCol,
|
|
608695
608754
|
end: startCol + label.length - 1
|
|
608696
608755
|
};
|
|
608756
|
+
const copyLabel = " ⎘ copy session ";
|
|
608757
|
+
const copyCol = Math.max(startCol + label.length + 2, w - copyLabel.length);
|
|
608758
|
+
if (copyCol + copyLabel.length <= w) {
|
|
608759
|
+
buf += `\x1B[${spacerRow};${copyCol}H\x1B[38;5;141m${copyLabel}\x1B[0m${CONTENT_BG_SEQ}`;
|
|
608760
|
+
this._copyBtnRegion = {
|
|
608761
|
+
row: spacerRow,
|
|
608762
|
+
start: copyCol,
|
|
608763
|
+
end: copyCol + copyLabel.length - 1
|
|
608764
|
+
};
|
|
608765
|
+
}
|
|
608697
608766
|
} else {
|
|
608698
608767
|
this._scrollBtnRegion = null;
|
|
608768
|
+
this._copyBtnRegion = null;
|
|
608699
608769
|
}
|
|
608700
608770
|
}
|
|
608701
608771
|
if (this._contentScrollOffset > 0) {
|
|
@@ -690938,7 +691008,7 @@ import {
|
|
|
690938
691008
|
readSync as readSync2,
|
|
690939
691009
|
closeSync as closeSync6
|
|
690940
691010
|
} from "node:fs";
|
|
690941
|
-
import { randomBytes as randomBytes28, randomUUID as randomUUID21 } from "node:crypto";
|
|
691011
|
+
import { randomBytes as randomBytes28, randomUUID as randomUUID21, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
690942
691012
|
import { createHash as createHash42 } from "node:crypto";
|
|
690943
691013
|
function memoryDbPaths3(baseDir = process.cwd()) {
|
|
690944
691014
|
const dir = join164(baseDir, ".omnius");
|
|
@@ -692501,16 +692571,69 @@ function runtimeKeysExist() {
|
|
|
692501
692571
|
return false;
|
|
692502
692572
|
}
|
|
692503
692573
|
}
|
|
692574
|
+
function tokensMatch(a2, b) {
|
|
692575
|
+
if (typeof a2 !== "string" || typeof b !== "string") return false;
|
|
692576
|
+
if (a2.length === 0 || b.length === 0) return false;
|
|
692577
|
+
const ab = Buffer.from(a2, "utf8");
|
|
692578
|
+
const bb = Buffer.from(b, "utf8");
|
|
692579
|
+
if (ab.length !== bb.length) return false;
|
|
692580
|
+
try {
|
|
692581
|
+
return timingSafeEqual2(ab, bb);
|
|
692582
|
+
} catch {
|
|
692583
|
+
return false;
|
|
692584
|
+
}
|
|
692585
|
+
}
|
|
692586
|
+
function scopedEnvKeySources() {
|
|
692587
|
+
const pick = (...names) => {
|
|
692588
|
+
for (const n2 of names) {
|
|
692589
|
+
const v = process.env[n2];
|
|
692590
|
+
if (v && v.trim()) return v.trim();
|
|
692591
|
+
}
|
|
692592
|
+
return void 0;
|
|
692593
|
+
};
|
|
692594
|
+
return [
|
|
692595
|
+
{
|
|
692596
|
+
value: pick("OMNIUS_REST_READ_API_KEY", "OMNIUS_READ_API_KEY"),
|
|
692597
|
+
scope: "read",
|
|
692598
|
+
user: "rest-read"
|
|
692599
|
+
},
|
|
692600
|
+
{
|
|
692601
|
+
value: pick("OMNIUS_REST_RUN_API_KEY", "OMNIUS_RUN_API_KEY"),
|
|
692602
|
+
scope: "run",
|
|
692603
|
+
user: "rest-run"
|
|
692604
|
+
},
|
|
692605
|
+
{
|
|
692606
|
+
value: pick("OMNIUS_REST_AUDITOR_API_KEY", "OMNIUS_AUDITOR_API_KEY"),
|
|
692607
|
+
scope: "read",
|
|
692608
|
+
user: "rest-auditor"
|
|
692609
|
+
},
|
|
692610
|
+
{
|
|
692611
|
+
value: pick("OMNIUS_REST_ADMIN_API_KEY", "OMNIUS_ADMIN_API_KEY"),
|
|
692612
|
+
scope: "admin",
|
|
692613
|
+
user: "rest-admin"
|
|
692614
|
+
},
|
|
692615
|
+
{ value: pick("OMNIUS_REST_API_KEY"), scope: "admin", user: "rest-admin" }
|
|
692616
|
+
];
|
|
692617
|
+
}
|
|
692618
|
+
function anyEnvAuthKeyConfigured() {
|
|
692619
|
+
if (process.env["OMNIUS_REST_API_KEYS"] || process.env["OMNIUS_API_KEYS"]) {
|
|
692620
|
+
return true;
|
|
692621
|
+
}
|
|
692622
|
+
if (process.env["OMNIUS_API_KEY"]) return true;
|
|
692623
|
+
return scopedEnvKeySources().some((s2) => Boolean(s2.value));
|
|
692624
|
+
}
|
|
692625
|
+
function anyAuthKeyConfigured() {
|
|
692626
|
+
return anyEnvAuthKeyConfigured() || runtimeKeysExist();
|
|
692627
|
+
}
|
|
692504
692628
|
function resolveAuth(req3) {
|
|
692505
692629
|
const authHeader = req3.headers["authorization"];
|
|
692506
|
-
const token = authHeader
|
|
692630
|
+
const token = typeof authHeader === "string" && authHeader.startsWith("Bearer ") ? authHeader.slice(7).trim() : null;
|
|
692507
692631
|
const multiKeys = process.env["OMNIUS_REST_API_KEYS"] || process.env["OMNIUS_API_KEYS"];
|
|
692508
|
-
if (multiKeys) {
|
|
692509
|
-
if (!token) return { authenticated: false, scope: "read" };
|
|
692632
|
+
if (token && multiKeys) {
|
|
692510
692633
|
for (const entry of multiKeys.split(",")) {
|
|
692511
692634
|
const parts = entry.trim().split(":");
|
|
692512
692635
|
const [key, scope, user, rpmStr, tpdStr, maxJobsStr] = parts;
|
|
692513
|
-
if (key
|
|
692636
|
+
if (key && tokensMatch(key, token)) {
|
|
692514
692637
|
return {
|
|
692515
692638
|
authenticated: true,
|
|
692516
692639
|
scope: scope || "admin",
|
|
@@ -692521,26 +692644,25 @@ function resolveAuth(req3) {
|
|
|
692521
692644
|
};
|
|
692522
692645
|
}
|
|
692523
692646
|
}
|
|
692524
|
-
return { authenticated: false, scope: "read" };
|
|
692525
692647
|
}
|
|
692526
|
-
|
|
692527
|
-
|
|
692528
|
-
|
|
692529
|
-
|
|
692530
|
-
|
|
692531
|
-
|
|
692532
|
-
|
|
692533
|
-
|
|
692534
|
-
|
|
692648
|
+
if (token) {
|
|
692649
|
+
for (const source of scopedEnvKeySources()) {
|
|
692650
|
+
if (source.value && tokensMatch(source.value, token)) {
|
|
692651
|
+
return {
|
|
692652
|
+
authenticated: true,
|
|
692653
|
+
scope: source.scope,
|
|
692654
|
+
user: source.user
|
|
692655
|
+
};
|
|
692656
|
+
}
|
|
692657
|
+
}
|
|
692535
692658
|
}
|
|
692536
692659
|
const singleKey = process.env["OMNIUS_API_KEY"];
|
|
692537
|
-
if (singleKey) {
|
|
692538
|
-
|
|
692539
|
-
|
|
692540
|
-
|
|
692541
|
-
|
|
692542
|
-
|
|
692543
|
-
};
|
|
692660
|
+
if (token && singleKey && tokensMatch(singleKey, token)) {
|
|
692661
|
+
return {
|
|
692662
|
+
authenticated: true,
|
|
692663
|
+
scope: "admin",
|
|
692664
|
+
user: "legacy-omnius-api-key"
|
|
692665
|
+
};
|
|
692544
692666
|
}
|
|
692545
692667
|
if (token) {
|
|
692546
692668
|
try {
|
|
@@ -692560,13 +692682,12 @@ function resolveAuth(req3) {
|
|
|
692560
692682
|
} catch {
|
|
692561
692683
|
}
|
|
692562
692684
|
}
|
|
692563
|
-
if (!
|
|
692685
|
+
if (!anyEnvAuthKeyConfigured()) {
|
|
692564
692686
|
const insecureLoopbackAdmin = process.env["OMNIUS_INSECURE_LOOPBACK_ADMIN"] === "1";
|
|
692565
692687
|
const remoteIp = (req3.socket?.remoteAddress || "").replace(/^::ffff:/, "");
|
|
692566
692688
|
if (insecureLoopbackAdmin && isLoopbackIP(remoteIp)) {
|
|
692567
692689
|
return { authenticated: true, scope: "admin", user: "insecure-loopback" };
|
|
692568
692690
|
}
|
|
692569
|
-
return { authenticated: false, scope: "read" };
|
|
692570
692691
|
}
|
|
692571
692692
|
return { authenticated: false, scope: "read" };
|
|
692572
692693
|
}
|
|
@@ -692574,9 +692695,22 @@ function checkAuth(req3, res, requiredScope = "read") {
|
|
|
692574
692695
|
const scopeLevel = { read: 1, run: 2, admin: 3 };
|
|
692575
692696
|
const auth = resolveAuth(req3);
|
|
692576
692697
|
if (!auth.authenticated) {
|
|
692698
|
+
if (process.env["OMNIUS_AUTH_DEBUG"] === "1") {
|
|
692699
|
+
const hasBearer = typeof req3.headers["authorization"] === "string" && req3.headers["authorization"].startsWith("Bearer ");
|
|
692700
|
+
const remoteIp = (req3.socket?.remoteAddress || "").replace(
|
|
692701
|
+
/^::ffff:/,
|
|
692702
|
+
""
|
|
692703
|
+
);
|
|
692704
|
+
const reason = !hasBearer ? "no_bearer_token" : anyAuthKeyConfigured() ? "token_not_recognized" : "no_server_keys_configured";
|
|
692705
|
+
process.stderr.write(
|
|
692706
|
+
`[auth] 401 ${reason} ip=${remoteIp} requiredScope=${requiredScope}
|
|
692707
|
+
`
|
|
692708
|
+
);
|
|
692709
|
+
}
|
|
692577
692710
|
jsonResponse(res, 401, {
|
|
692578
692711
|
error: "Unauthorized",
|
|
692579
|
-
message: "Invalid or missing Bearer token"
|
|
692712
|
+
message: "Invalid or missing Bearer token",
|
|
692713
|
+
hint: "Send 'Authorization: Bearer <token>'. The token must match OMNIUS_API_KEYS, a scoped OMNIUS_[REST_]<SCOPE>_API_KEY, OMNIUS_API_KEY, or a runtime/dashboard-minted key."
|
|
692580
692714
|
});
|
|
692581
692715
|
return false;
|
|
692582
692716
|
}
|
|
@@ -699713,9 +699847,7 @@ function startApiServer(options2 = {}) {
|
|
|
699713
699847
|
res.setHeader("X-API-Version", API_VERSION);
|
|
699714
699848
|
const rawIp = req3.socket?.remoteAddress ?? "";
|
|
699715
699849
|
const hasBearer = typeof req3.headers["authorization"] === "string" && req3.headers["authorization"].startsWith("Bearer ");
|
|
699716
|
-
const anyKeyConfigured = hasBearer &&
|
|
699717
|
-
process.env["OMNIUS_API_KEY"] || process.env["OMNIUS_API_KEYS"] || process.env["OMNIUS_REST_API_KEY"] || process.env["OMNIUS_REST_API_KEYS"] || process.env["OMNIUS_REST_READ_API_KEY"] || process.env["OMNIUS_REST_RUN_API_KEY"] || process.env["OMNIUS_REST_ADMIN_API_KEY"] || runtimeKeysExist()
|
|
699718
|
-
);
|
|
699850
|
+
const anyKeyConfigured = hasBearer && anyAuthKeyConfigured();
|
|
699719
699851
|
if (!isAllowedIP(rawIp, runtimeAccessMode) && !(hasBearer && anyKeyConfigured)) {
|
|
699720
699852
|
_accessRejected++;
|
|
699721
699853
|
metrics.totalErrors++;
|
|
@@ -700280,19 +700412,27 @@ function startApiServer(options2 = {}) {
|
|
|
700280
700412
|
}
|
|
700281
700413
|
}, 36e5).unref();
|
|
700282
700414
|
}
|
|
700283
|
-
|
|
700284
|
-
|
|
700285
|
-
const
|
|
700286
|
-
|
|
700287
|
-
`);
|
|
700288
|
-
|
|
700289
|
-
|
|
700415
|
+
{
|
|
700416
|
+
const sources = [];
|
|
700417
|
+
const multiMap = process.env["OMNIUS_REST_API_KEYS"] || process.env["OMNIUS_API_KEYS"];
|
|
700418
|
+
if (multiMap) {
|
|
700419
|
+
sources.push(`${multiMap.split(",").length} multi-key map entry(ies)`);
|
|
700420
|
+
}
|
|
700421
|
+
const scopedCount = scopedEnvKeySources().filter(
|
|
700422
|
+
(s2) => Boolean(s2.value)
|
|
700423
|
+
).length;
|
|
700424
|
+
if (scopedCount > 0) sources.push(`${scopedCount} scoped env key(s)`);
|
|
700425
|
+
if (process.env["OMNIUS_API_KEY"]) sources.push("legacy single key");
|
|
700426
|
+
if (runtimeKeysExist()) sources.push("runtime/dashboard keys");
|
|
700427
|
+
if (sources.length > 0) {
|
|
700428
|
+
log22(` Auth: enabled — ${sources.join(", ")}
|
|
700290
700429
|
`);
|
|
700291
|
-
|
|
700292
|
-
|
|
700293
|
-
|
|
700430
|
+
} else {
|
|
700431
|
+
log22(
|
|
700432
|
+
` Auth: disabled (set OMNIUS_RUN_API_KEY / OMNIUS_REST_API_KEY / OMNIUS_API_KEYS, or mint a runtime key, to enable)
|
|
700294
700433
|
`
|
|
700295
|
-
|
|
700434
|
+
);
|
|
700435
|
+
}
|
|
700296
700436
|
}
|
|
700297
700437
|
log22(` Discovering sponsors in background...
|
|
700298
700438
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.265",
|
|
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.265",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
|
@@ -6337,9 +6337,9 @@
|
|
|
6337
6337
|
"license": "MIT"
|
|
6338
6338
|
},
|
|
6339
6339
|
"node_modules/semver": {
|
|
6340
|
-
"version": "7.8.
|
|
6341
|
-
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.
|
|
6342
|
-
"integrity": "sha512-
|
|
6340
|
+
"version": "7.8.4",
|
|
6341
|
+
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.4.tgz",
|
|
6342
|
+
"integrity": "sha512-rUCObTnP32Q08R2uuIrt7r9PlEonuTmtuXYcW6s5kjdlj3xbnwe+21yXptAUYcMAABLkYYTtnmzb3w3EDZfueA==",
|
|
6343
6343
|
"license": "ISC",
|
|
6344
6344
|
"bin": {
|
|
6345
6345
|
"semver": "bin/semver.js"
|
package/package.json
CHANGED